2 |
Climb v2.0a4 |
Climb v2.0a4 |
3 |
Copyright (C) 2006-2007 Ian (Juan) Cammarata |
Copyright (C) 2006-2007 Ian (Juan) Cammarata |
4 |
|
|
5 |
This program is free software; you can redistribute it and/or modify it under |
This program is free software: you can redistribute it and/or modify |
6 |
the terms of the GNU General Public License as published by the Free Software |
it under the terms of the GNU Affero General Public License as |
7 |
Foundation; either version 2 of the License, or (at your option) any later |
published by the Free Software Foundation, either version 3 of the |
8 |
version. |
License, or (at your option) any later version. |
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY |
This program is distributed in the hope that it will be useful, |
11 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
|
GNU Affero General Public License for more details. |
14 |
|
|
15 |
You should have received a copy of the GNU General Public License along with |
You should have received a copy of the GNU Affero General Public License |
16 |
this program; go to http://www.opensource.org/licenses/gpl-license.php |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
18 |
|
|
19 |
http://ian.cammarata.us |
http://ian.cammarata.us |
128 |
+: Cvars mp_autoteambalance and mp_limitteams are set to 0 when a start button is found, and reverted when the map changes. |
+: Cvars mp_autoteambalance and mp_limitteams are set to 0 when a start button is found, and reverted when the map changes. |
129 |
+: Support for a2 maps start/finish buttons. |
+: Support for a2 maps start/finish buttons. |
130 |
+: Commands measure and measure2. |
+: Commands measure and measure2. |
|
+: Multiplayer friendly bhops. |
|
131 |
+: Command 'weapons', gives client one of each speed weapon. |
+: Command 'weapons', gives client one of each speed weapon. |
132 |
+: Ranking by weapon speed. ex: If you beat a map with AWP, you'll be ranked above other weapon scores. |
+: Ranking by weapon speed. ex: If you beat a map with AWP, you'll be ranked above other weapon scores. |
133 |
+: Command countdown to have time countdown from your best time instead of counting up. |
+: Command countdown to have time countdown from your best time instead of counting up. |
155 |
f: An exploit that involved a paused player with their view attached to something else. |
f: An exploit that involved a paused player with their view attached to something else. |
156 |
f: Bug where respawn command would spawn clients at maps origin if plugin was enabled without running init functions. |
f: Bug where respawn command would spawn clients at maps origin if plugin was enabled without running init functions. |
157 |
f: Bug where multiple players could connect and get logged in with the same db user id. |
f: Bug where multiple players could connect and get logged in with the same db user id. |
|
//f: Scoreboard buffer overflow that made players names get replaced with a path string. |
|
158 |
|
|
159 |
v2.0a3 (JUNE 21, 2007) |
v2.0a3 (JUNE 21, 2007) |
160 |
+: New alias for restart, /start. |
+: New alias for restart, /start. |
268 |
#include <cstrike> |
#include <cstrike> |
269 |
#include <cstrike2> |
#include <cstrike2> |
270 |
|
|
271 |
#define VERSION "a3.6.19 Oct 08 04:41 MST" |
new const VERSION[ ] = "a3.7.4 Nov 24 15:41 MST" |
272 |
|
new const TRKCVAR[ ] = "climb_version" |
273 |
|
|
274 |
|
new const DONOTHING[ ] = "donothing" |
275 |
|
new const NULLSTR[ ] = "" |
276 |
|
|
277 |
#define IN_ATTACK_EITHER ( IN_ATTACK + IN_ATTACK2 ) |
#define IN_ATTACK_EITHER ( IN_ATTACK + IN_ATTACK2 ) |
278 |
|
|
297 |
|
|
298 |
//Client flags arrays |
//Client flags arrays |
299 |
#define ORIGINS_SIZE 48 |
#define ORIGINS_SIZE 48 |
300 |
new Float:origins[32][ORIGINS_SIZE] |
new Float:origins[33][ORIGINS_SIZE] |
301 |
#define ORIG_UNGC 40 |
#define ORIG_UNGC 40 |
302 |
#define ORIG_PAUS 44 |
#define ORIG_PAUS 44 |
303 |
//#define ORIG_X 0 |
//#define ORIG_X 0 |
305 |
//#define ORIG_Z 2 |
//#define ORIG_Z 2 |
306 |
#define ORIG_GRAV 3 |
#define ORIG_GRAV 3 |
307 |
|
|
308 |
new time_stamps[32][5]//time_stamps[id-1][x] |
new time_stamps[33][5]//time_stamps[id][x] |
309 |
#define TS_SPAWN 0 |
#define TS_SPAWN 0 |
310 |
#define TS_BOOST 1 |
#define TS_BOOST 1 |
311 |
#define TS_WPN 2 |
#define TS_WPN 2 |
312 |
#define TS_CPGC 3 //This one holds a flag, not a timestamp so it can be < 1 second |
#define TS_CPGC 3 //This one holds a flag, not a timestamp so it can be < 1 second |
313 |
#define TS_KNIFE 4 |
#define TS_KNIFE 4 |
314 |
|
|
315 |
#define TIMER_SIZE 16 |
#define TIMER_SIZE 15 |
316 |
new timer[32][TIMER_SIZE]//timer[id-1][x]: |
new timer[33][TIMER_SIZE]//timer[id][x]: |
317 |
#define TMR_CFLAGS 0 //Status |
#define TMR_CFLAGS 0 //Status |
318 |
#define TMR_STARTD 1 //Start Time |
#define TMR_CNTTME 1 //Time / in deciseconds |
319 |
#define TMR_FINISH 2 //Finish Time |
#define TMR_CNTCPS 2 //CP Count |
320 |
#define TMR_CNTCPS 3 //CP Count |
#define TMR_CNTGCS 3 //GC Count |
321 |
#define TMR_CNTGCS 4 //GC Count |
#define TMR_CNTBST 4 //Boosts |
322 |
#define TMR_CNTBST 5 //Boosts |
#define TMR_BSTTME 5 //Best Time / in deciseconds |
323 |
#define TMR_BSTTME 6 //Best Time |
#define TMR_BSTCPS 6 //Best CP |
324 |
#define TMR_BSTCPS 7 //Best CP |
#define TMR_BSTGCS 7 //Best GC |
325 |
#define TMR_BSTGCS 8 //Best GC |
#define TMR_BSTBST 8 //Number of boosts used |
326 |
#define TMR_BSTBST 9 //Number of boosts used |
#define TMR_SESFIN 9 //Finished this session |
327 |
#define TMR_SESFIN 10 //Finished this session |
#define TMR_MAPFIN 10 //Total times finished this map |
328 |
#define TMR_MAPFIN 11 //Total times finished this map |
#define TMR_DBUSER 11 //Database player ID; 0=not registered; -1=not registered & shared steam id |
329 |
#define TMR_DBUSER 12 //Database player ID; 0=not registered; -1=not registered & shared steam id |
#define TMR_CPPOS 12 //Current CP offset, for cycling back and forward through cps |
330 |
#define TMR_CPPOS 13 //Current CP offset, for cycling back and forward through cps |
#define TMR_CNTWPN 13 //Current weapon rank modifier |
331 |
#define TMR_CNTWPN 14 //Current weapon rank modifier |
#define TMR_BSTWPN 14 //Best score weapon rank modifier |
|
#define TMR_BSTWPN 15 //Best score weapon rank modifier |
|
332 |
|
|
333 |
//Temp save vars |
//Temp save vars |
334 |
new savepos = 0, steamid[32][32], Float:originssave[32][ORIGINS_SIZE], timersave[32][TIMER_SIZE] |
new savepos = 0, steamid[32][32], Float:originssave[32][ORIGINS_SIZE], timersave[32][TIMER_SIZE] |
335 |
|
|
336 |
//Other stuff |
//Other stuff |
337 |
new hooked[32], hp = 100 |
new hooked[33], hp = 100 |
338 |
new sfactions[SF_MAX][50], sfcount = 0 |
new sfactions[SF_MAX][50], sfcount = 0 |
339 |
new ts_score, ts_hscore, bool:has_hscores = false //scoreboard timeouts |
new ts_score, ts_hscore, bool:has_hscores = false //scoreboard timeouts |
340 |
new spec_ids[32][32] |
new spec_ids[33][33] |
341 |
new beam_sprite |
new beam_sprite |
342 |
|
|
343 |
new ST_BTNS[9], FN_BTNS[9], ST_BTN_CNT = 0, FN_BTN_CNT = 0 |
new ST_BTNS[9], FN_BTNS[9], ST_BTN_CNT = 0, FN_BTN_CNT = 0 |
344 |
new dyn_spawn_ids[32], dyn_spawn_count, Float:spawn_tp_orig[3], Float:start_tp_orig[3] |
new dyn_spawn_ids[32], dyn_spawn_count, Float:spawn_tp_orig[3], Float:start_tp_orig[3] |
345 |
|
|
346 |
new bool:sclip[32],Float:post_think_vel[32][3],sc_fcount |
new bool:sclip[33],Float:post_think_vel[33][3],sc_fcount |
347 |
|
|
348 |
new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD |
new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD |
349 |
|
|
|
//Bhop fix vars |
|
|
#define MAX_DOORS 500 |
|
|
new door_count = 0, func_doors[MAX_DOORS][3], Float:door_tp_pos[MAX_DOORS][3] |
|
|
new bhop_failid[32], bool:bhop_fail[32] |
|
|
//func_doors[x]{ id, speed, angles } |
|
|
|
|
350 |
//Cvar Pointers |
//Cvar Pointers |
351 |
new p_climb, p_auto, p_boost, p_cpprice, p_startmoney |
new p_climb, p_auto, p_boost, p_cpprice, p_startmoney |
352 |
new p_msg_r, p_msg_g, p_msg_b, p_msg_x, p_msg_y |
new p_msg_r, p_msg_g, p_msg_b, p_msg_x, p_msg_y |
365 |
#define TSK_AUTORSPN 100 //100+: Auto Respawn |
#define TSK_AUTORSPN 100 //100+: Auto Respawn |
366 |
//#define TSK_BOOSTTMR 150 //150+: Solid Boost Timer |
//#define TSK_BOOSTTMR 150 //150+: Solid Boost Timer |
367 |
#define TSK_FLIGHT 200 |
#define TSK_FLIGHT 200 |
368 |
#define TSK_BHOP 250 |
#define TSK_MEASURE2 250 |
|
#define TSK_CLEAR_FAIL 300 |
|
|
#define TSK_MEASURE2 350 |
|
369 |
|
|
370 |
//Status timer[id-1][TMR_CFLAGS]&=x |
//Status timer[id][TMR_CFLAGS]&=x |
371 |
#define CF_NULL 0 //Passed to change_boost() to remove all boost flags |
#define CF_NULL 0 //Passed to change_boost() to remove all boost flags |
372 |
#define CF_STOP (1<<0) //STATUS FLAG: Not Started |
#define CF_STOP (1<<0) //STATUS FLAG: Not Started |
373 |
#define CF_START (1<<1) //STATUS FLAG: Climbing |
#define CF_START (1<<1) //STATUS FLAG: Climbing |
384 |
#define CF_COUNTDOWN (1<<11) |
#define CF_COUNTDOWN (1<<11) |
385 |
#define CF_SUNGLASSES (1<<12) |
#define CF_SUNGLASSES (1<<12) |
386 |
|
|
387 |
new WPN_CLASS[30][17] = { "weapon_p228", |
#define SILENT 1 |
|
"", |
|
|
"weapon_scout", |
|
|
"", //"weapon_hegrenade", |
|
|
"weapon_xm1014", |
|
|
"", //"weapon_c4", |
|
|
"weapon_mac10", |
|
|
"weapon_aug", |
|
|
"", //"weapon_smokegrenade", |
|
|
"weapon_elite", |
|
|
"weapon_fiveseven", |
|
|
"weapon_ump45", |
|
|
"weapon_sg550", |
|
|
"weapon_galil", |
|
|
"weapon_famas", |
|
|
"weapon_usp", |
|
|
"weapon_glock18", |
|
|
"weapon_awp", |
|
|
"weapon_mp5navy", |
|
|
"weapon_m249", |
|
|
"weapon_m3", |
|
|
"weapon_m4a1", |
|
|
"weapon_tmp", |
|
|
"weapon_g3sg1", |
|
|
"", //"weapon_flashbang", |
|
|
"weapon_deagle", |
|
|
"weapon_sg552", |
|
|
"weapon_ak47", |
|
|
"", //"weapon_knife", |
|
|
"weapon_p90" } |
|
388 |
|
|
389 |
new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE |
new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE |
390 |
|
|
395 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
396 |
public plugin_init( ) |
public plugin_init( ) |
397 |
{ |
{ |
|
MAXPLAYERS = get_maxplayers( ) |
|
398 |
register_plugin( "Climb", VERSION, "Ian Cammarata" ) |
register_plugin( "Climb", VERSION, "Ian Cammarata" ) |
399 |
register_cvar( "climb_version", VERSION, FCVAR_SERVER ) |
register_cvar( TRKCVAR, VERSION, FCVAR_SERVER ) |
400 |
|
set_cvar_string( TRKCVAR, VERSION ) |
|
//This line is for nightly builds only, to keep tracking cvar updated. |
|
|
set_cvar_string( "climb_version", VERSION ) |
|
401 |
|
|
402 |
p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) |
p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) |
403 |
p_auto = register_cvar( "climb_auto", "1" ) |
p_auto = register_cvar( "climb_auto", "1" ) |
408 |
register_cvar( "climb_save", "1" ) |
register_cvar( "climb_save", "1" ) |
409 |
register_cvar( "climb_db_type", "sqlite" ) |
register_cvar( "climb_db_type", "sqlite" ) |
410 |
register_cvar( "climb_db_host", "127.0.0.1" ) |
register_cvar( "climb_db_host", "127.0.0.1" ) |
411 |
register_cvar( "climb_db_user", "" ) |
register_cvar( "climb_db_user", NULLSTR ) |
412 |
register_cvar( "climb_db_pass", "", FCVAR_PROTECTED ) |
register_cvar( "climb_db_pass", NULLSTR, FCVAR_PROTECTED ) |
413 |
register_cvar( "climb_db_name", "climb" ) |
register_cvar( "climb_db_name", "climb" ) |
414 |
register_cvar( "climb_db_prefix", "climb_" ) |
register_cvar( "climb_db_prefix", "climb_" ) |
415 |
register_cvar( "climb_db_serverid", "" ) |
register_cvar( "climb_db_serverid", NULLSTR ) |
416 |
register_cvar( "climb_db_exists", "0" ) |
register_cvar( "climb_db_exists", "0" ) |
417 |
|
|
418 |
p_msg_r = register_cvar( "climb_msg_r", "0" ) |
p_msg_r = register_cvar( "climb_msg_r", "0" ) |
430 |
p_start_respawn = register_cvar( "climb_start_respawn", "0" ) |
p_start_respawn = register_cvar( "climb_start_respawn", "0" ) |
431 |
p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ) |
p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ) |
432 |
|
|
433 |
p_stats_hsurl = register_cvar( "climb_stats_hsurl", "" ) //Use %s in place of map name |
p_stats_hsurl = register_cvar( "climb_stats_hsurl", NULLSTR ) //Use %s in place of map name |
434 |
p_stats_msg = register_cvar( "climb_stats_msg", "" ) |
p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR ) |
435 |
|
|
436 |
p_allow_spectators = get_cvar_pointer( "allow_spectators" ) |
p_allow_spectators = get_cvar_pointer( "allow_spectators" ) |
437 |
p_teambalance = get_cvar_pointer( "mp_autoteambalance" ) |
p_teambalance = get_cvar_pointer( "mp_autoteambalance" ) |
438 |
p_limitteams = get_cvar_pointer( "mp_limitteams" ) |
p_limitteams = get_cvar_pointer( "mp_limitteams" ) |
439 |
|
|
440 |
|
MAXPLAYERS = get_maxplayers( ) |
441 |
|
|
442 |
TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ) |
TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ) |
443 |
LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ) |
LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ) |
444 |
|
|
470 |
//Commands referencing function 'donothing' are picked up by the more flexible code in the client_command forward. |
//Commands referencing function 'donothing' are picked up by the more flexible code in the client_command forward. |
471 |
register_clcmd( "say help", "help_msg" ) |
register_clcmd( "say help", "help_msg" ) |
472 |
register_clcmd( "say /help", "help_msg" ) |
register_clcmd( "say /help", "help_msg" ) |
473 |
register_clcmd( "climbhelp", "donothing", 0, "- Veiw climb help." ) |
register_clcmd( "climbhelp", DONOTHING, 0, "- Veiw climb help." ) |
474 |
register_clcmd( "cp", "donothing", _, "- Make a checkpoint" ) |
register_clcmd( "cp", DONOTHING, _, "- Make a checkpoint" ) |
475 |
register_clcmd( "gc", "donothing", _, "- Teleport to last checkpoint" ) |
register_clcmd( "gc", DONOTHING, _, "- Teleport to last checkpoint" ) |
476 |
register_clcmd( "stuck", "donothing", _, "- Teleport to previous checkpoint" ) |
register_clcmd( "stuck", DONOTHING, _, "- Teleport to previous checkpoint" ) |
477 |
register_clcmd( "restart","donothing", _, "- Stop and respawn." ) |
register_clcmd( "restart", DONOTHING, _, "- Stop and respawn." ) |
478 |
register_clcmd( "stop", "donothing", _, "- End current climbing run." ) |
register_clcmd( "stop", DONOTHING, _, "- End current climbing run." ) |
479 |
register_clcmd( "pause", "donothing", _, "- Pause yourself." ) |
register_clcmd( "pause", DONOTHING, _, "- Pause yourself." ) |
480 |
register_clcmd( "scoreboard", "donothing", _, "- View score board." ) |
register_clcmd( "scoreboard", DONOTHING, _, "- View score board." ) |
481 |
register_clcmd( "respawn", "donothing", _, "- Force respawn" ) |
register_clcmd( "respawn", DONOTHING, _, "- Force respawn" ) |
482 |
register_clcmd( "boost", "donothing", _, "- Boost." ) |
register_clcmd( "boost", DONOTHING, _, "- Boost." ) |
483 |
register_clcmd( "spec", "donothing", _, "- Spectate mode." ) |
register_clcmd( "spec", DONOTHING, _, "- Spectate mode." ) |
484 |
register_clcmd( "ungc", "donothing", _, "- Undo last gocheck." ) |
register_clcmd( "ungc", DONOTHING, _, "- Undo last gocheck." ) |
485 |
|
|
486 |
//Commands related to stats account system. |
//Commands related to stats account system. |
487 |
//register_clcmd( "register", "reg", _, "- (Console Only) Register for stats tracking." ) |
//register_clcmd( "register", "reg", _, "- (Console Only) Register for stats tracking." ) |
505 |
//Events |
//Events |
506 |
register_event("DeathMsg","DeathMsg","a") |
register_event("DeathMsg","DeathMsg","a") |
507 |
register_event("ResetHUD","ResetHUD","b") |
register_event("ResetHUD","ResetHUD","b") |
508 |
register_event("Health","damage","b") |
register_event("Health","Health","b") |
509 |
register_event("ShowMenu","menuclass","b","4&CT_Select","4&Terrorist_Select") |
register_event("ShowMenu","menuclass","b","4&CT_Select","4&Terrorist_Select") |
510 |
register_event("ShowMenu","menuteam","b","4&Team_Select_Spect","4&Team_Select","4&IG_Team_Select") |
register_event("ShowMenu","menuteam","b","4&Team_Select_Spect","4&Team_Select","4&IG_Team_Select") |
511 |
|
|
519 |
set_task( 0.5, "hudtime", _, _, _, "b" ) //Task to update time on clients HUD; Task set for half second to minimize flickering of the timer. |
set_task( 0.5, "hudtime", _, _, _, "b" ) //Task to update time on clients HUD; Task set for half second to minimize flickering of the timer. |
520 |
set_task( 1.0, "spec_update", _, _, _, "b" ) //Task to update spectator array |
set_task( 1.0, "spec_update", _, _, _, "b" ) //Task to update spectator array |
521 |
set_task( 5.0, "run_tasks", _, _, _, "b" ) |
set_task( 5.0, "run_tasks", _, _, _, "b" ) |
522 |
|
set_task( 0.1, "timer_tick", _, _, _, "b" ) |
523 |
|
|
524 |
register_message( get_user_msgid( "CurWeapon" ), "CurWeapon" ) |
register_message( get_user_msgid( "CurWeapon" ), "CurWeapon" ) |
|
register_message( get_user_msgid( "ReqState" ), "bot_msg_block" ) |
|
|
register_message( get_user_msgid( "Radar" ), "bot_msg_block" ) |
|
525 |
|
|
526 |
register_forward( FM_UpdateClientData, "PostUpdateClientData", 1 ) |
register_forward( FM_UpdateClientData, "PostUpdateClientData", 1 ) |
527 |
|
|
574 |
} |
} |
575 |
} |
} |
576 |
|
|
|
static last_ent |
|
|
new class[31], key[31], val[31] |
|
|
copy_keyvalue( class, 30, key, 30, val, 30 ) |
|
|
|
|
|
if( ent != last_ent && func_doors[door_count][0] && door_count < MAX_DOORS ) |
|
|
door_count++ |
|
|
|
|
|
if( equal( class, "func_door" ) ) |
|
|
{ |
|
|
//func_doors[x]{ id, speed, angles } |
|
|
|
|
|
if( ent != last_ent ) func_doors[door_count][0] = ent |
|
|
|
|
|
if( equal( key, "speed" ) ) |
|
|
func_doors[door_count][1] = str_to_num(val) |
|
|
if( equal( key, "dmg" ) ) |
|
|
func_doors[door_count][0] = 0 |
|
|
if( equal( key, "angles" ) ) |
|
|
{ |
|
|
new angles[5] |
|
|
parse( val, angles, 4 ) |
|
|
func_doors[door_count][2] = str_to_num( angles ) |
|
|
} |
|
|
last_ent = ent |
|
|
} |
|
|
|
|
577 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
578 |
} |
} |
579 |
|
|
581 |
{ |
{ |
582 |
new ent, ent2, tmpstr[33], Float:tmpflt |
new ent, ent2, tmpstr[33], Float:tmpflt |
583 |
|
|
|
if( func_doors[door_count][0] && door_count < MAX_DOORS ) |
|
|
door_count++ |
|
|
|
|
|
//Find tp spots for doors, in case they're used for bhop |
|
|
//func_doors[x]{ id, speed, angles } |
|
|
for( new i = 0; i < door_count; i++ ) |
|
|
{ |
|
|
ent = func_doors[i][0] |
|
|
if( !is_valid_ent( ent ) ) func_doors[i][0] = 0 |
|
|
else |
|
|
{ |
|
|
new Float:dmins[3], Float:dmaxs[3] |
|
|
entity_get_vector( ent, EV_VEC_mins, dmins ) |
|
|
entity_get_vector( ent, EV_VEC_maxs, dmaxs ) |
|
|
|
|
|
new dwid = floatround( dmaxs[0] - dmins[0] ) |
|
|
new dlen = floatround( dmaxs[1] - dmins[1] ) |
|
|
|
|
|
//If the door moves up, or is thin, remove it's id from the array |
|
|
if( func_doors[i][2] < 0 || dwid < 24 || dlen < 24 ) |
|
|
func_doors[i][0] = 0 |
|
|
//Otherwise find a safe tp spot in case it's a bhop door |
|
|
else |
|
|
{ |
|
|
//If it has a targetname, change the id in array to targeter |
|
|
entity_get_string( ent, EV_SZ_targetname, tmpstr, 32 ) |
|
|
if( strlen( tmpstr ) ) |
|
|
{ |
|
|
ent2 = find_ent_by_target( -1, tmpstr ) |
|
|
if( ent2 ) |
|
|
{ |
|
|
func_doors[i][0] = ent2 |
|
|
|
|
|
//If targeter is a button, remove it's id from the array |
|
|
entity_get_string( ent2, EV_SZ_classname, tmpstr, 32 ) |
|
|
if( equal( tmpstr, "func_button" ) ) |
|
|
func_doors[i][0] = 0 |
|
|
} |
|
|
} |
|
|
|
|
|
new Float:tmpvec[3], Float:tmpvec2[3] |
|
|
|
|
|
new Float:dr_tc[3] |
|
|
dr_tc[0] = ( dmaxs[0] + dmins[0] ) / 2 |
|
|
dr_tc[1] = ( dmaxs[1] + dmins[1] ) / 2 |
|
|
dr_tc[2] = dmaxs[2] |
|
|
|
|
|
tmpvec[0] = ( dmaxs[0] + dmins[0] ) / 2 |
|
|
tmpvec[1] = dmaxs[1] + 20 |
|
|
tmpvec[2] = dmaxs[2] + 20 |
|
|
trace_line( ent, dr_tc, tmpvec, tmpvec2 ) |
|
|
if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) |
|
|
door_tp_pos[i] = tmpvec |
|
|
else |
|
|
{ |
|
|
tmpvec[1] = dmins[1] - 20 |
|
|
trace_line( ent, dr_tc, tmpvec, tmpvec2 ) |
|
|
if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) |
|
|
door_tp_pos[i] = tmpvec |
|
|
else |
|
|
{ |
|
|
tmpvec[0] = dmaxs[0] + 20 |
|
|
tmpvec[1] = ( dmaxs[1] + dmins[1] ) / 2 |
|
|
trace_line( ent, dr_tc, tmpvec, tmpvec2 ) |
|
|
if( !trace_hull( tmpvec, HULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) |
|
|
door_tp_pos[i] = tmpvec |
|
|
else |
|
|
{ |
|
|
tmpvec[0] = dmins[0] - 20 |
|
|
door_tp_pos[i] = tmpvec |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
584 |
//Store ent id's for start/fin buttons, some maps change target value after timer starts |
//Store ent id's for start/fin buttons, some maps change target value after timer starts |
585 |
ent = find_ent_by_class( -1, "func_button" ) |
ent = find_ent_by_class( -1, "func_button" ) |
586 |
while( ent > 0 ) |
while( ent > 0 ) |
783 |
{ |
{ |
784 |
if( get_pcvar_num( p_climb ) && !is_user_bot( id ) && !is_user_hltv( id ) ) |
if( get_pcvar_num( p_climb ) && !is_user_bot( id ) && !is_user_hltv( id ) ) |
785 |
{ |
{ |
786 |
timer[id-1][TMR_DBUSER] = 0 |
timer[id][TMR_DBUSER] = 0 |
787 |
|
|
788 |
//search steamid to position reference for match |
//search steamid to position reference for match |
789 |
new searchid[32] |
new searchid[32] |
791 |
for(new i = 0; i < 32; i++ ) |
for(new i = 0; i < 32; i++ ) |
792 |
if( equal( searchid, steamid[i] ) ) |
if( equal( searchid, steamid[i] ) ) |
793 |
{//load origins & timer array if match found |
{//load origins & timer array if match found |
794 |
origins[id-1] = originssave[i] |
origins[id] = originssave[i] |
795 |
timer[id-1] = timersave[i] |
timer[id] = timersave[i] |
796 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
797 |
} |
} |
798 |
|
|
799 |
timer[id-1][TMR_CFLAGS] += CF_STOP |
timer[id][TMR_CFLAGS] += CF_STOP |
800 |
|
|
801 |
new ida[1] |
new ida[1] |
802 |
ida[0]=id |
ida[0]=id |
803 |
|
|
804 |
if( CLIMB_SAVE && timer[id-1][TMR_DBUSER] < 1 ) |
if( CLIMB_SAVE && timer[id][TMR_DBUSER] < 1 ) |
805 |
set_task( 5.0, "auto_login", 0, ida, 1 ) |
set_task( 5.0, "auto_login", 0, ida, 1 ) |
806 |
} |
} |
807 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
819 |
|
|
820 |
//erase previous save if exists |
//erase previous save if exists |
821 |
for( new i=0; i<32; i++ ) |
for( new i=0; i<32; i++ ) |
822 |
if( equal( saveid, steamid[i] ) ) steamid[i] = "" |
if( equal( saveid, steamid[i] ) ) steamid[i] = NULLSTR |
823 |
|
|
824 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) change_status( id, CF_PAUSE ) //Pause if running |
if( timer[id][TMR_CFLAGS] & CF_START ) change_status( id, CF_PAUSE ) //Pause if running |
825 |
steamid[savepos] = saveid //save steamid to position reference |
steamid[savepos] = saveid //save steamid to position reference |
826 |
originssave[savepos] = origins[id-1] //save origins |
originssave[savepos] = origins[id] //save origins |
827 |
timersave[savepos] = timer[id-1] //save timer array |
timersave[savepos] = timer[id] //save timer array |
828 |
|
|
829 |
//clear data for new client in that slot |
//clear data for new client in that slot |
830 |
for( new i = 0; i < 48; i++ ) origins[id-1][i] = 0.0 |
for( new i = 0; i < 48; i++ ) origins[id][i] = 0.0 |
831 |
for( new i = 0; i < 14; i++ ) timer[id-1][i] = 0 |
for( new i = 0; i < 14; i++ ) timer[id][i] = 0 |
832 |
hooked[id] = 0 |
hooked[id] = 0 |
833 |
sortcssb( ) //Update frags to reorder scoreboard |
sortcssb( ) //Update frags to reorder scoreboard |
834 |
} |
} |
842 |
//Set timeout flag and set_task to clear it |
//Set timeout flag and set_task to clear it |
843 |
new ida[1] |
new ida[1] |
844 |
ida[0] = id |
ida[0] = id |
845 |
time_stamps[id-1][TS_CPGC] = 1 |
time_stamps[id][TS_CPGC] = 1 |
846 |
set_task( CPGC_TIMEOUT, "clear_cpgc_timeout", _, ida, 1 ) |
set_task( CPGC_TIMEOUT, "clear_cpgc_timeout", _, ida, 1 ) |
847 |
} |
} |
848 |
|
|
849 |
public clear_cpgc_timeout( ida[1] ) |
public clear_cpgc_timeout( ida[1] ) |
850 |
return time_stamps[ida[0]-1][TS_CPGC]=0 |
return time_stamps[ida[0]][TS_CPGC]=0 |
851 |
|
|
852 |
//Save a checkpoint |
//Save a checkpoint |
853 |
public check( id ) |
public check( id ) |
876 |
entity_get_vector( id, EV_VEC_origin, coords ) |
entity_get_vector( id, EV_VEC_origin, coords ) |
877 |
if( coords[0] || coords[1] || coords[2] )//and they're not at world origin, then save checkpoint |
if( coords[0] || coords[1] || coords[2] )//and they're not at world origin, then save checkpoint |
878 |
{ |
{ |
879 |
if( timer[id-1][TMR_CPPOS] > 0 ) timer[id-1][TMR_CPPOS]-- |
if( timer[id][TMR_CPPOS] > 0 ) timer[id][TMR_CPPOS]-- |
880 |
new cppos = timer[id-1][TMR_CPPOS] * 4 |
new cppos = timer[id][TMR_CPPOS] * 4 |
881 |
|
|
882 |
//If cp position is 0 then bump all cps back before saving. |
//If cp position is 0 then bump all cps back before saving. |
883 |
if( !cppos ) for(new i=39; i>3 ;i-- ) origins[id-1][i] = origins[id-1][i-4] |
if( !cppos ) for(new i=39; i>3 ;i-- ) origins[id][i] = origins[id][i-4] |
884 |
|
|
885 |
for( new i=0; i<3; i++ ) origins[id-1][cppos + i] = coords[i] |
for( new i=0; i<3; i++ ) origins[id][cppos + i] = coords[i] |
886 |
origins[id-1][3]=entity_get_float(id, EV_FL_gravity) |
origins[id][3]=entity_get_float(id, EV_FL_gravity) |
887 |
|
|
888 |
new msg[100]="Checkpoint saved." |
new msg[100]="Checkpoint saved." |
889 |
if(timer[id-1][TMR_CFLAGS]&CF_START){ |
if(timer[id][TMR_CFLAGS]&CF_START){ |
890 |
timer[id-1][TMR_CNTCPS]++ |
timer[id][TMR_CNTCPS]++ |
891 |
formatex(msg,99,"Checkpoint saved. (%d CPS/ %d GCS/ %d Boosts)",timer[id-1][TMR_CNTCPS],timer[id-1][TMR_CNTGCS],timer[id-1][TMR_CNTBST]) |
formatex(msg,99,"Checkpoint saved. (%d CPS/ %d GCS/ %d Boosts)",timer[id][TMR_CNTCPS],timer[id][TMR_CNTGCS],timer[id][TMR_CNTBST]) |
892 |
} |
} |
893 |
clmsg(id,msg) |
clmsg(id,msg) |
894 |
|
|
906 |
//Go to most recent checkpoint |
//Go to most recent checkpoint |
907 |
public gocheck( id ) |
public gocheck( id ) |
908 |
{ |
{ |
909 |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id-1][TS_CPGC] ) |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id][TS_CPGC] ) |
910 |
{ |
{ |
911 |
if( origins[id-1][0] || origins[id-1][1] || origins[id-1][2] ) |
if( origins[id][0] || origins[id][1] || origins[id][2] ) |
912 |
{ |
{ |
913 |
new Float:coords[3] |
new Float:coords[3] |
914 |
|
|
915 |
//Store ungocheck data |
//Store ungocheck data |
916 |
entity_get_vector( id, EV_VEC_origin, coords ) |
entity_get_vector( id, EV_VEC_origin, coords ) |
917 |
for( new i=0; i<3; i++ ) origins[id-1][ORIG_UNGC + i] = coords[i] |
for( new i=0; i<3; i++ ) origins[id][ORIG_UNGC + i] = coords[i] |
918 |
origins[id-1][ORIG_UNGC + 3] = entity_get_float( id, EV_FL_gravity ) |
origins[id][ORIG_UNGC + 3] = entity_get_float( id, EV_FL_gravity ) |
919 |
|
|
920 |
//Do gocheck |
//Do gocheck |
921 |
new cppos = timer[id-1][TMR_CPPOS] * 4 |
new cppos = timer[id][TMR_CPPOS] * 4 |
922 |
for( new i=0; i<3; i++ ) coords[i] = origins[id-1][cppos + i] |
for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i] |
923 |
entity_set_float( id, EV_FL_gravity, origins[id-1][3] ) |
entity_set_float( id, EV_FL_gravity, origins[id][3] ) |
924 |
teleport( id, coords ) |
teleport( id, coords ) |
925 |
|
|
926 |
new msg[100]="Checkpoint restored." |
new msg[100]="Checkpoint restored." |
927 |
if(timer[id-1][TMR_CFLAGS]&CF_START){ |
if(timer[id][TMR_CFLAGS]&CF_START){ |
928 |
timer[id-1][TMR_CNTGCS]++ |
timer[id][TMR_CNTGCS]++ |
929 |
formatex(msg,99,"Checkpoint restored. (%d CPS/ %d GCS/ %d Boosts)",timer[id-1][TMR_CNTCPS],timer[id-1][TMR_CNTGCS],timer[id-1][TMR_CNTBST]) |
formatex(msg,99,"Checkpoint restored. (%d CPS/ %d GCS/ %d Boosts)",timer[id][TMR_CNTCPS],timer[id][TMR_CNTGCS],timer[id][TMR_CNTBST]) |
930 |
} |
} |
931 |
clmsg(id,msg) |
clmsg(id,msg) |
932 |
|
|
943 |
//Undo a gocheck |
//Undo a gocheck |
944 |
public ungocheck( id ) |
public ungocheck( id ) |
945 |
{ |
{ |
946 |
if( get_pcvar_num(p_climb) && isalive(id) && notpaused(id) && !time_stamps[id-1][TS_CPGC] ) |
if( get_pcvar_num(p_climb) && isalive(id) && notpaused(id) && !time_stamps[id][TS_CPGC] ) |
947 |
{ |
{ |
948 |
if( origins[id-1][ORIG_UNGC] || origins[id-1][ORIG_UNGC + 1] || origins[id-1][ORIG_UNGC + 2]) |
if( origins[id][ORIG_UNGC] || origins[id][ORIG_UNGC + 1] || origins[id][ORIG_UNGC + 2]) |
949 |
{ |
{ |
950 |
new Float:coords[3] |
new Float:coords[3] |
951 |
for( new i=0; i<3; i++ )coords[i] = origins[id-1][ORIG_UNGC + i] |
for( new i=0; i<3; i++ )coords[i] = origins[id][ORIG_UNGC + i] |
952 |
teleport( id, coords ) |
teleport( id, coords ) |
953 |
entity_set_float( id, EV_FL_gravity, origins[id-1][ORIG_UNGC + 3] ) |
entity_set_float( id, EV_FL_gravity, origins[id][ORIG_UNGC + 3] ) |
954 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) timer[id-1][TMR_CNTGCS]++ |
if( timer[id][TMR_CFLAGS] & CF_START ) timer[id][TMR_CNTGCS]++ |
955 |
clmsg( id, "You have been ungochecked." ) |
clmsg( id, "You have been ungochecked." ) |
956 |
|
|
957 |
set_cpgc_timeout( id ) |
set_cpgc_timeout( id ) |
963 |
//Cycle back through CPs |
//Cycle back through CPs |
964 |
public cp_back( id ) |
public cp_back( id ) |
965 |
{ |
{ |
966 |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id-1][TS_CPGC] ) |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id][TS_CPGC] ) |
967 |
{ |
{ |
968 |
if( timer[id-1][TMR_CPPOS] < 9 ) timer[id-1][TMR_CPPOS]++ |
if( timer[id][TMR_CPPOS] < 9 ) timer[id][TMR_CPPOS]++ |
969 |
new cppos = timer[id-1][TMR_CPPOS] * 4 |
new cppos = timer[id][TMR_CPPOS] * 4 |
970 |
if( origins[id-1][cppos] || origins[id-1][cppos + 1] || origins[id-1][cppos + 2] ) |
if( origins[id][cppos] || origins[id][cppos + 1] || origins[id][cppos + 2] ) |
971 |
{ |
{ |
972 |
new Float:coords[3] |
new Float:coords[3] |
973 |
//for( new i=0; i<36; i++ ) origins[id-1][i] = origins[id-1][i+4] |
//for( new i=0; i<36; i++ ) origins[id][i] = origins[id][i+4] |
974 |
for( new i=0; i<3; i++ ) coords[i] = origins[id-1][cppos + i] |
for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i] |
975 |
entity_set_float( id, EV_FL_gravity, origins[id-1][cppos + ORIG_GRAV] ) |
entity_set_float( id, EV_FL_gravity, origins[id][cppos + ORIG_GRAV] ) |
976 |
teleport( id, coords ) |
teleport( id, coords ) |
977 |
|
|
978 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) timer[id-1][TMR_CNTGCS]++ |
if( timer[id][TMR_CFLAGS] & CF_START ) timer[id][TMR_CNTGCS]++ |
979 |
|
|
980 |
/*new msg[100]="Previous checkpoint restored." |
/*new msg[100]="Previous checkpoint restored." |
981 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) |
if( timer[id][TMR_CFLAGS] & CF_START ) |
982 |
{ |
{ |
983 |
timer[id-1][TMR_CNTCPS]-- |
timer[id][TMR_CNTCPS]-- |
984 |
formatex( msg, 99, "Previous checkpoint restored. (%d CPS/ %d GCS/ %d Boosts)",\ |
formatex( msg, 99, "Previous checkpoint restored. (%d CPS/ %d GCS/ %d Boosts)",\ |
985 |
timer[id-1][TMR_CNTCPS], timer[id-1][TMR_CNTGCS], timer[id-1][TMR_CNTBST] ) |
timer[id][TMR_CNTCPS], timer[id][TMR_CNTGCS], timer[id][TMR_CNTBST] ) |
986 |
} |
} |
987 |
clmsg( id, msg )*/ |
clmsg( id, msg )*/ |
988 |
|
|
998 |
else |
else |
999 |
{ |
{ |
1000 |
clmsg(id,"You have no previous checkpoints remaining.") |
clmsg(id,"You have no previous checkpoints remaining.") |
1001 |
timer[id-1][TMR_CPPOS]-- |
timer[id][TMR_CPPOS]-- |
1002 |
} |
} |
1003 |
} |
} |
1004 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
1007 |
//Cycle forward through CPs |
//Cycle forward through CPs |
1008 |
public cp_forward( id ) |
public cp_forward( id ) |
1009 |
{ |
{ |
1010 |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id-1][TS_CPGC] && timer[id-1][TMR_CPPOS] > 0 ) |
if( get_pcvar_num( p_climb ) && isalive( id ) && notpaused( id ) && !time_stamps[id][TS_CPGC] && timer[id][TMR_CPPOS] > 0 ) |
1011 |
{ |
{ |
1012 |
timer[id-1][TMR_CPPOS]-- |
timer[id][TMR_CPPOS]-- |
1013 |
new cppos = timer[id-1][TMR_CPPOS] * 4 |
new cppos = timer[id][TMR_CPPOS] * 4 |
1014 |
|
|
1015 |
new Float:coords[3] |
new Float:coords[3] |
1016 |
for( new i=0; i<3; i++ ) coords[i] = origins[id-1][cppos + i] |
for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i] |
1017 |
entity_set_float( id, EV_FL_gravity, origins[id-1][cppos + ORIG_GRAV] ) |
entity_set_float( id, EV_FL_gravity, origins[id][cppos + ORIG_GRAV] ) |
1018 |
teleport( id, coords ) |
teleport( id, coords ) |
1019 |
|
|
1020 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) timer[id-1][TMR_CNTGCS]++ |
if( timer[id][TMR_CFLAGS] & CF_START ) timer[id][TMR_CNTGCS]++ |
1021 |
|
|
1022 |
set_cpgc_timeout( id ) |
set_cpgc_timeout( id ) |
1023 |
} |
} |
1028 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
1029 |
public change_status( id, newstat ) |
public change_status( id, newstat ) |
1030 |
{ |
{ |
1031 |
new cflags_old = timer[id-1][TMR_CFLAGS] |
new cflags_old = timer[id][TMR_CFLAGS] |
1032 |
new cflags_new = cflags_old & ~CF_STATUSFLAGS |
new cflags_new = cflags_old & ~CF_STATUSFLAGS |
1033 |
|
|
1034 |
if( newstat & CF_PAUSE ) |
if( newstat & CF_PAUSE ) |
1036 |
if( cflags_old & CF_PAUSE ) //unpause |
if( cflags_old & CF_PAUSE ) //unpause |
1037 |
{ |
{ |
1038 |
cflags_new += CF_START |
cflags_new += CF_START |
|
timer[id-1][TMR_STARTD] = get_systime() - timer[id-1][TMR_STARTD] |
|
1039 |
set_entity_flags( id, FL_FROZEN, 0 ) |
set_entity_flags( id, FL_FROZEN, 0 ) |
1040 |
unsolid( id ) |
unsolid( id ) |
1041 |
entity_set_float( id, EV_FL_gravity, origins[id-1][ORIG_PAUS + ORIG_GRAV] ) |
entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] ) |
1042 |
clmsg( id, "UNPAUSED" ) |
clmsg( id, "UNPAUSED" ) |
1043 |
sfexec( id, 2 ) |
sfexec( id, 2 ) |
1044 |
} |
} |
1045 |
else if( cflags_old & CF_START ) //pause |
else if( cflags_old & CF_START ) //pause |
1046 |
{ |
{ |
|
timer[id-1][TMR_STARTD] = get_systime() - timer[id-1][TMR_STARTD] |
|
1047 |
cl_pause( id ) |
cl_pause( id ) |
1048 |
cflags_new += CF_PAUSE |
cflags_new += CF_PAUSE |
1049 |
} |
} |
1054 |
} |
} |
1055 |
} |
} |
1056 |
else cflags_new += newstat |
else cflags_new += newstat |
1057 |
timer[id-1][TMR_CFLAGS] = cflags_new |
timer[id][TMR_CFLAGS] = cflags_new |
1058 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
1059 |
} |
} |
1060 |
|
|
1070 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
1071 |
} |
} |
1072 |
|
|
1073 |
|
public timer_tick( ) |
1074 |
|
{ |
1075 |
|
new players[32], num, id |
1076 |
|
get_players( players, num, "ach" ) |
1077 |
|
|
1078 |
|
for( new i = 0; i < num; i++ ) |
1079 |
|
{ |
1080 |
|
id = players[i] |
1081 |
|
if( timer[id][TMR_CFLAGS] & CF_START ) |
1082 |
|
timer[id][TMR_CNTTME]++ |
1083 |
|
} |
1084 |
|
} |
1085 |
|
|
1086 |
public stop( id ) |
public stop( id ) |
1087 |
{ |
{ |
1088 |
if( get_pcvar_num( p_climb ) && timer[id-1][TMR_CFLAGS] & CF_START ) |
if( get_pcvar_num( p_climb ) && timer[id][TMR_CFLAGS] & CF_START ) |
1089 |
{ |
{ |
1090 |
change_status( id, CF_STOP ) |
change_status( id, CF_STOP ) |
1091 |
heal(id) |
heal(id) |
1092 |
//Erase start/finish time stamps, prevents crazy number on scoreboard |
//Erase start/finish time stamps, prevents crazy number on scoreboard |
1093 |
timer[id-1][TMR_STARTD]=0 |
timer[id][TMR_CNTTME] = 0 |
|
timer[id-1][TMR_FINISH]=0 |
|
1094 |
|
|
1095 |
sfexec(id,4) //Execute commands from start/finish config |
sfexec(id,4) //Execute commands from start/finish config |
1096 |
} |
} |
1106 |
wpn = get_user_weapon( id, clip, ammo ) |
wpn = get_user_weapon( id, clip, ammo ) |
1107 |
if( wpn == CSW_KNIFE ) |
if( wpn == CSW_KNIFE ) |
1108 |
{ |
{ |
1109 |
new remain = check_timeout( 0, time_stamps[id-1][TS_KNIFE], KNIFE_TIMEOUT, _, 1 ) |
new remain = check_timeout( 0, time_stamps[id][TS_KNIFE], KNIFE_TIMEOUT, _, 1 ) |
1110 |
if( remain ) |
if( remain ) |
1111 |
{ |
{ |
1112 |
set_cd(cd_handle, CD_flNextAttack, halflife_time() + remain ) |
set_cd(cd_handle, CD_flNextAttack, halflife_time() + remain ) |
1124 |
if( !get_pcvar_num( p_climb ) || !( 0 < wpn <= 30 ) ) |
if( !get_pcvar_num( p_climb ) || !( 0 < wpn <= 30 ) ) |
1125 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1126 |
|
|
1127 |
static client_oldwpn[32] |
static client_oldwpn[33] |
1128 |
if( wpn != client_oldwpn[id-1] ) |
if( wpn != client_oldwpn[id] ) |
1129 |
rank_mod_update( id ) |
rank_mod_update( id ) |
1130 |
|
|
1131 |
client_oldwpn[id-1] = wpn |
client_oldwpn[id] = wpn |
1132 |
|
|
1133 |
|
if( wpn == CSW_C4 || |
1134 |
|
wpn == CSW_HEGRENADE || |
1135 |
|
wpn == CSW_FLASHBANG || |
1136 |
|
wpn == CSW_SMOKEGRENADE || |
1137 |
|
wpn == CSW_KNIFE |
1138 |
|
) return PLUGIN_CONTINUE |
1139 |
|
|
1140 |
//If it's a gun, update pack and clip ammo & silencer |
//If it's a gun, update pack and clip ammo & silencer |
1141 |
if( strlen( WPN_CLASS[wpn-1] ) ) |
new wpn_name[17] |
1142 |
{ |
get_weaponname( wpn, wpn_name,16 ) |
1143 |
new wpn_id = find_ent_by_owner( -1, WPN_CLASS[wpn-1], id ) |
new wpn_id = find_ent_by_owner( -1, wpn_name, id ) |
1144 |
if( !wpn_id ) return PLUGIN_CONTINUE |
if( !wpn_id ) return PLUGIN_CONTINUE |
1145 |
|
|
1146 |
new clip = get_msg_arg_int( 3 ) |
new clip = get_msg_arg_int( 3 ) |
1169 |
set_msg_arg_int( 3, ARG_BYTE, maxammo ) |
set_msg_arg_int( 3, ARG_BYTE, maxammo ) |
1170 |
cs_set_weapon_ammo( wpn_id, maxammo ) |
cs_set_weapon_ammo( wpn_id, maxammo ) |
1171 |
} |
} |
|
} |
|
1172 |
|
|
1173 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1174 |
} |
} |
1196 |
rank = 7 |
rank = 7 |
1197 |
} |
} |
1198 |
|
|
1199 |
if( rank > timer[id-1][TMR_CNTWPN] ) |
if( rank > timer[id][TMR_CNTWPN] ) |
1200 |
timer[id-1][TMR_CNTWPN] = rank |
timer[id][TMR_CNTWPN] = rank |
1201 |
|
|
1202 |
new msg[100] |
new msg[100] |
1203 |
format( msg, 99, "Weapon Max Speed: %d^nRank Modifier: %d", maxspeed, rank ) |
format( msg, 99, "Weapon Max Speed: %d^nRank Modifier: %d", maxspeed, rank ) |
1229 |
formatex( ret_name, len, name ) |
formatex( ret_name, len, name ) |
1230 |
} |
} |
1231 |
|
|
|
public bot_msg_block(msg_id,msg_dest,id) |
|
|
{ |
|
|
if(get_pcvar_num(p_climb)&&is_user_bot(id))return PLUGIN_HANDLED |
|
|
return PLUGIN_CONTINUE |
|
|
} |
|
|
|
|
1232 |
public DeathMsg( ) |
public DeathMsg( ) |
1233 |
{//Respawn client when they die unless switching to spec |
{//Respawn client when they die unless switching to spec |
1234 |
if( get_pcvar_num( p_climb ) ) |
if( get_pcvar_num( p_climb ) ) |
1258 |
{ |
{ |
1259 |
stop(id) |
stop(id) |
1260 |
if( is_climber_alive( id ) ) teleport( id, spawn_tp_orig ) |
if( is_climber_alive( id ) ) teleport( id, spawn_tp_orig ) |
1261 |
else if( !check_timeout( id, time_stamps[id-1][TS_SPAWN], SPAWN_TIMEOUT ) ) |
else if( !check_timeout( id, time_stamps[id][TS_SPAWN], SPAWN_TIMEOUT ) ) |
1262 |
{ |
{ |
1263 |
//if( get_user_team ( id ) == 3 ) cs_set_user_team( id, 2 ) |
//if( get_user_team ( id ) == 3 ) cs_set_user_team( id, 2 ) |
1264 |
//cs_user_spawn( id ) |
//cs_user_spawn( id ) |
1317 |
sfexec( id, 1 )//Execute commands from start/finish config |
sfexec( id, 1 )//Execute commands from start/finish config |
1318 |
if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard. |
if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard. |
1319 |
|
|
1320 |
if( timer[id-1][TMR_CFLAGS] & CF_PAUSE ) |
if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
1321 |
{//If they are paused tp to pause spot and freeze them again. |
{//If they are paused tp to pause spot and freeze them again. |
1322 |
new Float:coords[3] |
new Float:coords[3] |
1323 |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
1451 |
return dif |
return dif |
1452 |
} |
} |
1453 |
|
|
1454 |
public change_boost( id, newboost ) |
stock change_boost( id, newboost, silent = 0 ) |
1455 |
{//Change Boost flags |
{//Change Boost flags |
1456 |
if( !( cvar_enabled( id, p_boost ) && isalive( id ) ) && notpaused( id ) ) return PLUGIN_HANDLED |
if( !( cvar_enabled( id, p_boost, silent ) && isalive( id ) ) && notpaused( id ) ) return PLUGIN_HANDLED |
1457 |
|
|
1458 |
new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ] |
new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ] |
1459 |
if( cflags & CF_SOLID ) |
if( cflags & CF_SOLID ) |
1474 |
} |
} |
1475 |
if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag |
if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag |
1476 |
if( !( rmflag & newboost ) && \ |
if( !( rmflag & newboost ) && \ |
1477 |
!check_timeout( id, time_stamps[id-1][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? get_climber_time( id ) : get_systime() ) ) ) |
!check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) ) |
1478 |
{ |
{ |
1479 |
if( newboost == CF_SOLID ) |
if( newboost == CF_SOLID ) |
1480 |
{ |
{ |
1508 |
for( i = 0; i < num; i++ ) |
for( i = 0; i < num; i++ ) |
1509 |
{ |
{ |
1510 |
id_i = players[i] |
id_i = players[i] |
1511 |
cflags_i = timer[id_i-1][TMR_CFLAGS] |
cflags_i = timer[id_i][TMR_CFLAGS] |
1512 |
|
|
1513 |
if( !( cflags_i & CF_PAUSE ) ) |
if( !( cflags_i & CF_PAUSE ) ) |
1514 |
{ |
{ |
1528 |
if( i != j ) |
if( i != j ) |
1529 |
{ |
{ |
1530 |
id_j = players[j] |
id_j = players[j] |
1531 |
cflags_j = timer[id_j-1][TMR_CFLAGS] |
cflags_j = timer[id_j][TMR_CFLAGS] |
1532 |
|
|
1533 |
if( ( !( cflags_i & CF_SOLID && cflags_j & CF_SOLID ) || skip[i] ) && !( cflags_j & CF_PAUSE ) ) |
if( ( !( cflags_i & CF_SOLID && cflags_j & CF_SOLID ) || skip[i] ) && !( cflags_j & CF_PAUSE ) ) |
1534 |
{ |
{ |
1569 |
//new Float:c1d[3],Float:c2d[3],xyadd,zadd |
//new Float:c1d[3],Float:c2d[3],xyadd,zadd |
1570 |
for(i=0;i<num;i++){ |
for(i=0;i<num;i++){ |
1571 |
id_i=players[i] |
id_i=players[i] |
1572 |
cflags_i=timer[id_i-1][TMR_CFLAGS] |
cflags_i=timer[id_i][TMR_CFLAGS] |
1573 |
if(!(cflags_i&CF_PAUSE)){ |
if(!(cflags_i&CF_PAUSE)){ |
1574 |
//solid(players[i]) |
//solid(players[i]) |
1575 |
entity_get_vector(id_i,EV_VEC_origin,c1) |
entity_get_vector(id_i,EV_VEC_origin,c1) |
1578 |
c1[2]=0.0 |
c1[2]=0.0 |
1579 |
for(j=0;j<num;j++){ |
for(j=0;j<num;j++){ |
1580 |
id_j=players[j] |
id_j=players[j] |
1581 |
cflags_j=timer[id_j-1][TMR_CFLAGS] |
cflags_j=timer[id_j][TMR_CFLAGS] |
1582 |
if(!(cflags_j&CF_SOLID)&&i!=j){ |
if(!(cflags_j&CF_SOLID)&&i!=j){ |
1583 |
entity_get_vector(id_j,EV_VEC_origin,c2) |
entity_get_vector(id_j,EV_VEC_origin,c2) |
1584 |
//entity_get_vector(players[j],EV_VEC_velocity,c2d) |
//entity_get_vector(players[j],EV_VEC_velocity,c2d) |
1621 |
if( !get_pcvar_num( p_climb ) || is_user_bot( id ) || !is_climber_alive( id ) ) |
if( !get_pcvar_num( p_climb ) || is_user_bot( id ) || !is_climber_alive( id ) ) |
1622 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1623 |
|
|
1624 |
if( sclip[id-1] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX ) |
if( sclip[id] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX ) |
1625 |
|
|
1626 |
//Detect button use. Replicated from HL SDK |
//Detect button use. Replicated from HL SDK |
1627 |
if( get_user_button( id ) & IN_USE && !( get_user_oldbutton( id ) & IN_USE ) ) |
if( get_user_button( id ) & IN_USE && !( get_user_oldbutton( id ) & IN_USE ) ) |
1639 |
} |
} |
1640 |
} |
} |
1641 |
|
|
1642 |
new cflags = timer[id-1][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
1643 |
|
|
1644 |
//Double and super jump boosts |
//Double and super jump boosts |
1645 |
if( get_pcvar_num( p_boost ) ) |
if( get_pcvar_num( p_boost ) ) |
1650 |
{ |
{ |
1651 |
if( cflags & CF_SUPER_JUMP && onground ) |
if( cflags & CF_SUPER_JUMP && onground ) |
1652 |
{ |
{ |
1653 |
entity_get_vector( id, EV_VEC_velocity, post_think_vel[id-1] ) |
entity_get_vector( id, EV_VEC_velocity, post_think_vel[id] ) |
1654 |
if( post_think_vel[id-1][0] != 0.0 || post_think_vel[id-1][1] != 0.0) |
if( post_think_vel[id][0] != 0.0 || post_think_vel[id][1] != 0.0) |
1655 |
{ |
{ |
1656 |
velocity_by_aim( id, 400, post_think_vel[id-1] ) |
velocity_by_aim( id, 400, post_think_vel[id] ) |
1657 |
if( post_think_vel[id-1][2] < 250.0) post_think_vel[id-1][2] = 250.0 |
if( post_think_vel[id][2] < 250.0) post_think_vel[id][2] = 250.0 |
1658 |
if( post_think_vel[id-1][2] > 350.0) post_think_vel[id-1][2] = 350.0 |
if( post_think_vel[id][2] > 350.0) post_think_vel[id][2] = 350.0 |
1659 |
} |
} |
1660 |
else post_think_vel[id-1] = Float:{0.0,0.0,0.0} |
else post_think_vel[id] = Float:{0.0,0.0,0.0} |
1661 |
} |
} |
1662 |
else if( cflags & CF_DOUBLE_JUMP ) |
else if( cflags & CF_DOUBLE_JUMP ) |
1663 |
{ |
{ |
1664 |
if( !onground && !(get_user_oldbutton( id ) & IN_JUMP ) ) |
if( !onground && !(get_user_oldbutton( id ) & IN_JUMP ) ) |
1665 |
{ |
{ |
1666 |
entity_get_vector( id, EV_VEC_velocity, post_think_vel[id-1] ) |
entity_get_vector( id, EV_VEC_velocity, post_think_vel[id] ) |
1667 |
float_clamp( post_think_vel[id-1][0], -150.0, 150.0 ) |
float_clamp( post_think_vel[id][0], -150.0, 150.0 ) |
1668 |
float_clamp( post_think_vel[id-1][1], -150.0, 150.0 ) |
float_clamp( post_think_vel[id][1], -150.0, 150.0 ) |
1669 |
if( is_finished( id ) || post_think_vel[id-1][2] > -500 ) post_think_vel[id-1][2] = 250.0 |
if( is_finished( id ) || post_think_vel[id][2] > -500 ) post_think_vel[id][2] = 250.0 |
1670 |
else post_think_vel[id-1] = Float:{ 0.0, 0.0, 0.0 } |
else post_think_vel[id] = Float:{ 0.0, 0.0, 0.0 } |
1671 |
} |
} |
1672 |
} |
} |
1673 |
} |
} |
1695 |
{ |
{ |
1696 |
|
|
1697 |
if( button & IN_ATTACK || button & IN_ATTACK2 ) |
if( button & IN_ATTACK || button & IN_ATTACK2 ) |
1698 |
if( check_timeout( 0, time_stamps[id-1][TS_KNIFE], KNIFE_TIMEOUT ) ) |
if( check_timeout( 0, time_stamps[id][TS_KNIFE], KNIFE_TIMEOUT ) ) |
1699 |
set_pev( id, pev_button, pev( id, pev_button ) & ~IN_ATTACK_EITHER ) |
set_pev( id, pev_button, pev( id, pev_button ) & ~IN_ATTACK_EITHER ) |
1700 |
} |
} |
1701 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1706 |
if( !( get_pcvar_num(p_climb) && get_pcvar_num(p_boost) && is_climber_alive( id ) ) || is_user_bot(id) ) |
if( !( get_pcvar_num(p_climb) && get_pcvar_num(p_boost) && is_climber_alive( id ) ) || is_user_bot(id) ) |
1707 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1708 |
|
|
1709 |
if( sclip[id-1] ) entity_set_int( id, EV_INT_solid, SOLID_NOT ) |
if( sclip[id] ) entity_set_int( id, EV_INT_solid, SOLID_NOT ) |
1710 |
|
|
1711 |
if( _:get_distance( _:post_think_vel[id-1], { 0, 0, 0 } ) ) |
if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) ) |
1712 |
{ |
{ |
1713 |
entity_set_vector( id, EV_VEC_velocity, post_think_vel[id-1] ) |
entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] ) |
1714 |
post_think_vel[id-1] = Float:{ 0.0, 0.0, 0.0 } |
post_think_vel[id] = Float:{ 0.0, 0.0, 0.0 } |
1715 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) |
if( timer[id][TMR_CFLAGS] & CF_START ) |
1716 |
{ |
{ |
1717 |
timer[id-1][TMR_CNTBST]++ //Increment client boost count |
timer[id][TMR_CNTBST]++ //Increment client boost count |
1718 |
change_boost( id, CF_NULL ) |
change_boost( id, CF_NULL ) |
1719 |
} |
} |
1720 |
else if( !is_finished(id) )change_boost( id, CF_NULL ) |
else if( !is_finished(id) )change_boost( id, CF_NULL ) |
1721 |
} |
} |
1722 |
|
|
1723 |
//Store pause data |
//Store pause data |
1724 |
if( !( timer[id-1][TMR_CFLAGS] & CF_PAUSE ) ) |
if( !( timer[id][TMR_CFLAGS] & CF_PAUSE ) ) |
1725 |
{ |
{ |
1726 |
new Float:coords[3] |
new Float:coords[3] |
1727 |
entity_get_vector( id, EV_VEC_origin, coords ) |
entity_get_vector( id, EV_VEC_origin, coords ) |
1728 |
for( new i=0; i<3; i++ ) origins[id-1][ORIG_PAUS+i] = coords[i] |
for( new i=0; i<3; i++ ) origins[id][ORIG_PAUS+i] = coords[i] |
1729 |
origins[id-1][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity ) |
origins[id][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity ) |
1730 |
} |
} |
1731 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1732 |
} |
} |
1750 |
} |
} |
1751 |
} |
} |
1752 |
|
|
1753 |
//new cflags = timer[id-1][TMR_CFLAGS] |
//new cflags = timer[id][TMR_CFLAGS] |
1754 |
|
|
1755 |
if( btn_type == 1 )//Start Button |
if( btn_type == 1 )//Start Button |
1756 |
{ |
{ |
1757 |
new Float:orig[3], bool:need_respawn = true //Float:view[3] |
new Float:orig[3], bool:need_respawn = true //Float:view[3] |
1758 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) need_respawn = false |
if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false |
1759 |
|
|
1760 |
for( new i = 0; i < 48; i++ ) origins[id-1][i] = 0.0 //Erase checkpoints |
for( new i = 0; i < 48; i++ ) origins[id][i] = 0.0 //Erase checkpoints |
1761 |
|
|
1762 |
//Set all associated variables |
//Set all associated variables |
1763 |
timer[id-1][TMR_STARTD] = get_systime() |
timer[id][TMR_CNTTME] = 0 |
1764 |
|
timer[id][TMR_CNTCPS] = 0 |
1765 |
|
timer[id][TMR_CNTGCS] = 0 |
1766 |
|
timer[id][TMR_CNTBST] = 0 |
1767 |
|
timer[id][TMR_CPPOS] = 0 |
1768 |
|
timer[id][TMR_CNTWPN] = 0 |
1769 |
|
time_stamps[id][TS_BOOST] = BOOST_TIMEOUT |
1770 |
change_status(id,CF_START) |
change_status(id,CF_START) |
|
timer[id-1][TMR_CNTCPS] = 0 |
|
|
timer[id-1][TMR_CNTGCS] = 0 |
|
|
timer[id-1][TMR_CNTBST] = 0 |
|
|
timer[id-1][TMR_CPPOS] = 0 |
|
|
timer[id-1][TMR_CNTWPN] = 0 |
|
|
time_stamps[id-1][TS_BOOST] = BOOST_TIMEOUT |
|
1771 |
|
|
1772 |
if( timer[id-1][TMR_CFLAGS] & CF_COUNTDOWN ) set_countdown_time( id ) |
if( timer[id][TMR_CFLAGS] & CF_COUNTDOWN ) set_countdown_time( id ) |
1773 |
|
|
1774 |
//Record starting weapon |
//Record starting weapon |
1775 |
rank_mod_update( id ) |
rank_mod_update( id ) |
1783 |
entity_set_vector( id, EV_VEC_origin, orig ) |
entity_set_vector( id, EV_VEC_origin, orig ) |
1784 |
//entity_set_vector( id, EV_VEC_angles, view ) |
//entity_set_vector( id, EV_VEC_angles, view ) |
1785 |
delay_duck( id ) |
delay_duck( id ) |
1786 |
//time_stamps[id-1][TS_SPAWN]=get_systime() |
//time_stamps[id][TS_SPAWN]=get_systime() |
1787 |
} |
} |
1788 |
heal( id ) |
heal( id ) |
1789 |
cs_set_user_money( id, get_pcvar_num( p_startmoney ) ) |
cs_set_user_money( id, get_pcvar_num( p_startmoney ) ) |
1796 |
case 2:client_cmd( id, "spk barney/c1a2_ba_climb" ) |
case 2:client_cmd( id, "spk barney/c1a2_ba_climb" ) |
1797 |
} |
} |
1798 |
|
|
1799 |
change_boost( id, CF_NULL ) //Disable Boosts |
change_boost( id, CF_NULL, SILENT ) //Disable Boosts |
1800 |
//time_stamps[id-1][TS_BOOST]=0 |
//time_stamps[id][TS_BOOST]=0 |
1801 |
clmsg(id,"Timer started. Go Go Go!!!") |
clmsg(id,"Timer started. Go Go Go!!!") |
1802 |
//client_print(id,print_chat,"Timer started. Go Go Go!!!") |
//client_print(id,print_chat,"Timer started. Go Go Go!!!") |
1803 |
|
|
1807 |
} |
} |
1808 |
else if( btn_type == 2 )//Finish Button |
else if( btn_type == 2 )//Finish Button |
1809 |
{ |
{ |
1810 |
if( timer[id-1][TMR_CFLAGS] & CF_START) |
if( timer[id][TMR_CFLAGS] & CF_START ) |
1811 |
{ |
{ |
1812 |
|
new cnttme = timer[id][TMR_CNTTME] / 10 |
1813 |
|
new cntbst = timer[id][TMR_CNTBST] |
1814 |
|
new cntcps = timer[id][TMR_CNTCPS] |
1815 |
|
new cntgcs = timer[id][TMR_CNTGCS] |
1816 |
|
new cntwpn = timer[id][TMR_CNTWPN] |
1817 |
|
|
1818 |
//Set client variables |
//Set client variables |
|
timer[id-1][TMR_FINISH] = get_systime( ) |
|
1819 |
change_status( id, CF_STOP ) |
change_status( id, CF_STOP ) |
1820 |
timer[id-1][TMR_SESFIN]++ |
timer[id][TMR_SESFIN]++ |
1821 |
timer[id-1][TMR_MAPFIN]++ |
timer[id][TMR_MAPFIN]++ |
1822 |
|
|
1823 |
//Announce to client |
//Announce to client |
1824 |
if( get_pcvar_num( p_sounds ) ) client_cmd( 0, "spk woop" ) |
if( get_pcvar_num( p_sounds ) ) client_cmd( 0, "spk woop" ) |
1825 |
clmsg( id, "Congratulations 1337 climber." ) |
clmsg( id, "Congratulations 1337 climber." ) |
1826 |
//client_print(id,print_chat,"Congratulations 1337 climber.") |
//client_print(id,print_chat,"Congratulations 1337 climber.") |
1827 |
new name[32], msg[21] |
new name[32], msg[23] |
1828 |
formatex( msg, sizeof( msg ) - 1, "%s^t%s", getuserstatus( id ), parsetime( get_climber_time( id ) ) ) |
formatex( msg, 22, "%s^t%s", getuserstatus( id ), parsetime( timer[id][TMR_CNTTME] ) ) |
1829 |
//clmsg(id,msg) |
//clmsg(id,msg) |
1830 |
//client_print(id,print_chat,msg) |
//client_print(id,print_chat,msg) |
1831 |
|
|
1832 |
new wpn[11] |
new wpn[11] |
1833 |
get_weapon_name( timer[id-1][TMR_CNTWPN], wpn, 10 ) |
get_weapon_name( cntwpn, wpn, 10 ) |
1834 |
|
|
1835 |
//Announce to all |
//Announce to all |
1836 |
get_user_name( id, name, 32 ) |
get_user_name( id, name, 32 ) |
1837 |
client_print( 0, print_chat, "%s^t%s^t(%s/ %d CPS/ %d GCS/ %d Boosts)^tCompleted (%d, %d)", |
client_print( 0, print_chat, |
1838 |
name, msg, |
"%s^t%s^t(%s/ %d CPS/ %d GCS/ %d Boosts)^tCompleted (%d, %d)", |
1839 |
wpn, timer[id-1][TMR_CNTCPS], timer[id-1][TMR_CNTGCS], timer[id-1][TMR_CNTBST], |
name, msg, wpn, cntcps, cntgcs, cntbst, |
1840 |
timer[id-1][TMR_SESFIN], timer[id-1][TMR_MAPFIN] ) |
timer[id][TMR_SESFIN], timer[id][TMR_MAPFIN] |
1841 |
|
) |
1842 |
new cnt_score = ( ( ( timer[id-1][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
1843 |
( ( timer[id-1][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
new cntscore = ( ( ( cntbst > 0 ? 1 : 0 ) * 1000000 ) + |
1844 |
( timer[id-1][TMR_CNTWPN] * 10000 ) + |
( ( cntcps > 0 ? 1 : 0 ) * 100000 ) + |
1845 |
get_climber_time( id ) ) |
( cntwpn * 10000 ) + |
1846 |
|
cnttme ) |
1847 |
new bst_score = ( ( ( timer[id-1][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
1848 |
( ( timer[id-1][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
new bstscore = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
1849 |
( timer[id-1][TMR_BSTWPN] * 10000 ) + |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
1850 |
timer[id-1][TMR_BSTTME] ) |
( timer[id][TMR_BSTWPN] * 10000 ) + |
1851 |
|
timer[id][TMR_BSTTME] / 10 ) |
1852 |
if( cnt_score < bst_score || bst_score == 0 ) |
|
1853 |
{ |
if( cntscore < bstscore || bstscore == 0 ) |
1854 |
timer[id-1][TMR_BSTTME] = get_climber_time( id ) |
{ |
1855 |
timer[id-1][TMR_BSTCPS] = timer[id-1][TMR_CNTCPS] |
timer[id][TMR_BSTTME] = cnttme |
1856 |
timer[id-1][TMR_BSTGCS] = timer[id-1][TMR_CNTGCS] |
timer[id][TMR_BSTCPS] = cntcps |
1857 |
timer[id-1][TMR_BSTBST] = timer[id-1][TMR_CNTBST] |
timer[id][TMR_BSTGCS] = cntgcs |
1858 |
timer[id-1][TMR_BSTWPN] = timer[id-1][TMR_CNTWPN] |
timer[id][TMR_BSTBST] = cntbst |
1859 |
|
timer[id][TMR_BSTWPN] = cntwpn |
1860 |
} |
} |
1861 |
|
|
1862 |
sfexec( id, 2 )//Execute commands from start/finish config |
sfexec( id, 2 )//Execute commands from start/finish config |
1865 |
|
|
1866 |
sortcssb( ) //Update frags to reorder scoreboard |
sortcssb( ) //Update frags to reorder scoreboard |
1867 |
} |
} |
1868 |
else if(timer[id-1][TMR_CFLAGS]&CF_STOP&&timer[id-1][TMR_SESFIN]==0){ |
else if(timer[id][TMR_CFLAGS]&CF_STOP&&timer[id][TMR_SESFIN]==0){ |
1869 |
//change_status(id,CF_FINISH) |
//change_status(id,CF_FINISH) |
1870 |
timer[id-1][TMR_SESFIN]++ |
timer[id][TMR_SESFIN]++ |
1871 |
new msg[100]="Congratulations, you finished! But you didn't start the timer. :(" |
new msg[100]="Congratulations, you finished! But you didn't start the timer. :(" |
1872 |
clmsg(id,msg) |
clmsg(id,msg) |
1873 |
client_print(id,print_chat,msg) |
client_print(id,print_chat,msg) |
1883 |
|
|
1884 |
//Execute commands from start/finish config |
//Execute commands from start/finish config |
1885 |
public sfexec(id,clevent){ |
public sfexec(id,clevent){ |
1886 |
new clstat[3],cflags=timer[id-1][TMR_CFLAGS] |
new clstat[3],cflags=timer[id][TMR_CFLAGS] |
1887 |
/*switch(timer[id-1][TMR_CFLAGS]){ |
/*switch(timer[id][TMR_CFLAGS]){ |
1888 |
case TMR_CFLAGS_STOP: clstat="ns" |
case TMR_CFLAGS_STOP: clstat="ns" |
1889 |
case TMR_CFLAGS_STRT: clstat="st" |
case TMR_CFLAGS_STRT: clstat="st" |
1890 |
case TMR_CFLAGS_FNSH: clstat="fn" |
case TMR_CFLAGS_FNSH: clstat="fn" |
1892 |
if(is_finished(id))clstat="fn" |
if(is_finished(id))clstat="fn" |
1893 |
else if(cflags&CF_STOP)clstat="ns" |
else if(cflags&CF_STOP)clstat="ns" |
1894 |
else if(cflags&CF_START)clstat="st" |
else if(cflags&CF_START)clstat="st" |
1895 |
//else if(timer[id-1][TMR_CFLAGS]&CF_FINISH)clstat="fn" |
//else if(timer[id][TMR_CFLAGS]&CF_FINISH)clstat="fn" |
1896 |
//if(equal(clstat,"ns")&&(get_user_flags(id)&VIP||timer[id-1][TMR_SESFIN]>0))clstat="fn" |
//if(equal(clstat,"ns")&&(get_user_flags(id)&VIP||timer[id][TMR_SESFIN]>0))clstat="fn" |
1897 |
|
|
1898 |
for(new i=0;i<sfcount;i++){ |
for(new i=0;i<sfcount;i++){ |
1899 |
new cmdstat[3],cmdevent[2],cmdtype[3],cmd[60],idtype[5] |
new cmdstat[3],cmdevent[2],cmdtype[3],cmd[60],idtype[5] |
1953 |
id = players[i] |
id = players[i] |
1954 |
pdata[i][2] = id |
pdata[i][2] = id |
1955 |
|
|
1956 |
if( timer[id-1][TMR_BSTTME] ) |
if( timer[id][TMR_BSTTME] ) |
1957 |
{//Has high score |
{//Has high score |
1958 |
pdata[i][0] = 0 |
pdata[i][0] = 0 |
1959 |
pdata[i][1] = ( ( ( timer[id-1][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
pdata[i][1] = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
1960 |
( ( timer[id-1][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
1961 |
( timer[id-1][TMR_BSTWPN] * 10000 ) + |
( timer[id][TMR_BSTWPN] * 10000 ) + |
1962 |
timer[id-1][TMR_BSTTME] ) |
timer[id][TMR_BSTTME] / 10 ) |
1963 |
} |
} |
1964 |
else if( timer[id-1][TMR_CFLAGS] & CF_START || timer[id-1][TMR_CFLAGS] & CF_PAUSE ) |
else if( timer[id][TMR_CFLAGS] & CF_START || timer[id][TMR_CFLAGS] & CF_PAUSE ) |
1965 |
{//Has time but no high score |
{//Has time but no high score |
1966 |
pdata[i][0] = 1 |
pdata[i][0] = 1 |
1967 |
pdata[i][1] = ( ( ( timer[id-1][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
pdata[i][1] = ( ( ( timer[id][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
1968 |
( ( timer[id-1][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
( ( timer[id][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
1969 |
( timer[id-1][TMR_CNTWPN] * 10000 ) + |
( timer[id][TMR_CNTWPN] * 10000 ) + |
1970 |
get_climber_time( id ) ) |
timer[id][TMR_CNTTME] / 10 ) |
1971 |
} |
} |
1972 |
else pdata[i][0] = 2 //No time or high score |
else pdata[i][0] = 2 //No time or high score |
1973 |
} |
} |
2013 |
|
|
2014 |
public climbscores( id ) |
public climbscores( id ) |
2015 |
{//Show scoreboard |
{//Show scoreboard |
2016 |
if( get_pcvar_num( p_climb ) ) |
if( !get_pcvar_num( p_climb ) ) return PLUGIN_HANDLED |
2017 |
{ |
|
2018 |
if( get_systime() - ts_score > 2 ) |
if( get_systime() - ts_score > 2 ) |
2019 |
{ |
{ |
2020 |
new fh = fopen( SCORES_PATH, "w" ) |
new fh = fopen( SCORES_PATH, "w" ) |
2031 |
|
|
2032 |
get_players_ordered( players, num ) |
get_players_ordered( players, num ) |
2033 |
|
|
2034 |
for(new i = 1; i <= num; i++ ) |
for( new i = 0; i < num; i++ ) |
2035 |
{ |
{ |
2036 |
tid = players[i-1] |
tid = players[i] |
2037 |
|
|
2038 |
get_user_name( tid, name, NAMELEN) |
get_user_name( tid, name, NAMELEN) |
2039 |
sb_add_tabs( name, NAMELEN+2 ) |
sb_add_tabs( name, NAMELEN+2 ) |
2040 |
|
|
2041 |
ctime = get_climber_time(tid) |
ctime = timer[tid][TMR_CNTTME] |
2042 |
cwpn = timer[tid-1][TMR_CNTWPN] |
cwpn = timer[tid][TMR_CNTWPN] |
2043 |
ccp = timer[tid-1][TMR_CNTCPS] |
ccp = timer[tid][TMR_CNTCPS] |
2044 |
cgc = timer[tid-1][TMR_CNTGCS] |
cgc = timer[tid][TMR_CNTGCS] |
2045 |
cbst = timer[tid-1][TMR_CNTBST] |
cbst = timer[tid][TMR_CNTBST] |
2046 |
format( ctime_str, 19, "%d/%d/%d/%d", cwpn, ccp, cgc, cbst ) |
format( ctime_str, 19, "%d/%d/%d/%d", cwpn, ccp, cgc, cbst ) |
2047 |
sb_add_tabs( ctime_str, 19 ) |
sb_add_tabs( ctime_str, 19 ) |
2048 |
|
|
2049 |
btime = timer[tid-1][TMR_BSTTME] |
btime = timer[tid][TMR_BSTTME] |
2050 |
bwpn = timer[tid-1][TMR_BSTWPN] |
bwpn = timer[tid][TMR_BSTWPN] |
2051 |
bcp = timer[tid-1][TMR_BSTCPS] |
bcp = timer[tid][TMR_BSTCPS] |
2052 |
bgc = timer[tid-1][TMR_BSTGCS] |
bgc = timer[tid][TMR_BSTGCS] |
2053 |
bbst = timer[tid-1][TMR_BSTBST] |
bbst = timer[tid][TMR_BSTBST] |
2054 |
format( btime_str, 19, "%d/%d/%d/%d", bwpn, bcp, bgc, bbst ) |
format( btime_str, 19, "%d/%d/%d/%d", bwpn, bcp, bgc, bbst ) |
2055 |
sb_add_tabs( btime_str, 19 ) |
sb_add_tabs( btime_str, 19 ) |
2056 |
|
|
2057 |
formatex( line, 250, |
formatex( line, 250, |
2058 |
"%s%d %s%s %s %s%s %s%d%s", |
"%s%d %s%s %s %s%s %s%d%s", |
2059 |
i % 2 ? "" : "<div>", |
i % 2 ? NULLSTR : "<div>", |
2060 |
i, htmlspecialchars( name ), |
i + 1, htmlspecialchars( name ), |
2061 |
getuserstatus( tid ), |
getuserstatus( tid ), |
2062 |
parsetime( ctime ), ctime_str, |
parsetime( ctime ), ctime_str, |
2063 |
parsetime( btime ), btime_str, |
parsetime( btime ), btime_str, |
2064 |
timer[tid-1][TMR_MAPFIN], |
timer[tid][TMR_MAPFIN], |
2065 |
i % 2 ? "" : "</div>" ) |
i % 2 ? NULLSTR : "</div>" ) |
2066 |
written_len += strlen( line ) |
written_len += strlen( line ) |
2067 |
//if( limit && written_len > ( 1263 - strlen( cust_msg ) ) ) break |
//if( limit && written_len > ( 1263 - strlen( cust_msg ) ) ) break |
2068 |
if( written_len > 1263 ) break |
if( written_len > 1263 ) break |
2079 |
} |
} |
2080 |
|
|
2081 |
show_motd( id, SCORES_PATH, "Current Scores" ) |
show_motd( id, SCORES_PATH, "Current Scores" ) |
2082 |
} |
|
2083 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
2084 |
} |
} |
2085 |
|
|
2086 |
public parsetime(sec){//Convert seconds to time string with zero padded seconds field |
//Convert seconds to time string with zero padded seconds field |
2087 |
new timestr[9],mins |
public parsetime( decisec ) |
2088 |
|
{ |
2089 |
|
new timestr[11], mins, sec, dec, decstr[3] |
2090 |
|
|
2091 |
|
sec = decisec / 10 |
2092 |
|
dec = decisec % 10 |
2093 |
mins=sec/60 |
mins=sec/60 |
2094 |
sec=sec%60 |
sec=sec%60 |
2095 |
formatex(timestr,8,"%d:%s%d",mins,sec<10?"0":"",sec) |
if( dec ) formatex( decstr, 2, ".%d", dec ) |
2096 |
|
formatex( timestr, 10, "%d:%s%d%s", mins, sec < 10 ? "0" : NULLSTR , sec, decstr ) |
2097 |
return timestr |
return timestr |
2098 |
} |
} |
2099 |
|
|
|
public get_climber_time( id ) |
|
|
{//Calculate client climb time in seconds |
|
|
/*new ptime,cflags=timer[id-1][TMR_CFLAGS] |
|
|
ptime=timer[id-1][TMR_FINISH]-timer[id-1][TMR_STARTD] |
|
|
if(cflags&CF_STOP&&timer[id=1][TMR_SESFIN]>0)ptime=timer[id-1][TMR_FINISH]-timer[id-1][TMR_STARTD] |
|
|
else if(cflags&CF_STOP)ptime=0 |
|
|
else if(cflags&CF_START)ptime=get_systime()-timer[id-1][TMR_STARTD] |
|
|
else if(cflags&CF_PAUSE)ptime=timer[id-1][TMR_STARTD]*/ |
|
|
new cflags = timer[id-1][TMR_CFLAGS] |
|
|
if( cflags & CF_START ) return get_systime()-timer[id-1][TMR_STARTD] |
|
|
else if( cflags & CF_PAUSE ) return timer[id-1][TMR_STARTD] |
|
|
return timer[id-1][TMR_FINISH]-timer[id-1][TMR_STARTD] |
|
|
} |
|
|
|
|
2100 |
public hudtime( ) |
public hudtime( ) |
2101 |
{//Set clock on HUD to current climb time |
{//Set clock on HUD to current climb time |
2102 |
if( !get_pcvar_num( p_climb ) ) return |
if( !get_pcvar_num( p_climb ) ) return |
2106 |
for( new i = 0; i < num; i++ ) |
for( new i = 0; i < num; i++ ) |
2107 |
{ |
{ |
2108 |
id = players[i] |
id = players[i] |
2109 |
cflags = timer[id-1][TMR_CFLAGS] |
cflags = timer[id][TMR_CFLAGS] |
2110 |
cltime = get_climber_time(id) + 1 |
cltime = timer[id][TMR_CNTTME] / 10 + 1 |
2111 |
if( cflags & CF_PAUSE ) |
if( cflags & CF_PAUSE ) |
2112 |
{ |
{ |
2113 |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
2114 |
cl_pause( id ) |
cl_pause( id ) |
2115 |
} |
} |
2116 |
|
|
2117 |
if( !( cflags & CF_COUNTDOWN ) || ( timer[id-1][TMR_BSTTME] - get_climber_time( id ) < 0 ) ) |
if( !( cflags & CF_COUNTDOWN ) || ( timer[id][TMR_BSTTME] >= timer[id][TMR_CNTTME] ) ) |
2118 |
hudtime_msg( id, cltime ) |
hudtime_msg( id, cltime ) |
2119 |
else if( cflags & CF_PAUSE ) |
else if( cflags & CF_PAUSE ) |
2120 |
hudtime_msg( id, timer[id-1][TMR_BSTTME] - cltime + 1 ) |
hudtime_msg( id, timer[id][TMR_BSTTME] / 10 - cltime + 1 ) |
2121 |
|
|
2122 |
for( new j = 1; j <= spec_ids[id-1][0]; j++ ) |
for( new j = 1; j <= spec_ids[id][0]; j++ ) |
2123 |
hudtime_msg( spec_ids[id-1][j], cltime ) |
hudtime_msg( spec_ids[id][j], cltime ) |
2124 |
} |
} |
2125 |
} |
} |
2126 |
|
|
2127 |
public toggle_countdown( id ) |
public toggle_countdown( id ) |
2128 |
{ |
{ |
2129 |
//Toggle countdown flag and print message |
//Toggle countdown flag and print message |
2130 |
timer[id-1][TMR_CFLAGS] ^= CF_COUNTDOWN |
timer[id][TMR_CFLAGS] ^= CF_COUNTDOWN |
2131 |
if( timer[id-1][TMR_CFLAGS] & CF_COUNTDOWN ) |
if( timer[id][TMR_CFLAGS] & CF_COUNTDOWN ) |
2132 |
{ |
{ |
2133 |
if( set_countdown_time( id ) ) |
if( set_countdown_time( id ) ) |
2134 |
clmsg( id, "Countdown enabled." ) |
clmsg( id, "Countdown enabled." ) |
2139 |
|
|
2140 |
public bool:set_countdown_time( id ) |
public bool:set_countdown_time( id ) |
2141 |
{ |
{ |
2142 |
new bsttime = timer[id-1][TMR_BSTTME] |
new bsttme = timer[id][TMR_BSTTME] / 10 |
2143 |
if( bsttime > 0 ) |
if( bsttme > 0 ) |
2144 |
{ |
{ |
2145 |
new cflags = timer[id-1][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
2146 |
if( cflags & CF_START || cflags & CF_PAUSE ) |
if( cflags & CF_START || cflags & CF_PAUSE ) |
2147 |
hudtime_msg( id, timer[id-1][TMR_BSTTME] - get_climber_time( id ) ) |
hudtime_msg( id, bsttme - timer[id][TMR_CNTTME] / 10 ) |
2148 |
return true |
return true |
2149 |
} |
} |
2150 |
clmsg( id, "Countdown disabled: No high score available." ) |
clmsg( id, "Countdown disabled: No high score available." ) |
2151 |
timer[id-1][TMR_CFLAGS] ^= CF_COUNTDOWN |
timer[id][TMR_CFLAGS] ^= CF_COUNTDOWN |
2152 |
return false |
return false |
2153 |
} |
} |
2154 |
|
|
2161 |
|
|
2162 |
public getuserstatus( id ) |
public getuserstatus( id ) |
2163 |
{//Return string describing user status |
{//Return string describing user status |
2164 |
new msg[12], cflags = timer[id-1][TMR_CFLAGS] |
new msg[12], cflags = timer[id][TMR_CFLAGS] |
2165 |
msg = "PAUSED" |
msg = "PAUSED" |
2166 |
if( cflags & CF_STOP && timer[id-1][TMR_SESFIN] > 0 ) |
if( cflags & CF_STOP && timer[id][TMR_SESFIN] > 0 ) |
2167 |
msg = "Finished" |
msg = "Finished" |
2168 |
else if( cflags & CF_STOP ) |
else if( cflags & CF_STOP ) |
2169 |
msg = "Not Started" |
msg = "Not Started" |
2181 |
show_hudmessage( id, msg ) |
show_hudmessage( id, msg ) |
2182 |
|
|
2183 |
//Show to spectators |
//Show to spectators |
2184 |
for( new i = 1; i <= spec_ids[id-1][0]; i++ ) |
for( new i = 1; i <= spec_ids[id][0]; i++ ) |
2185 |
show_hudmessage( spec_ids[id-1][i], msg ) |
show_hudmessage( spec_ids[id][i], msg ) |
2186 |
|
|
2187 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
2188 |
} |
} |
2190 |
public spec_update(){ |
public spec_update(){ |
2191 |
if(get_pcvar_num(p_climb)){ |
if(get_pcvar_num(p_climb)){ |
2192 |
new players[32],num,id,id2,i |
new players[32],num,id,id2,i |
2193 |
for(i=1;i<33;i++)spec_ids[i-1][0]=0 |
for(i=1;i<33;i++)spec_ids[i][0]=0 |
2194 |
get_players(players,num,"bch") |
get_players(players,num,"bch") |
2195 |
for(i=0;i<num;i++){ |
for(i=0;i<num;i++){ |
2196 |
id=players[i] |
id=players[i] |
2197 |
id2=pev(id,pev_iuser2) |
id2=pev(id,pev_iuser2) |
2198 |
if(id2){ |
if(id2){ |
2199 |
spec_ids[id2-1][0]++ |
spec_ids[id2][0]++ |
2200 |
spec_ids[id2-1][spec_ids[id2-1][0]]=id |
spec_ids[id2][spec_ids[id2][0]]=id |
2201 |
} |
} |
2202 |
} |
} |
2203 |
} |
} |
2208 |
{ |
{ |
2209 |
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,255) |
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,255) |
2210 |
entity_set_int(id,EV_INT_solid,SOLID_BBOX) |
entity_set_int(id,EV_INT_solid,SOLID_BBOX) |
2211 |
sclip[id-1]=false |
sclip[id]=false |
2212 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
2213 |
} |
} |
2214 |
//Make client unsolid |
//Make client unsolid |
2217 |
if(get_pcvar_num(p_render))set_user_rendering(id,kRenderFxHologram,0,0,0,kRenderTransAdd,0) |
if(get_pcvar_num(p_render))set_user_rendering(id,kRenderFxHologram,0,0,0,kRenderTransAdd,0) |
2218 |
else set_user_rendering(id,kRenderFxPulseSlow,0,0,0,kRenderTransTexture,50) |
else set_user_rendering(id,kRenderFxPulseSlow,0,0,0,kRenderTransTexture,50) |
2219 |
entity_set_int(id,EV_INT_solid,SOLID_NOT) |
entity_set_int(id,EV_INT_solid,SOLID_NOT) |
2220 |
sclip[id-1]=true |
sclip[id]=true |
2221 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
2222 |
} |
} |
2223 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2244 |
|
|
2245 |
public is_finished( id ) |
public is_finished( id ) |
2246 |
{ |
{ |
2247 |
new cflags = timer[id-1][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
2248 |
if( cflags & CF_STOP && ( get_user_flags( id ) & VIP || timer[id-1][TMR_SESFIN] > 0 ) ) |
if( cflags & CF_STOP && ( get_user_flags( id ) & VIP || timer[id][TMR_SESFIN] > 0 ) ) |
2249 |
return 1 |
return 1 |
2250 |
return 0 |
return 0 |
2251 |
} |
} |
2257 |
} |
} |
2258 |
|
|
2259 |
public notpaused(id){//Use in IF statements to automatically print error if false |
public notpaused(id){//Use in IF statements to automatically print error if false |
2260 |
if(!(timer[id-1][TMR_CFLAGS]&CF_PAUSE))return 1 |
if(!(timer[id][TMR_CFLAGS]&CF_PAUSE))return 1 |
2261 |
clmsg(id,"You can't execute this command while paused.") |
clmsg(id,"You can't execute this command while paused.") |
2262 |
return 0 |
return 0 |
2263 |
} |
} |
2264 |
|
|
2265 |
/*public regwarn(id){ |
/*public regwarn(id){ |
2266 |
if(timer[id-1][TMR_DBUSER]<1){ |
if(timer[id][TMR_DBUSER]<1){ |
2267 |
saytext(id,id,"^x04You must register/login for your stats to save. Say /climbhelp for more info.") |
saytext(id,id,"^x04You must register/login for your stats to save. Say /climbhelp for more info.") |
2268 |
return 1 |
return 1 |
2269 |
} |
} |
2274 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2275 |
// Start: Auto Heal functions |
// Start: Auto Heal functions |
2276 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2277 |
public damage(id){//Called when client takes damage |
public Health( id ) |
2278 |
|
{//Called when client takes damage |
2279 |
new ida[1] |
new ida[1] |
2280 |
ida[0]=id |
ida[0]=id |
2281 |
set_task(0.1,"damage_handle",_,ida,1) |
set_task(0.1,"damage_handle",_,ida,1) |
2327 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2328 |
// End: Auto Heal functions |
// End: Auto Heal functions |
2329 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2330 |
// Start: Multiplay Bunny Hop functions |
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
2331 |
public pfn_touch( ent, id ) |
public pfn_touch( ent, id ) |
2332 |
{ |
{ |
2333 |
if( !get_pcvar_num( p_climb ) ) |
if( !get_pcvar_num( p_climb ) ) |
2352 |
} |
} |
2353 |
else return PLUGIN_HANDLED |
else return PLUGIN_HANDLED |
2354 |
|
|
|
if ( !ent || !id ) |
|
|
return PLUGIN_CONTINUE |
|
|
|
|
|
//Make sure id is player and ent is object |
|
|
if( 0 < ent <= MAXPLAYERS ) |
|
|
{ |
|
|
new tmp = id |
|
|
id = ent |
|
|
ent = tmp |
|
|
} |
|
|
else if( !( 0 < id <= MAXPLAYERS ) ) |
|
|
return PLUGIN_CONTINUE |
|
|
|
|
|
//Bhop stuff |
|
|
new dpos = door_in_array( ent ) |
|
|
if( dpos > -1 ) |
|
|
{ |
|
|
//Finished can stand on bhop blocks |
|
|
if( is_finished( id ) ) |
|
|
return PLUGIN_HANDLED |
|
|
|
|
|
if( bhop_failid[id-1] != ent ) |
|
|
{ |
|
|
bhop_failid[id-1] = ent |
|
|
bhop_fail[id-1] = false |
|
|
|
|
|
new tskid = TSK_BHOP + id |
|
|
if( task_exists( tskid ) ) |
|
|
remove_task( tskid ) |
|
|
set_task( 0.2, "bhop_set_fail", tskid ) |
|
|
tskid = TSK_CLEAR_FAIL + id |
|
|
if( task_exists( tskid ) ) |
|
|
remove_task( tskid ) |
|
|
set_task( 0.7, "bhop_clear_fail", tskid ) |
|
|
} |
|
|
else if( bhop_fail[id-1] ) |
|
|
{ |
|
|
teleport( id, door_tp_pos[dpos] ) |
|
|
bhop_failid[id-1] = 0 |
|
|
bhop_fail[id-1] = false |
|
|
} |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
2355 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
2356 |
} |
} |
2357 |
|
|
|
public door_in_array( door ) |
|
|
{ |
|
|
for( new i = 0; i < door_count; i++ ) |
|
|
if( func_doors[i][0] == door ) |
|
|
return i |
|
|
return -1 |
|
|
} |
|
|
|
|
|
public bhop_set_fail( tskid ) |
|
|
{ |
|
|
bhop_fail[tskid-TSK_BHOP-1] = true |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
|
public bhop_clear_fail( tskid ) |
|
|
{ |
|
|
new id = tskid - TSK_CLEAR_FAIL |
|
|
bhop_failid[id-1] = 0 |
|
|
bhop_fail[id-1] = false |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
// End: Multiplay Bunny Hop functions |
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
2358 |
/*public spawn_distance_sort(elem1[],elem2[]){ |
/*public spawn_distance_sort(elem1[],elem2[]){ |
2359 |
if(elem1[1]<elem2[1])return -1 |
if(elem1[1]<elem2[1])return -1 |
2360 |
if(elem1[1]>elem2[1])return 1 |
if(elem1[1]>elem2[1])return 1 |
2379 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2380 |
public flight_icons( id ) |
public flight_icons( id ) |
2381 |
{ |
{ |
2382 |
if( timer[id-1][TMR_CFLAGS] & CF_LIGHT_ON ) |
if( timer[id][TMR_CFLAGS] & CF_LIGHT_ON ) |
2383 |
{ |
{ |
2384 |
if( !task_exists( TSK_FLIGHT + id ) ) |
if( !task_exists( TSK_FLIGHT + id ) ) |
2385 |
set_task( 0.1, "flight_msg", TSK_FLIGHT + id, _, _, "b" ) |
set_task( 0.1, "flight_msg", TSK_FLIGHT + id, _, _, "b" ) |
2412 |
} |
} |
2413 |
public tog_flight(id){ |
public tog_flight(id){ |
2414 |
if(!get_pcvar_num(p_climb))return PLUGIN_CONTINUE |
if(!get_pcvar_num(p_climb))return PLUGIN_CONTINUE |
2415 |
if(!(timer[id-1][TMR_CFLAGS]&CF_LIGHT_ON)){ |
if(!(timer[id][TMR_CFLAGS]&CF_LIGHT_ON)){ |
2416 |
timer[id-1][TMR_CFLAGS]+=CF_LIGHT_ON |
timer[id][TMR_CFLAGS]+=CF_LIGHT_ON |
2417 |
set_task(0.1,"flight_msg",TSK_FLIGHT+id,_,_,"b") |
set_task(0.1,"flight_msg",TSK_FLIGHT+id,_,_,"b") |
2418 |
} |
} |
2419 |
else timer[id-1][TMR_CFLAGS]-=CF_LIGHT_ON |
else timer[id][TMR_CFLAGS]-=CF_LIGHT_ON |
2420 |
flight_icons(id) |
flight_icons(id) |
2421 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
2422 |
} |
} |
2424 |
public flight_msg(tskid){ |
public flight_msg(tskid){ |
2425 |
if(get_pcvar_num(p_climb)){ |
if(get_pcvar_num(p_climb)){ |
2426 |
new orig[3],id=tskid-TSK_FLIGHT |
new orig[3],id=tskid-TSK_FLIGHT |
2427 |
if(!(timer[id-1][TMR_CFLAGS]&CF_LIGHT_ON))remove_task(tskid) |
if(!(timer[id][TMR_CFLAGS]&CF_LIGHT_ON))remove_task(tskid) |
2428 |
get_user_origin(id,orig) |
get_user_origin(id,orig) |
2429 |
message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,_,id) |
message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,_,id) |
2430 |
write_byte(TE_DLIGHT) |
write_byte(TE_DLIGHT) |
2478 |
set_entity_flags(ida[0],FL_DUCKING,1) |
set_entity_flags(ida[0],FL_DUCKING,1) |
2479 |
} |
} |
2480 |
|
|
2481 |
public cvar_enabled(id,p_cvar){//Used in IF statements to automatically print error if false |
//Used in IF statements to automatically print error if false |
2482 |
if(get_pcvar_num(p_cvar)==0){ |
stock cvar_enabled( id, p_cvar, silent = 0 ) |
2483 |
|
{ |
2484 |
|
if( get_pcvar_num(p_cvar) == 0 ) |
2485 |
|
{ |
2486 |
|
if( !silent ) |
2487 |
|
{ |
2488 |
clmsg(id,"This command is disabled.") |
clmsg(id,"This command is disabled.") |
2489 |
client_print(id,print_chat,"This command has been disabled by the server administrator.") |
client_print(id,print_chat,"This command has been disabled by the server administrator.") |
2490 |
|
} |
2491 |
return 0 |
return 0 |
2492 |
} |
} |
2493 |
return 1 |
return 1 |
2499 |
public sunglasses( id ) |
public sunglasses( id ) |
2500 |
{ |
{ |
2501 |
//Toggle flag for this measure and print message |
//Toggle flag for this measure and print message |
2502 |
timer[id-1][TMR_CFLAGS] ^= CF_SUNGLASSES |
timer[id][TMR_CFLAGS] ^= CF_SUNGLASSES |
2503 |
if( timer[id-1][TMR_CFLAGS] & CF_SUNGLASSES ) |
if( timer[id][TMR_CFLAGS] & CF_SUNGLASSES ) |
2504 |
{ |
{ |
2505 |
message_begin( MSG_ONE, SVC_SCREENFADE, _, id ) |
message_begin( MSG_ONE, SVC_SCREENFADE, _, id ) |
2506 |
write_short( 1 ) //total duration |
write_short( 1 ) //total duration |
2527 |
} |
} |
2528 |
|
|
2529 |
public give_scout( id ) |
public give_scout( id ) |
2530 |
if( !check_timeout( id, time_stamps[id-1][TS_WPN], WPN_TIMEOUT ) ) |
if( !check_timeout( id, time_stamps[id][TS_WPN], WPN_TIMEOUT ) ) |
2531 |
give_item( id, "weapon_scout" ) |
give_item( id, "weapon_scout" ) |
2532 |
|
|
2533 |
public give_usp( id ) |
public give_usp( id ) |
2534 |
if( !check_timeout( id, time_stamps[id-1][TS_WPN], WPN_TIMEOUT ) ) |
if( !check_timeout( id, time_stamps[id][TS_WPN], WPN_TIMEOUT ) ) |
2535 |
give_item( id, "weapon_usp" ) |
give_item( id, "weapon_usp" ) |
2536 |
|
|
2537 |
public give_weapons( id ) |
public give_weapons( id ) |
2538 |
if( !check_timeout( id, time_stamps[id-1][TS_WPN], WPN_TIMEOUT ) ) |
if( !check_timeout( id, time_stamps[id][TS_WPN], WPN_TIMEOUT ) ) |
2539 |
{ |
{ |
2540 |
give_item( id, "weapon_awp" ) |
give_item( id, "weapon_awp" ) |
2541 |
give_item( id, "weapon_m249" ) |
give_item( id, "weapon_m249" ) |
2592 |
|
|
2593 |
climb_user_spawn( id ) |
climb_user_spawn( id ) |
2594 |
|
|
2595 |
if( timer[id-1][TMR_CFLAGS] & CF_PAUSE ) |
if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
2596 |
{//If they are paused tp to pause spot and freeze them again. |
{//If they are paused tp to pause spot and freeze them again. |
2597 |
new Float:coords[3] |
new Float:coords[3] |
2598 |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
2623 |
set_pev( id, pev_takedamage, DAMAGE_NO ) |
set_pev( id, pev_takedamage, DAMAGE_NO ) |
2624 |
set_entity_flags( id, FL_FROZEN, 0 ) |
set_entity_flags( id, FL_FROZEN, 0 ) |
2625 |
|
|
2626 |
if( timer[id-1][TMR_CFLAGS] & CF_START ) change_status( id, CF_PAUSE ) |
if( timer[id][TMR_CFLAGS] & CF_START ) change_status( id, CF_PAUSE ) |
2627 |
} |
} |
2628 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
2629 |
} |
} |
2785 |
public toggle_measure( id ) |
public toggle_measure( id ) |
2786 |
{ |
{ |
2787 |
//Remove flag for other measure |
//Remove flag for other measure |
2788 |
new cflags = timer[id-1][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
2789 |
if( cflags & CF_MEASURE2 ) timer[id-1][TMR_CFLAGS] = cflags & ~CF_MEASURE2 |
if( cflags & CF_MEASURE2 ) timer[id][TMR_CFLAGS] = cflags & ~CF_MEASURE2 |
2790 |
|
|
2791 |
//Toggle flag for this measure and print message |
//Toggle flag for this measure and print message |
2792 |
timer[id-1][TMR_CFLAGS] ^= CF_MEASURE |
timer[id][TMR_CFLAGS] ^= CF_MEASURE |
2793 |
if( cflags & CF_MEASURE ) |
if( cflags & CF_MEASURE ) |
2794 |
clmsg( id, "Measure disabled." ) |
clmsg( id, "Measure disabled." ) |
2795 |
else |
else |
2874 |
public toggle_measure2( id ) |
public toggle_measure2( id ) |
2875 |
{ |
{ |
2876 |
//Remove flag for other measure |
//Remove flag for other measure |
2877 |
new cflags = timer[id-1][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
2878 |
if( cflags & CF_MEASURE ) timer[id-1][TMR_CFLAGS] = cflags & ~CF_MEASURE |
if( cflags & CF_MEASURE ) timer[id][TMR_CFLAGS] = cflags & ~CF_MEASURE |
2879 |
|
|
2880 |
//Toggle flag for this measure and print message |
//Toggle flag for this measure and print message |
2881 |
timer[id-1][TMR_CFLAGS] ^= CF_MEASURE2 |
timer[id][TMR_CFLAGS] ^= CF_MEASURE2 |
2882 |
if( cflags & CF_MEASURE2 ) |
if( cflags & CF_MEASURE2 ) |
2883 |
clmsg( id, "Measure 2 disabled." ) |
clmsg( id, "Measure 2 disabled." ) |
2884 |
else |
else |
2892 |
{ |
{ |
2893 |
new tskid = TSK_MEASURE2 + id |
new tskid = TSK_MEASURE2 + id |
2894 |
|
|
2895 |
static Float:ln_st_static[32][3] |
static Float:ln_st_static[33][3] |
2896 |
|
|
2897 |
new Float:orig[3], Float:ret[3], Float:end[3] |
new Float:orig[3], Float:ret[3], Float:end[3] |
2898 |
|
|
2906 |
trace_line( id, orig, end, ret ) |
trace_line( id, orig, end, ret ) |
2907 |
|
|
2908 |
new Float:ln_st[3] |
new Float:ln_st[3] |
2909 |
ln_st = ln_st_static[id-1] |
ln_st = ln_st_static[id] |
2910 |
|
|
2911 |
//If first iteration, save point to static and return |
//If first iteration, save point to static and return |
2912 |
if( !( ln_st[0] || ln_st[0] || ln_st[0] ) ) |
if( !( ln_st[0] || ln_st[0] || ln_st[0] ) ) |
2913 |
{ |
{ |
2914 |
ln_st_static[id-1] = ret |
ln_st_static[id] = ret |
2915 |
set_task( 0.1, "tsk_do_measure2", tskid, _, _, "b" ) |
set_task( 0.1, "tsk_do_measure2", tskid, _, _, "b" ) |
2916 |
return |
return |
2917 |
} |
} |
3006 |
message_end( ) |
message_end( ) |
3007 |
|
|
3008 |
//Remove task if flag has been removed |
//Remove task if flag has been removed |
3009 |
if( task_exists( tskid ) && !( timer[id-1][TMR_CFLAGS] & CF_MEASURE2 ) ) remove_task( tskid ) |
if( task_exists( tskid ) && !( timer[id][TMR_CFLAGS] & CF_MEASURE2 ) ) remove_task( tskid ) |
3010 |
|
|
3011 |
//If a second point hasn't been set then end here |
//If a second point hasn't been set then end here |
3012 |
if( !set ) return |
if( !set ) return |
3013 |
|
|
3014 |
//If it gets this far it's the second iteration, /*so disable flag and*/ reset static var |
//If it gets this far it's the second iteration, /*so disable flag and*/ reset static var |
3015 |
//timer[id-1][TMR_CFLAGS] ^= CF_MEASURE2 |
//timer[id][TMR_CFLAGS] ^= CF_MEASURE2 |
3016 |
ln_st_static[id-1] = Float:{ 0.0, 0.0, 0.0 } |
ln_st_static[id] = Float:{ 0.0, 0.0, 0.0 } |
3017 |
if( task_exists( tskid ) ) remove_task( tskid ) |
if( task_exists( tskid ) ) remove_task( tskid ) |
3018 |
} |
} |
3019 |
|
|
3108 |
server_ip char(15),\ |
server_ip char(15),\ |
3109 |
user_id integer,\ |
user_id integer,\ |
3110 |
map_name varchar(32),\ |
map_name varchar(32),\ |
3111 |
fin_time integer,\ |
fin_time float,\ |
3112 |
cps integer,\ |
cps integer,\ |
3113 |
gcs integer,\ |
gcs integer,\ |
3114 |
boosts integer,\ |
boosts integer,\ |
3166 |
if( CLIMB_SAVE ) |
if( CLIMB_SAVE ) |
3167 |
{ |
{ |
3168 |
//log_amx( "CLIMB: Begin login client id=%d.", id ) |
//log_amx( "CLIMB: Begin login client id=%d.", id ) |
3169 |
//log_amx( "CLIMB: timer[id-1][TMR_DBUSER]=%d.", timer[id-1][TMR_DBUSER] ) |
//log_amx( "CLIMB: timer[id][TMR_DBUSER]=%d.", timer[id][TMR_DBUSER] ) |
3170 |
|
|
3171 |
if( timer[id-1][TMR_DBUSER] > 0 ) //Already logged in |
if( timer[id][TMR_DBUSER] > 0 ) //Already logged in |
3172 |
{ |
{ |
3173 |
client_print( id, print_console, "[Climb] Login Error: You are already logged in." ) |
client_print( id, print_console, "[Climb] Login Error: You are already logged in." ) |
3174 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
3243 |
} |
} |
3244 |
|
|
3245 |
//Everything is ok, add db userid to timer info, display login messages |
//Everything is ok, add db userid to timer info, display login messages |
3246 |
timer[id-1][TMR_DBUSER] = SQL_ReadResult( query, 0 ) |
timer[id][TMR_DBUSER] = SQL_ReadResult( query, 0 ) |
3247 |
new msg[100] |
new msg[100] |
3248 |
formatex( msg, 99, "[Climb] Login: Success - Account: %s", sid ) |
formatex( msg, 99, "[Climb] Login: Success - Account: %s", sid ) |
3249 |
//log_amx( "CLIMB: Login Success id=%d", id ) |
//log_amx( "CLIMB: Login Success id=%d", id ) |
3252 |
saytext( id, id, msg ) |
saytext( id, id, msg ) |
3253 |
|
|
3254 |
//If they just registered and logged in, save score, else load score |
//If they just registered and logged in, save score, else load score |
3255 |
if( timer[id-1][TMR_CFLAGS] & CF_JUST_REGD ) |
if( timer[id][TMR_CFLAGS] & CF_JUST_REGD ) |
3256 |
{ |
{ |
3257 |
db_save( id ) |
db_save( id ) |
3258 |
timer[id-1][TMR_CFLAGS] -= CF_JUST_REGD |
timer[id][TMR_CFLAGS] -= CF_JUST_REGD |
3259 |
} |
} |
3260 |
else db_load(id) |
else db_load(id) |
3261 |
} |
} |
3264 |
|
|
3265 |
/*public logout(id) |
/*public logout(id) |
3266 |
{ |
{ |
3267 |
for(new i=0;i<8;i++)origins[id-1][i]=0.0 |
for(new i=0;i<8;i++)origins[id][i]=0.0 |
3268 |
for(new i=0;i<11;i++)timer[id-1][i]=0 |
for(new i=0;i<11;i++)timer[id][i]=0 |
3269 |
}*/ |
}*/ |
3270 |
|
|
3271 |
public db_load( id ) |
public db_load( id ) |
3273 |
new query[351], mapname[33], data[1] |
new query[351], mapname[33], data[1] |
3274 |
data[0] = id |
data[0] = id |
3275 |
get_mapname( mapname, 32 ) |
get_mapname( mapname, 32 ) |
3276 |
/*formatex( query, 149, |
|
|
"select fin_time, cps, gcs, fin_cnt, boosts, wpns from %sscores where user_id=%d and map_name=^"%s^";", |
|
|
DB_PREFIX, timer[id-1][TMR_DBUSER], mapname )*/ |
|
3277 |
formatex( query, 350, |
formatex( query, 350, |
3278 |
"select s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns from %sscores s, (select user_id, count(*) fin_cnt from %sscores where map_name = ^"%s^" group by user_id) g where map_name = ^"%s^" and s.user_id = %d and g.user_id = %d", |
"select s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns from %sscores s, (select user_id, count(*) fin_cnt from %sscores where map_name = ^"%s^" group by user_id) g where map_name = ^"%s^" and s.user_id = %d and g.user_id = %d order by score", |
3279 |
DB_PREFIX, DB_PREFIX, mapname, mapname, timer[id-1][TMR_DBUSER], timer[id-1][TMR_DBUSER] ) |
DB_PREFIX, DB_PREFIX, mapname, mapname, timer[id][TMR_DBUSER], timer[id][TMR_DBUSER] ) |
3280 |
|
|
3281 |
SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 ) |
SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 ) |
3282 |
} |
} |
3283 |
|
|
3291 |
msg="^x04No stats available for this account on the current map." |
msg="^x04No stats available for this account on the current map." |
3292 |
else |
else |
3293 |
{ |
{ |
3294 |
new mapname[33],timestr[9] |
new mapname[33], Float:fTmp |
3295 |
get_mapname(mapname,32) |
get_mapname(mapname,32) |
3296 |
timer[id-1][TMR_BSTTME] = SQL_ReadResult( query, 0 ) |
SQL_ReadResult( query, 0, fTmp ) |
3297 |
timer[id-1][TMR_BSTCPS] = SQL_ReadResult( query, 1 ) |
timer[id][TMR_BSTTME] = floatround( fTmp * 10 ) |
3298 |
timer[id-1][TMR_BSTGCS] = SQL_ReadResult( query, 2 ) |
timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 ) |
3299 |
timer[id-1][TMR_MAPFIN] = SQL_ReadResult( query, 3 ) |
timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 ) |
3300 |
timer[id-1][TMR_BSTBST] = SQL_ReadResult( query, 4 ) |
timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 ) |
3301 |
timer[id-1][TMR_BSTWPN] = SQL_ReadResult( query, 5 ) |
timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 ) |
3302 |
//timer[id-1][TMR_CFLAGS]+=SQL_ReadResult(query,5)?CF_BSTSCT:0 |
timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 ) |
3303 |
|
//timer[id][TMR_CFLAGS]+=SQL_ReadResult(query,5)?CF_BSTSCT:0 //Read cflag preferences from db, maybe this should be setinfos instead |
3304 |
|
|
|
timestr = parsetime(timer[id-1][TMR_BSTTME]) |
|
3305 |
formatex( msg, 99, |
formatex( msg, 99, |
3306 |
"^x04Stats loaded for %s - %s^t(%d/ %d CP/%d GC/%d Boost)^tCompleted %d", |
"^x04Stats loaded for %s - %s^t(%d/ %d CP/%d GC/%d Boost)^tCompleted %d", |
3307 |
mapname, timestr, timer[id-1][TMR_BSTWPN], timer[id-1][TMR_BSTCPS], |
mapname, parsetime( timer[id][TMR_BSTTME] ), timer[id][TMR_BSTWPN], timer[id][TMR_BSTCPS], |
3308 |
timer[id-1][TMR_BSTGCS], timer[id-1][TMR_BSTBST], timer[id-1][TMR_MAPFIN] ) |
timer[id][TMR_BSTGCS], timer[id][TMR_BSTBST], timer[id][TMR_MAPFIN] ) |
3309 |
} |
} |
3310 |
saytext( id, id, msg ) |
saytext( id, id, msg ) |
3311 |
} |
} |
3315 |
|
|
3316 |
public db_save( id ) |
public db_save( id ) |
3317 |
{ |
{ |
3318 |
if( timer[id-1][TMR_DBUSER] < 1 ) |
new user_id = timer[id][TMR_DBUSER] |
3319 |
|
|
3320 |
|
if( user_id < 1 ) |
3321 |
{ |
{ |
3322 |
auto_reg( id ) |
auto_reg( id ) |
3323 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
3324 |
} |
} |
3325 |
|
|
3326 |
new query[351], name[33], data[2] |
new query[351], name[33], data[2] |
3327 |
data[0] = id |
data[0] = id |
3328 |
get_mapname( name, 32 ) |
get_mapname( name, 32 ) |
3329 |
strtolower( name ) |
strtolower( name ) |
3330 |
|
|
3331 |
new user_id = timer[id-1][TMR_DBUSER] |
new cntbst = timer[id][TMR_CNTBST] |
3332 |
new fin_time = get_climber_time( id ) |
new cntcps = timer[id][TMR_CNTCPS] |
3333 |
|
new cntwpn = timer[id][TMR_CNTWPN] |
3334 |
|
|
3335 |
|
new score = ( ( ( cntbst > 0 ? 1 : 0 ) * 1000000 ) + |
3336 |
|
( ( cntcps > 0 ? 1 : 0 ) * 100000 ) + |
3337 |
|
( cntwpn * 10000 ) + |
3338 |
|
timer[id][TMR_CNTTME] / 10 ) |
3339 |
|
|
|
new wpn_rank = timer[id-1][TMR_CNTWPN] |
|
|
|
|
|
new score = ( ( ( timer[id-1][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
|
( ( timer[id-1][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
|
|
( wpn_rank * 10000 ) + |
|
|
fin_time ) |
|
|
|
|
|
/*if( timer[id-1][TMR_MAPFIN] == 1 ) |
|
3340 |
formatex( query, 350, |
formatex( query, 350, |
3341 |
"insert into %sscores (user_id, map_name, fin_time, cps, gcs, fin_cnt, boosts, wpns, score, server_time_stamp) values (%d, ^"%s^", %d, %d, %d, %d, %d, %d, %d, %d);",\ |
"insert into %sscores (server_ip, user_id, map_name, fin_time, cps, gcs, boosts, wpns, score, server_time_stamp) values (^"%s^", %d, ^"%s^", %f, %d, %d, %d, %d, %d, %d)",\ |
3342 |
DB_PREFIX, user_id, name, fin_time, timer[id-1][TMR_BSTCPS], timer[id-1][TMR_BSTGCS], timer[id-1][TMR_MAPFIN], timer[id-1][TMR_BSTBST], sctd, sort, get_systime() ) |
DB_PREFIX, DB_SERVER_ID, user_id, name, timer[id][TMR_CNTTME] * 0.1, cntcps, timer[id][TMR_CNTGCS], cntbst, cntwpn, score, get_systime() ) |
|
else*/ |
|
|
formatex( query, 350, |
|
|
"insert into %sscores (server_ip, user_id, map_name, fin_time, cps, gcs, boosts, wpns, score, server_time_stamp) values (^"%s^", %d, ^"%s^", %d, %d, %d, %d, %d, %d, %d)",\ |
|
|
DB_PREFIX, DB_SERVER_ID, user_id, name, fin_time, timer[id-1][TMR_CNTCPS], timer[id-1][TMR_CNTGCS], timer[id-1][TMR_CNTBST], wpn_rank, score, get_systime() ) |
|
3343 |
SQL_ThreadQuery(DB_TUPLE,"db_save_handler",query,data,2) |
SQL_ThreadQuery(DB_TUPLE,"db_save_handler",query,data,2) |
3344 |
|
|
3345 |
data[1] = 0 |
data[1] = 0 |
3346 |
get_user_name( id, name, 32 ) |
get_user_name( id, name, 32 ) |
3347 |
formatex( query, 350, "update %splayers set alias=^"%s^" where user_id=%d;", DB_PREFIX, name, timer[id-1][TMR_DBUSER] ) |
formatex( query, 350, "update %splayers set alias=^"%s^" where user_id=%d;", DB_PREFIX, name, user_id ) |
3348 |
SQL_ThreadQuery( DB_TUPLE, "db_name_update_handler", query, data, 2 ) |
SQL_ThreadQuery( DB_TUPLE, "db_name_update_handler", query, data, 2 ) |
3349 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
3350 |
} |
} |
3382 |
|
|
3383 |
formatex( query, 249,\ |
formatex( query, 249,\ |
3384 |
"update %splayers set alias=^"%s^" where user_id=%d;",\ |
"update %splayers set alias=^"%s^" where user_id=%d;",\ |
3385 |
DB_PREFIX, name, timer[id-1][TMR_DBUSER] ) |
DB_PREFIX, name, timer[id][TMR_DBUSER] ) |
3386 |
SQL_ThreadQuery(DB_TUPLE,"db_name_update_handler",query,data2,2) |
SQL_ThreadQuery(DB_TUPLE,"db_name_update_handler",query,data2,2) |
3387 |
} |
} |
3388 |
} |
} |
3427 |
formatex(query,99,"insert into %splayers (user_name,password,alias) values (^"%s^",^"%s^",^"%s^")",DB_PREFIX,user,pass,name) |
formatex(query,99,"insert into %splayers (user_name,password,alias) values (^"%s^",^"%s^",^"%s^")",DB_PREFIX,user,pass,name) |
3428 |
SQL_ThreadQuery(DB_TUPLE,"reg_handler",query,data,43) |
SQL_ThreadQuery(DB_TUPLE,"reg_handler",query,data,43) |
3429 |
} |
} |
|
//Else register SteamID |
|
|
/*else if(timer[id-1][TMR_DBUSER]<1){ |
|
|
data[1]=2 |
|
|
formatex(query,99,"insert into %splayers (steam_id,alias) values (^"%s^",^"%s^")",DB_PREFIX,sid,name) |
|
|
SQL_ThreadQuery(DB_TUPLE,"reg_handler",query,data,43) |
|
|
}*/ |
|
3430 |
} |
} |
3431 |
else client_print(id,print_console,"[Climb] Registration Error: Can't Register; Stats not enabled.") |
else client_print(id,print_console,"[Climb] Registration Error: Can't Register; Stats not enabled.") |
3432 |
} |
} |
3463 |
client_cmd(id,cmd) |
client_cmd(id,cmd) |
3464 |
} |
} |
3465 |
else if(flag==2){ |
else if(flag==2){ |
3466 |
timer[id-1][TMR_CFLAGS]+=CF_JUST_REGD |
timer[id][TMR_CFLAGS]+=CF_JUST_REGD |
3467 |
client_cmd(id,"login") |
client_cmd(id,"login") |
3468 |
} |
} |
3469 |
} |
} |
3472 |
} |
} |
3473 |
|
|
3474 |
public highscores(id) |
public highscores(id) |
3475 |
{//Show High Scores |
{ |
3476 |
if( !CLIMB_SAVE ) return clmsg( id, "Stats not enabled.") |
if( !CLIMB_SAVE ) return clmsg( id, "Stats not enabled.") |
3477 |
|
|
3478 |
new hsurl[150], mapname[33] |
new hsurl[150], mapname[33] |
3488 |
{ |
{ |
3489 |
new query[501], data[1] |
new query[501], data[1] |
3490 |
data[0] = id |
data[0] = id |
3491 |
/*formatex( query, 249,\ |
|
|
"select p.alias, s.fin_time, s.cps, s.gcs, s.fin_cnt, s.boosts, s.wpns from %sscores s, %splayers p where s.map_name=^"%s^" and p.user_id=s.user_id order by s.score, s.fin_time limit 20;",\ |
|
|
DB_PREFIX, DB_PREFIX, mapname )*/ |
|
3492 |
formatex( query, 500, |
formatex( query, 500, |
3493 |
"select distinct p.alias, s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns, s.score from %sscores s join %splayers p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt from %sscores where map_name=^"%s^" group by user_id, wpns) g on p.user_id=g.user_id where map_name=^"%s^" and s.score=g.minscore order by s.score limit 20", |
"select distinct p.alias, s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns, s.score from %sscores s join %splayers p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt from %sscores where map_name=^"%s^" group by user_id, wpns) g on p.user_id=g.user_id where map_name=^"%s^" and s.score=g.minscore order by s.score limit 20", |
3494 |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
3495 |
|
|
3496 |
SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 ) |
SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 ) |
3497 |
ts_hscore = get_systime() |
ts_hscore = get_systime() |
3498 |
} |
} |
3536 |
sb_add_tabs( name, NAMELEN+2 ) |
sb_add_tabs( name, NAMELEN+2 ) |
3537 |
|
|
3538 |
|
|
3539 |
format( btime_str, 19, "%d/%d/%d/%d",\ |
format( btime_str, 19, "%d/%d/%d/%d", |
3540 |
SQL_ReadResult( query, 6 ),\ |
SQL_ReadResult( query, 6 ), |
3541 |
SQL_ReadResult( query, 2 ),\ |
SQL_ReadResult( query, 2 ), |
3542 |
SQL_ReadResult( query, 3 ),\ |
SQL_ReadResult( query, 3 ), |
3543 |
SQL_ReadResult( query, 5 ) ) |
SQL_ReadResult( query, 5 ) |
3544 |
|
) |
3545 |
sb_add_tabs( btime_str, 19 ) |
sb_add_tabs( btime_str, 19 ) |
3546 |
|
|
3547 |
|
new Float:fTmp |
3548 |
|
SQL_ReadResult( query, 1, fTmp ) |
3549 |
|
|
3550 |
formatex( line, 150,\ |
formatex( line, 150,\ |
3551 |
"%s%d %s%s %s %d%s", |
"%s%d %s%s %s %d%s", |
3552 |
i % 2 ? "" : "<div>", |
i % 2 ? NULLSTR : "<div>", |
3553 |
i, htmlspecialchars( name ), |
i, htmlspecialchars( name ), |
3554 |
parsetime( SQL_ReadResult( query, 1 ) ), |
parsetime( floatround( fTmp * 10 ) ), |
3555 |
btime_str, |
btime_str, |
3556 |
SQL_ReadResult( query, 4 ), |
SQL_ReadResult( query, 4 ), |
3557 |
i % 2 ? "" : "</div>" ) |
i % 2 ? NULLSTR : "</div>" ) |
3558 |
written_len += strlen( line ) |
written_len += strlen( line ) |
3559 |
if( written_len > 1263 ) break |
if( written_len > 1263 ) break |
3560 |
fprintf( fh, line ) |
fprintf( fh, line ) |
3586 |
{ |
{ |
3587 |
id2=players[i] |
id2=players[i] |
3588 |
get_user_name(id2,name,20) |
get_user_name(id2,name,20) |
3589 |
console_print(id,"# %d, %s",timer[id2-1][TMR_DBUSER],name) |
console_print(id,"# %d, %s",timer[id2][TMR_DBUSER],name) |
3590 |
} |
} |
3591 |
console_print( id, "%d Players", count ) |
console_print( id, "%d Players", count ) |
3592 |
} |
} |
3604 |
new query[501], data[1] |
new query[501], data[1] |
3605 |
data[0]=id |
data[0]=id |
3606 |
|
|
|
/*formatex( query, 500, |
|
|
"select p.alias, s.score_id, s.fin_time, s.cps, s.gcs, s.boosts, s.wpns from %sscores s, %splayers p where s.map_name=^"%s^" and p.user_id=s.user_id order by s.score, s.fin_time limit 20;", |
|
|
DB_PREFIX, DB_PREFIX, mapname)*/ |
|
3607 |
formatex( query, 500, |
formatex( query, 500, |
3608 |
"select distinct p.alias, s.score_id, s.fin_time, s.cps, s.gcs, s.boosts, s.wpns from %sscores s join %splayers p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt from %sscores where map_name=^"%s^" group by user_id, wpns) g on p.user_id=g.user_id where map_name=^"%s^" and s.score=g.minscore order by s.score limit 20", |
"select distinct p.alias, s.score_id, s.fin_time, s.cps, s.gcs, s.boosts, s.wpns from %sscores s join %splayers p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt from %sscores where map_name=^"%s^" group by user_id, wpns) g on p.user_id=g.user_id where map_name=^"%s^" and s.score=g.minscore order by s.score limit 20", |
3609 |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |