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. |
135 |
-: Plugin ad on client connect. |
-: Plugin ad on client connect. |
136 |
-: WebMod support since it is a huge security vulnerability. |
-: WebMod support since it is a huge security vulnerability. |
137 |
-: Cvars: climb_webmod, climb_stats_path, climb_stats_url, ip_internal, ip_external |
-: Cvars: climb_webmod, climb_stats_path, climb_stats_url, ip_internal, ip_external |
138 |
c: Tweaked semiclip to hopefully eliminate lag problems reported by some people. |
//c: Tweaked semiclip to hopefully eliminate lag problems reported by some people. |
139 |
|
//c: New semiclip, should be flawless now. |
140 |
c: Cvar climb_water_nodraw changes take effect without reloading map. |
c: Cvar climb_water_nodraw changes take effect without reloading map. |
141 |
c: Database now stores multiple records per map per player. |
c: Database now stores multiple records per map per player. |
142 |
c: Cvar climb_db_pass is now protected. |
c: Cvar climb_db_pass is now protected. |
269 |
#include <cstrike> |
#include <cstrike> |
270 |
#include <cstrike2> |
#include <cstrike2> |
271 |
|
|
272 |
new const VERSION[ ] = "a3.7.1 Nov 18 06:22 MST" |
new const VERSION[ ] = "a3.7.7 Feb 23 18:32 MST" |
273 |
new const TRKCVAR[ ] = "climb_version" |
new const TRKCVAR[ ] = "climb_version" |
274 |
|
|
275 |
new const DONOTHING[ ] = "donothing" |
new const DONOTHING[ ] = "donothing" |
276 |
new const NULLSTR[ ] = "" |
new const NULLSTR[ ] = "" |
277 |
|
|
300 |
#define ORIGINS_SIZE 48 |
#define ORIGINS_SIZE 48 |
301 |
new Float:origins[33][ORIGINS_SIZE] |
new Float:origins[33][ORIGINS_SIZE] |
302 |
#define ORIG_UNGC 40 |
#define ORIG_UNGC 40 |
303 |
#define ORIG_PAUS 44 |
#define ORIG_PAUSX 44 |
304 |
//#define ORIG_X 0 |
#define ORIG_PAUSY 45 |
305 |
//#define ORIG_Y 1 |
#define ORIG_PAUSZ 46 |
306 |
//#define ORIG_Z 2 |
#define ORIG_PAUSG 47 |
307 |
#define ORIG_GRAV 3 |
#define ORIG_GRAV 3 |
308 |
|
|
309 |
new time_stamps[33][5]//time_stamps[id][x] |
new time_stamps[33][5]//time_stamps[id][x] |
313 |
#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 |
314 |
#define TS_KNIFE 4 |
#define TS_KNIFE 4 |
315 |
|
|
316 |
#define TIMER_SIZE 16 |
#define TIMER_SIZE 15 |
317 |
new timer[33][TIMER_SIZE]//timer[id][x]: |
new timer[33][TIMER_SIZE]//timer[id][x]: |
318 |
#define TMR_CFLAGS 0 //Status |
#define TMR_CFLAGS 0 //Status |
319 |
#define TMR_STARTD 1 //Start Time |
#define TMR_CNTTME 1 //Time / in deciseconds |
320 |
#define TMR_FINISH 2 //Finish Time |
#define TMR_CNTCPS 2 //CP Count |
321 |
#define TMR_CNTCPS 3 //CP Count |
#define TMR_CNTGCS 3 //GC Count |
322 |
#define TMR_CNTGCS 4 //GC Count |
#define TMR_CNTBST 4 //Boosts |
323 |
#define TMR_CNTBST 5 //Boosts |
#define TMR_BSTTME 5 //Best Time / in deciseconds |
324 |
#define TMR_BSTTME 6 //Best Time |
#define TMR_BSTCPS 6 //Best CP |
325 |
#define TMR_BSTCPS 7 //Best CP |
#define TMR_BSTGCS 7 //Best GC |
326 |
#define TMR_BSTGCS 8 //Best GC |
#define TMR_BSTBST 8 //Number of boosts used |
327 |
#define TMR_BSTBST 9 //Number of boosts used |
#define TMR_SESFIN 9 //Finished this session |
328 |
#define TMR_SESFIN 10 //Finished this session |
#define TMR_MAPFIN 10 //Total times finished this map |
329 |
#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 |
330 |
#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 |
331 |
#define TMR_CPPOS 13 //Current CP offset, for cycling back and forward through cps |
#define TMR_CNTWPN 13 //Current weapon rank modifier |
332 |
#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 |
|
333 |
|
|
334 |
//Temp save vars |
//Temp save vars |
335 |
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] |
344 |
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 |
345 |
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] |
346 |
|
|
347 |
new bool:sclip[33],Float:post_think_vel[33][3],sc_fcount |
new Float:post_think_vel[33][3] |
348 |
|
|
349 |
new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD |
new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD |
350 |
|
|
|
//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[33], bool:bhop_fail[33] |
|
|
//func_doors[x]{ id, speed, angles } |
|
|
|
|
351 |
//Cvar Pointers |
//Cvar Pointers |
352 |
new p_climb, p_auto, p_boost, p_cpprice, p_startmoney |
new p_climb, p_auto, p_boost, p_cpprice, p_startmoney |
353 |
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 |
366 |
#define TSK_AUTORSPN 100 //100+: Auto Respawn |
#define TSK_AUTORSPN 100 //100+: Auto Respawn |
367 |
//#define TSK_BOOSTTMR 150 //150+: Solid Boost Timer |
//#define TSK_BOOSTTMR 150 //150+: Solid Boost Timer |
368 |
#define TSK_FLIGHT 200 |
#define TSK_FLIGHT 200 |
369 |
#define TSK_BHOP 250 |
#define TSK_MEASURE2 250 |
|
#define TSK_CLEAR_FAIL 300 |
|
|
#define TSK_MEASURE2 350 |
|
370 |
|
|
371 |
//Status timer[id][TMR_CFLAGS]&=x |
//Status timer[id][TMR_CFLAGS]&=x |
372 |
#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 |
385 |
#define CF_COUNTDOWN (1<<11) |
#define CF_COUNTDOWN (1<<11) |
386 |
#define CF_SUNGLASSES (1<<12) |
#define CF_SUNGLASSES (1<<12) |
387 |
|
|
388 |
new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE |
#define SILENT 1 |
389 |
|
|
390 |
|
//Boost Flags for climb_boost CVAR |
391 |
|
#define SOLID 1 |
392 |
|
#define DJUMP 2 |
393 |
|
#define SJUMP 4 |
394 |
|
|
395 |
|
new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE, SVC_CLCORPSE; |
396 |
|
|
397 |
new SCORES_PATH[100], HSCORES_PATH[100] |
new SCORES_PATH[100], HSCORES_PATH[100] |
398 |
|
|
407 |
|
|
408 |
p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) |
p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) |
409 |
p_auto = register_cvar( "climb_auto", "1" ) |
p_auto = register_cvar( "climb_auto", "1" ) |
410 |
p_boost = register_cvar( "climb_boost", "1" ) |
p_boost = register_cvar( "climb_boost", "7" ) |
411 |
p_cpprice = register_cvar( "climb_cpprice", "0" ) |
p_cpprice = register_cvar( "climb_cpprice", "0" ) |
412 |
p_startmoney = register_cvar( "climb_startmoney", "1337" ) |
p_startmoney = register_cvar( "climb_startmoney", "1337" ) |
413 |
|
|
421 |
register_cvar( "climb_db_serverid", NULLSTR ) |
register_cvar( "climb_db_serverid", NULLSTR ) |
422 |
register_cvar( "climb_db_exists", "0" ) |
register_cvar( "climb_db_exists", "0" ) |
423 |
|
|
424 |
p_msg_r = register_cvar( "climb_msg_r", "0" ) |
p_msg_r = register_cvar( "climb_msg_r", "0" ); |
425 |
p_msg_g = register_cvar( "climb_msg_g", "150" ) |
p_msg_g = register_cvar( "climb_msg_g", "150" ); |
426 |
p_msg_b = register_cvar( "climb_msg_b", "250" ) |
p_msg_b = register_cvar( "climb_msg_b", "250" ); |
427 |
p_msg_x = register_cvar( "climb_msg_x", "0.05" ) |
p_msg_x = register_cvar( "climb_msg_x", "0.05" ); |
428 |
p_msg_y = register_cvar( "climb_msg_y", "0.5" ) |
p_msg_y = register_cvar( "climb_msg_y", "0.5" ); |
429 |
|
|
430 |
p_light_r = register_cvar( "climb_light_r", "255" ) |
p_light_r = register_cvar( "climb_light_r", "255" ); |
431 |
p_light_g = register_cvar( "climb_light_g", "255" ) |
p_light_g = register_cvar( "climb_light_g", "255" ); |
432 |
p_light_b = register_cvar( "climb_light_b", "255" ) |
p_light_b = register_cvar( "climb_light_b", "255" ); |
433 |
|
|
434 |
p_sounds = register_cvar( "climb_sounds", "1" ) |
p_sounds = register_cvar( "climb_sounds", "1" ); |
435 |
p_render = register_cvar( "climb_unsolid_type", "0" ) |
p_render = register_cvar( "climb_unsolid_type", "0" ); |
436 |
p_start_respawn = register_cvar( "climb_start_respawn", "0" ) |
p_start_respawn = register_cvar( "climb_start_respawn", "0" ); |
437 |
p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ) |
p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ); |
438 |
|
|
439 |
p_stats_hsurl = register_cvar( "climb_stats_hsurl", NULLSTR ) //Use %s in place of map name |
p_stats_hsurl = register_cvar( "climb_stats_hsurl", NULLSTR ); //Use %s in place of map name |
440 |
p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR ) |
p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR ); |
441 |
|
|
442 |
p_allow_spectators = get_cvar_pointer( "allow_spectators" ) |
p_allow_spectators = get_cvar_pointer( "allow_spectators" ); |
443 |
p_teambalance = get_cvar_pointer( "mp_autoteambalance" ) |
p_teambalance = get_cvar_pointer( "mp_autoteambalance" ); |
444 |
p_limitteams = get_cvar_pointer( "mp_limitteams" ) |
p_limitteams = get_cvar_pointer( "mp_limitteams" ); |
445 |
|
|
446 |
MAXPLAYERS = get_maxplayers( ) |
MAXPLAYERS = get_maxplayers( ); |
447 |
|
|
448 |
TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ) |
TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ); |
449 |
LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ) |
LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ); |
450 |
|
|
451 |
//Message Pseudo-Constants |
//Message Pseudo-Constants |
452 |
SVC_STATUSICON = get_user_msgid( "StatusIcon" ) |
SVC_STATUSICON = get_user_msgid( "StatusIcon" ); |
453 |
SVC_TEAMINFO = get_user_msgid( "TeamInfo" ) |
SVC_TEAMINFO = get_user_msgid( "TeamInfo" ); |
454 |
SVC_ROUNDTIME = get_user_msgid( "RoundTime" ) |
SVC_ROUNDTIME = get_user_msgid( "RoundTime" ); |
455 |
SVC_FLASHLIGHT = get_user_msgid( "Flashlight" ) |
SVC_FLASHLIGHT = get_user_msgid( "Flashlight" ); |
456 |
SVC_SCREENFADE = get_user_msgid( "ScreenFade" ) |
SVC_SCREENFADE = get_user_msgid( "ScreenFade" ); |
457 |
|
SVC_CLCORPSE = get_user_msgid( "ClCorpse" ); |
458 |
|
|
459 |
//These commands get blocked always. |
//These commands get blocked always. |
460 |
register_clcmd( "fullupdate", "block_cmd2" ) |
register_clcmd( "fullupdate", "block_cmd2" ); |
461 |
|
|
462 |
//These commands get blocked when climb is enabled. |
//These commands get blocked when climb is enabled. |
463 |
register_clcmd( "chooseteam", "spectate" ) |
register_clcmd( "chooseteam", "spectate" ); |
464 |
register_clcmd( "buy", "block_cmd" ) |
register_clcmd( "buy", "block_cmd" ); |
465 |
register_clcmd( "buyammo1", "block_cmd" ) |
register_clcmd( "buyammo1", "block_cmd" ); |
466 |
register_clcmd( "buyammo2", "block_cmd" ) |
register_clcmd( "buyammo2", "block_cmd" ); |
467 |
register_clcmd( "buyequip", "block_cmd" ) |
register_clcmd( "buyequip", "block_cmd" ); |
468 |
|
|
469 |
register_clcmd( "jointeam", "block_jointeam" ) |
register_clcmd( "jointeam", "block_jointeam" ); |
470 |
|
|
471 |
//Commands to detect cheats. |
//Commands to detect cheats. |
472 |
register_clcmd( "+hook", "phook" ) |
register_clcmd( "+hook", "phook" ); |
473 |
register_clcmd( "+rope", "phook" ) |
register_clcmd( "+rope", "phook" ); |
474 |
register_clcmd( "-hook", "mhook" ) |
register_clcmd( "-hook", "mhook" ); |
475 |
register_clcmd( "-rope", "mhook" ) |
register_clcmd( "-rope", "mhook" ); |
476 |
|
|
477 |
//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. |
478 |
register_clcmd( "say help", "help_msg" ) |
register_clcmd( "say help", "help_msg" ) |
526 |
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. |
527 |
set_task( 1.0, "spec_update", _, _, _, "b" ) //Task to update spectator array |
set_task( 1.0, "spec_update", _, _, _, "b" ) //Task to update spectator array |
528 |
set_task( 5.0, "run_tasks", _, _, _, "b" ) |
set_task( 5.0, "run_tasks", _, _, _, "b" ) |
529 |
|
set_task( 0.1, "timer_tick", _, _, _, "b" ) |
530 |
|
|
531 |
register_message( get_user_msgid( "CurWeapon" ), "CurWeapon" ) |
register_message( get_user_msgid( "CurWeapon" ), "CurWeapon" ) |
532 |
|
|
549 |
if( file_exists( ini ) ) |
if( file_exists( ini ) ) |
550 |
{ |
{ |
551 |
new line = 0, text[50], len |
new line = 0, text[50], len |
552 |
while( read_file( ini, line++, text, sizeof(text)-1 , len ) ) |
while( read_file( ini, line++, text, 49 , len ) ) |
553 |
{ |
{ |
554 |
if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) ) |
if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) ) |
555 |
{ |
{ |
581 |
} |
} |
582 |
} |
} |
583 |
|
|
|
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 |
|
|
} |
|
|
|
|
584 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
585 |
} |
} |
586 |
|
|
588 |
{ |
{ |
589 |
new ent, ent2, tmpstr[33], Float:tmpflt |
new ent, ent2, tmpstr[33], Float:tmpflt |
590 |
|
|
|
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 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
591 |
//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 |
592 |
ent = find_ent_by_class( -1, "func_button" ) |
ent = find_ent_by_class( -1, "func_button" ) |
593 |
while( ent > 0 ) |
while( ent > 0 ) |
674 |
} |
} |
675 |
} |
} |
676 |
|
|
|
//If Cvar set, set func_water ents to no draw, helps many peoples FPS |
|
|
if( get_pcvar_num( p_water_nodraw ) ) |
|
|
{ |
|
|
ent = find_ent_by_class( -1, "func_water" ) |
|
|
while( ent > 0 ) |
|
|
{ |
|
|
set_entity_visibility( ent, 0 ) |
|
|
ent=find_ent_by_class( ent, "func_water" ) |
|
|
} |
|
|
} |
|
|
|
|
677 |
//Remove map built in start button sounds |
//Remove map built in start button sounds |
678 |
ent = find_ent_by_class( -1, "ambient_generic" ) |
ent = find_ent_by_class( -1, "ambient_generic" ) |
679 |
while( ent > 0 ) |
while( ent > 0 ) |
915 |
|
|
916 |
//Do gocheck |
//Do gocheck |
917 |
new cppos = timer[id][TMR_CPPOS] * 4 |
new cppos = timer[id][TMR_CPPOS] * 4 |
918 |
for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i] |
coords[0] = origins[id][cppos] |
919 |
|
coords[1] = origins[id][cppos + 1] |
920 |
|
coords[2] = origins[id][cppos + 2] |
921 |
entity_set_float( id, EV_FL_gravity, origins[id][3] ) |
entity_set_float( id, EV_FL_gravity, origins[id][3] ) |
922 |
teleport( id, coords ) |
teleport( id, coords ) |
923 |
|
|
1034 |
if( cflags_old & CF_PAUSE ) //unpause |
if( cflags_old & CF_PAUSE ) //unpause |
1035 |
{ |
{ |
1036 |
cflags_new += CF_START |
cflags_new += CF_START |
|
timer[id][TMR_STARTD] = get_systime() - timer[id][TMR_STARTD] |
|
1037 |
set_entity_flags( id, FL_FROZEN, 0 ) |
set_entity_flags( id, FL_FROZEN, 0 ) |
1038 |
unsolid( id ) |
//set_solid( id, 0 ); |
1039 |
entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] ) |
entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUSG] ) |
1040 |
clmsg( id, "UNPAUSED" ) |
clmsg( id, "UNPAUSED" ) |
1041 |
sfexec( id, 2 ) |
sfexec( id, 2 ) |
1042 |
} |
} |
1043 |
else if( cflags_old & CF_START ) //pause |
else if( cflags_old & CF_START ) //pause |
1044 |
{ |
{ |
|
timer[id][TMR_STARTD] = get_systime() - timer[id][TMR_STARTD] |
|
1045 |
cl_pause( id ) |
cl_pause( id ) |
1046 |
cflags_new += CF_PAUSE |
cflags_new += CF_PAUSE |
1047 |
} |
} |
1060 |
{ |
{ |
1061 |
if( is_climber_alive( id ) ) |
if( is_climber_alive( id ) ) |
1062 |
{ |
{ |
1063 |
unsolid( id ) |
set_solid( id, 0 ); |
1064 |
set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 ) |
set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 ) |
1065 |
|
//set_pev( id, pev_flags, pev( id, pev_flags ) & FL_FROZEN ) |
1066 |
set_entity_flags( id, FL_FROZEN, 1 ) |
set_entity_flags( id, FL_FROZEN, 1 ) |
1067 |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
1068 |
} |
} |
1069 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
1070 |
} |
} |
1071 |
|
|
1072 |
|
public timer_tick( ) |
1073 |
|
{ |
1074 |
|
new players[32], num, id |
1075 |
|
get_players( players, num, "ach" ) |
1076 |
|
|
1077 |
|
for( new i = 0; i < num; i++ ) |
1078 |
|
{ |
1079 |
|
id = players[i] |
1080 |
|
if( timer[id][TMR_CFLAGS] & CF_START ) |
1081 |
|
timer[id][TMR_CNTTME]++ |
1082 |
|
} |
1083 |
|
} |
1084 |
|
|
1085 |
public stop( id ) |
public stop( id ) |
1086 |
{ |
{ |
1087 |
if( get_pcvar_num( p_climb ) && timer[id][TMR_CFLAGS] & CF_START ) |
if( get_pcvar_num( p_climb ) && timer[id][TMR_CFLAGS] & CF_START ) |
1089 |
change_status( id, CF_STOP ) |
change_status( id, CF_STOP ) |
1090 |
heal(id) |
heal(id) |
1091 |
//Erase start/finish time stamps, prevents crazy number on scoreboard |
//Erase start/finish time stamps, prevents crazy number on scoreboard |
1092 |
timer[id][TMR_STARTD]=0 |
timer[id][TMR_CNTTME] = 0 |
|
timer[id][TMR_FINISH]=0 |
|
1093 |
|
|
1094 |
sfexec(id,4) //Execute commands from start/finish config |
sfexec(id,4) //Execute commands from start/finish config |
1095 |
} |
} |
1137 |
) return PLUGIN_CONTINUE |
) return PLUGIN_CONTINUE |
1138 |
|
|
1139 |
//If it's a gun, update pack and clip ammo & silencer |
//If it's a gun, update pack and clip ammo & silencer |
1140 |
new wpn_id = get_user_weapon( id ) |
new wpn_name[17] |
1141 |
|
get_weaponname( wpn, wpn_name,16 ) |
1142 |
|
new wpn_id = find_ent_by_owner( -1, wpn_name, id ) |
1143 |
if( !wpn_id ) return PLUGIN_CONTINUE |
if( !wpn_id ) return PLUGIN_CONTINUE |
1144 |
|
|
1145 |
new clip = get_msg_arg_int( 3 ) |
new clip = get_msg_arg_int( 3 ) |
1283 |
cs_user_spawn( id ) |
cs_user_spawn( id ) |
1284 |
|
|
1285 |
set_pev( id, pev_movetype, MOVETYPE_WALK ) |
set_pev( id, pev_movetype, MOVETYPE_WALK ) |
1286 |
set_pev( id, pev_solid, SOLID_BBOX ) |
set_pev( id, pev_solid, SOLID_SLIDEBOX ) |
1287 |
set_pev( id, pev_effects, 0 ) |
set_pev( id, pev_effects, 0 ) |
1288 |
set_pev( id, pev_deadflag, DEAD_NO ) |
set_pev( id, pev_deadflag, DEAD_NO ) |
1289 |
set_pev( id, pev_takedamage, DAMAGE_AIM ) |
set_pev( id, pev_takedamage, DAMAGE_AIM ) |
1300 |
|
|
1301 |
public ResetHUD( id ) |
public ResetHUD( id ) |
1302 |
{//Spawned |
{//Spawned |
1303 |
if( get_pcvar_num( p_climb ) ) |
if( !get_pcvar_num( p_climb ) ) |
|
{ |
|
|
if( !is_user_bot( id ) && !is_user_hltv( id ) ) |
|
1304 |
{ |
{ |
1305 |
flight_icons( id )//redraw flashlight hud icons |
set_msg_block( SVC_STATUSICON, BLOCK_NOT ); |
1306 |
set_msg_block( SVC_STATUSICON, 2 )//Block buy menu |
set_msg_block( SVC_CLCORPSE, BLOCK_NOT ); |
1307 |
|
return; |
1308 |
|
} |
1309 |
|
|
1310 |
|
if( is_user_bot( id ) || is_user_hltv( id ) ) return; |
1311 |
|
|
1312 |
|
flight_icons( id ); //redraw flashlight hud icons |
1313 |
|
set_msg_block( SVC_STATUSICON, BLOCK_SET ); //Block buy menu |
1314 |
|
set_msg_block( SVC_CLCORPSE, BLOCK_SET ); //block client corpses |
1315 |
|
|
1316 |
|
flight_icons( id ); //redraw flashlight hud icons |
1317 |
|
|
1318 |
if( is_climber_alive( id ) ) |
if( is_climber_alive( id ) ) |
1319 |
{ |
{ |
1320 |
//set_pev( id, pev_movetype, MOVETYPE_WALK ) |
heal( id ); |
|
//cs_set_user_team( id, 2 ) |
|
1321 |
|
|
1322 |
heal( id ) |
//Execute commands from start/finish config |
1323 |
sfexec( id, 1 )//Execute commands from start/finish config |
sfexec( id, 1 ); |
1324 |
if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard. |
|
1325 |
|
//Show admin as VIP on Scoreboard. |
1326 |
|
if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 ); |
1327 |
|
|
1328 |
|
new cppos = timer[id][TMR_CPPOS] * 4; |
1329 |
|
|
1330 |
|
//If they are paused tp to pause spot and freeze them again. |
1331 |
if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
1332 |
{//If they are paused tp to pause spot and freeze them again. |
{ |
1333 |
new Float:coords[3] |
new Float:coords[3]; |
1334 |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
coords[0] = origins[ id ][ ORIG_PAUSX ]; |
1335 |
teleport( id, coords ) |
coords[1] = origins[ id ][ ORIG_PAUSY ]; |
1336 |
cl_pause( id ) |
coords[2] = origins[ id ][ ORIG_PAUSZ ]; |
1337 |
|
teleport( id, coords ); |
1338 |
|
cl_pause( id ); |
1339 |
} |
} |
|
|
|
1340 |
//Teleport to cp, start, or primary spawn position |
//Teleport to cp, start, or primary spawn position |
1341 |
else if( origins[ id - 1 ][ 0 ] || origins[ id - 1][ 1 ] || origins[ id - 1 ][ 2 ]) gocheck( id ) |
else if( origins[ id ][ cppos ] || origins[ id ][ cppos+1 ] || origins[ id ][ cppos+2 ] ) gocheck( id ); |
1342 |
else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig ) |
else teleport( id, start_tp_orig ); |
1343 |
} |
//else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig ); //no need to tp to spawn_tp_orig, they're already there |
1344 |
} |
} |
1345 |
sortcssb( ) |
sortcssb( ) |
1346 |
} |
} |
|
else set_msg_block( SVC_STATUSICON, 0 ) |
|
|
} |
|
1347 |
|
|
1348 |
public run_tasks( ) |
public run_tasks( ) |
1349 |
{ |
{ |
1353 |
|
|
1354 |
public updatebot( ) |
public updatebot( ) |
1355 |
{ |
{ |
1356 |
if(get_pcvar_num(p_climb)) |
if( !get_pcvar_num(p_climb) ) return |
1357 |
{ |
|
|
//new players[32], cl |
|
|
//get_players( players, cl, "ach" ) |
|
1358 |
new id = find_player( "i" ) |
new id = find_player( "i" ) |
|
//if(0<cl<3&&!id){ |
|
1359 |
new cl = get_playersnum( ) |
new cl = get_playersnum( ) |
1360 |
if( cl < MAXPLAYERS - 2 && !id ) |
if( cl < MAXPLAYERS - 2 && !id ) |
1361 |
{ |
{ |
1392 |
cs_user_spawn( id ) |
cs_user_spawn( id ) |
1393 |
} |
} |
1394 |
} |
} |
|
//else if(cl>2&&id)server_cmd("kick #%d",get_user_userid(id)) |
|
1395 |
else if( cl == MAXPLAYERS - 1 && id ) |
else if( cl == MAXPLAYERS - 1 && id ) |
1396 |
{ |
{ |
1397 |
set_entity_visibility( id, 1 ) |
set_entity_visibility( id, 1 ) |
1398 |
server_cmd( "kick #%d", get_user_userid( id ) ) |
server_cmd( "kick #%d", get_user_userid( id ) ) |
1399 |
} |
} |
1400 |
else if( is_user_bot( id ) && id ) |
else if( id ) |
1401 |
{ |
{ |
1402 |
set_entity_visibility( id, 0 ) |
set_entity_visibility( id, 0 ) |
1403 |
entity_set_int( id, EV_INT_solid, SOLID_NOT ) |
entity_set_int( id, EV_INT_solid, SOLID_NOT ) |
1406 |
call_think( id ) |
call_think( id ) |
1407 |
} |
} |
1408 |
} |
} |
|
} |
|
1409 |
|
|
1410 |
public check_cvars( ) |
public check_cvars( ) |
1411 |
{ |
{ |
1412 |
static bool:nodraw |
static bool:nodraw; |
1413 |
if( get_pcvar_num( p_water_nodraw ) && !nodraw ) |
if( get_pcvar_num( p_water_nodraw ) && !nodraw ) |
1414 |
{ |
{ |
1415 |
new ent = find_ent_by_class( -1, "func_water" ) |
new ent = find_ent_by_class( -1, "func_water" ); |
1416 |
while( ent > 0 ) |
while( ent > 0 ) |
1417 |
{ |
{ |
1418 |
set_entity_visibility( ent, 0 ) |
set_entity_visibility( ent, 0 ); |
1419 |
ent = find_ent_by_class( ent, "func_water" ) |
ent = find_ent_by_class( ent, "func_water" ); |
1420 |
} |
} |
1421 |
nodraw = true |
nodraw = true; |
1422 |
} |
} |
1423 |
else if( !get_pcvar_num( p_water_nodraw ) && nodraw ) |
else if( !get_pcvar_num( p_water_nodraw ) && nodraw ) |
1424 |
{ |
{ |
1425 |
new ent = find_ent_by_class( -1, "func_water" ) |
new ent = find_ent_by_class( -1, "func_water" ); |
1426 |
while( ent > 0 ) |
while( ent > 0 ) |
1427 |
{ |
{ |
1428 |
set_entity_visibility( ent, 1 ) |
set_entity_visibility( ent, 1 ); |
1429 |
ent = find_ent_by_class( ent, "func_water" ) |
ent = find_ent_by_class( ent, "func_water" ); |
1430 |
} |
} |
1431 |
nodraw = false |
nodraw = false; |
1432 |
} |
} |
1433 |
} |
} |
1434 |
|
|
1456 |
return dif |
return dif |
1457 |
} |
} |
1458 |
|
|
1459 |
public change_boost( id, newboost ) |
public boost_enabled( id, boost_type, silent ) |
1460 |
|
{ |
1461 |
|
if( get_pcvar_num( p_boost ) & boost_type ) return true; |
1462 |
|
if( !silent ) clmsg( id, "That boost type has been disabled by the server admin." ); |
1463 |
|
return false; |
1464 |
|
} |
1465 |
|
|
1466 |
|
stock change_boost( id, newboost, silent = 0 ) |
1467 |
{//Change Boost flags |
{//Change Boost flags |
1468 |
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; |
1469 |
|
if( !isalive( id ) || !notpaused( id ) ) return; |
1470 |
|
|
1471 |
new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ] |
new msg[151], rmflag, cflags = timer[ id ][ TMR_CFLAGS ]; |
1472 |
if( cflags & CF_SOLID ) |
if( cflags & CF_SOLID ) |
1473 |
{ |
{ |
1474 |
if( task_exists( 150 + id ) ) remove_task( 150 + id ) |
if( task_exists( 150 + id ) ) remove_task( 150 + id ); |
1475 |
rmflag = CF_SOLID |
rmflag = CF_SOLID; |
1476 |
msg = "Solid Boost Disabled.^n" |
msg = "Solid Boost Disabled.^n"; |
1477 |
} |
} |
1478 |
else if( cflags & CF_SUPER_JUMP ) |
else if( cflags & CF_SUPER_JUMP ) |
1479 |
{ |
{ |
1480 |
rmflag = CF_SUPER_JUMP |
rmflag = CF_SUPER_JUMP; |
1481 |
msg = "Super Jump Disabled.^n" |
msg = "Super Jump Disabled.^n"; |
1482 |
} |
} |
1483 |
else if( cflags & CF_DOUBLE_JUMP) |
else if( cflags & CF_DOUBLE_JUMP) |
1484 |
{ |
{ |
1485 |
rmflag = CF_DOUBLE_JUMP |
rmflag = CF_DOUBLE_JUMP; |
1486 |
msg = "Double Jump Disabled.^n" |
msg = "Double Jump Disabled.^n"; |
|
} |
|
|
if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag |
|
|
if( !( rmflag & newboost ) && \ |
|
|
!check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? get_climber_time( id ) : get_systime() ) ) ) |
|
|
{ |
|
|
if( newboost == CF_SOLID ) |
|
|
{ |
|
|
format( msg, 150, "%sSolid Boost Enabled.", msg ) |
|
|
new ida[1] |
|
|
ida[0] = id |
|
|
set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 ) |
|
|
if( timer[ id - 1 ][ TMR_CFLAGS ] & CF_START ) timer[ id - 1 ][ TMR_CNTBST ]++ |
|
1487 |
} |
} |
1488 |
if( newboost == CF_SUPER_JUMP ) format( msg, 150, "%sSuper Jump Enabled.", msg ) |
if( rmflag > 0 ) timer[ id ][ TMR_CFLAGS ] -= rmflag; |
1489 |
if( newboost == CF_DOUBLE_JUMP ) format( msg, 150, "%sDouble Jump Enabled.", msg ) |
if( !( rmflag & newboost ) && |
1490 |
timer[ id - 1 ][ TMR_CFLAGS ] |= newboost |
!check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) ) |
1491 |
|
{ |
1492 |
|
if( newboost == CF_SOLID && boost_enabled( id, SOLID, silent ) ) |
1493 |
|
{ |
1494 |
|
format( msg, 150, "%sSolid Boost Enabled.", msg ); |
1495 |
|
new ida[1]; |
1496 |
|
ida[0] = id; |
1497 |
|
set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 ); |
1498 |
|
if( timer[ id ][ TMR_CFLAGS ] & CF_START ) timer[ id ][ TMR_CNTBST ]++; |
1499 |
|
} |
1500 |
|
else if( newboost == CF_SUPER_JUMP && boost_enabled( id, SJUMP, silent ) ) |
1501 |
|
format( msg, 150, "%sSuper Jump Enabled.", msg ); |
1502 |
|
else if( newboost == CF_DOUBLE_JUMP && boost_enabled( id, DJUMP, silent ) ) |
1503 |
|
format( msg, 150, "%sDouble Jump Enabled.", msg ); |
1504 |
|
else return; |
1505 |
|
timer[ id ][ TMR_CFLAGS ] += newboost; |
1506 |
} |
} |
1507 |
if(strlen(msg))clmsg(id,msg) |
clmsg( id, msg ); |
|
return PLUGIN_HANDLED |
|
1508 |
} |
} |
1509 |
|
|
1510 |
//Task to auto disable solid boost after timeout |
//Task to auto disable solid boost after timeout |
1511 |
public solid_boost_timer( ida[] ) |
public solid_boost_timer( ida[] ) |
1512 |
change_boost( ida[0], CF_SOLID ) |
change_boost( ida[0], CF_SOLID ) |
1513 |
|
|
1514 |
/*public server_frame( ) |
//Semi-clip |
1515 |
{//Semi-clip |
public server_frame( ) |
|
if( get_pcvar_num( p_climb ) ) |
|
1516 |
{ |
{ |
1517 |
new players[32], bool:skip[32], num, i, j |
if( !get_pcvar_num( p_climb ) ) return FMRES_IGNORED |
1518 |
new Float:orig_i[3], Float:orig_j[3] |
|
1519 |
new Float:vel_i[3], Float:vel_iz[3] |
new players[32], num, i, j, Float:c1[3], Float:c2[3]; |
1520 |
new id_i, id_j, cflags_i, cflags_j |
new Float:c1z[3], Float:c2z[3]; |
1521 |
get_players( players, num, "ac" ) |
new id_i, id_j, cflags_i, cflags_j; |
1522 |
|
get_players( players, num, "ach" ); |
1523 |
|
|
1524 |
|
//new Float:c1d[3],Float:c2d[3],xyadd,zadd |
1525 |
for( i = 0; i < num; i++ ) |
for( i = 0; i < num; i++ ) |
1526 |
{ |
{ |
1527 |
id_i = players[i] |
id_i = players[ i ]; |
1528 |
cflags_i = timer[id_i][TMR_CFLAGS] |
cflags_i = timer[id_i][TMR_CFLAGS]; |
|
|
|
1529 |
if( !( cflags_i & CF_PAUSE ) ) |
if( !( cflags_i & CF_PAUSE ) ) |
1530 |
{ |
{ |
1531 |
entity_get_vector( id_i, EV_VEC_origin, orig_i ) |
//Auto Semiclip |
1532 |
entity_get_vector( id_i, EV_VEC_velocity, vel_i ) |
entity_get_vector( id_i, EV_VEC_origin, c1 ); |
|
|
|
|
vel_iz[0] = vel_i[0] > 0 ? -70.0 : 70.0 |
|
|
vel_iz[1] = vel_i[1] > 0 ? -70.0 : 70.0 |
|
|
vel_iz[2] = vel_i[2] > 0 ? -120.0 : 120.0 |
|
|
|
|
|
if( !vel_i[0] ) vel_i[0] = vel_iz[0] * -1 |
|
|
if( !vel_i[1] ) vel_i[1] = vel_iz[1] * -1 |
|
|
if( !vel_i[2] ) vel_i[2] = vel_iz[2] * -1 |
|
1533 |
|
|
1534 |
|
c1z[2] = c1[2]; |
1535 |
|
c1[2] = 0.0; |
1536 |
for( j=0; j<num; j++ ) |
for( j=0; j<num; j++ ) |
1537 |
{ |
{ |
1538 |
if( i != j ) |
id_j = players[j]; |
1539 |
|
cflags_j = timer[id_j][TMR_CFLAGS]; |
1540 |
|
if( !( cflags_j & CF_SOLID ) && i != j ) |
1541 |
{ |
{ |
1542 |
id_j = players[j] |
entity_get_vector( id_j, EV_VEC_origin, c2 ); |
|
cflags_j = timer[id_j][TMR_CFLAGS] |
|
1543 |
|
|
1544 |
if( ( !( cflags_i & CF_SOLID && cflags_j & CF_SOLID ) || skip[i] ) && !( cflags_j & CF_PAUSE ) ) |
c2z[2] = c2[2]; |
1545 |
|
c2[2] = 0.0; |
1546 |
|
if( vector_distance( c1, c2 ) < 90 && vector_distance( c1z, c2z ) < 110) |
1547 |
{ |
{ |
1548 |
entity_get_vector( id_j, EV_VEC_origin, orig_j ) |
if( !(cflags_i & CF_SOLID && cflags_j & CF_SOLID ) ) |
|
|
|
|
if( is_between_f( orig_j[0], orig_i[0] + vel_iz[0], orig_i[0] + vel_i[0] ) && |
|
|
is_between_f( orig_j[1], orig_i[1] + vel_iz[1], orig_i[1] + vel_i[1] ) && |
|
|
is_between_f( orig_j[2], orig_i[2] + vel_iz[2], orig_i[2] + vel_i[2] ) ) |
|
1549 |
{ |
{ |
1550 |
unsolid( id_i ) |
set_solid( id_i, 0 ); |
1551 |
unsolid( id_j ) |
set_solid( id_j, 0 ); |
1552 |
skip[i] = true |
j = num; |
|
skip[j] = true |
|
|
//maybe reset j first time i runs this, to unsolid anyone they might be boosting with |
|
|
} |
|
1553 |
} |
} |
1554 |
} |
} |
1555 |
} |
} |
1556 |
if( !skip[i] ) solid( id_i ) |
if( j + 1 == num ) set_solid( id_i ); |
1557 |
} |
} |
|
} |
|
|
} |
|
|
return PLUGIN_CONTINUE |
|
|
}*/ |
|
|
public server_frame( ) |
|
|
{ |
|
|
if( !get_pcvar_num(p_climb) ) |
|
|
return PLUGIN_CONTINUE |
|
1558 |
|
|
|
sc_fcount++ |
|
|
if( sc_fcount > 9 ) sc_fcount = 0 |
|
1559 |
|
|
1560 |
//Semi-clip |
//Semiclip touch detection |
1561 |
new players[32],num,i,j,Float:c1[3],Float:c2[3] |
if( pev( id_i, pev_solid ) == SOLID_NOT ) |
1562 |
new Float:c1z[3],Float:c2z[3] |
{ |
1563 |
new id_i,id_j,cflags_i,cflags_j |
new class[9], ptr, Float:v_orig[3]; |
1564 |
get_players(players,num,"ac") |
pev( id_i, pev_origin, v_orig ); |
1565 |
//new Float:c1d[3],Float:c2d[3],xyadd,zadd |
//v_orig[2] -= 18; |
1566 |
for(i=0;i<num;i++){ |
v_orig[2] -= 10; |
1567 |
id_i=players[i] |
|
1568 |
cflags_i=timer[id_i][TMR_CFLAGS] |
new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, v_orig, 16.0 ); |
1569 |
if(!(cflags_i&CF_PAUSE)){ |
while( ent > MAXPLAYERS ) |
1570 |
//solid(players[i]) |
{ |
1571 |
entity_get_vector(id_i,EV_VEC_origin,c1) |
pev( ent, pev_classname, ptr, class, 8 ); |
1572 |
//entity_get_vector(players[i],EV_VEC_velocity,c1d) |
//trigger_teleport, trigger_once, trigger_multiple, trigger_gravity, trigger_push, trigger_hurt, func_door |
1573 |
c1z[2]=c1[2] |
//if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) && !equal( class, "func_water" ) ) |
1574 |
c1[2]=0.0 |
if( equal( class, "trigger_teleport" ) || equal( class, "trigger_hurt" ) || |
1575 |
for(j=0;j<num;j++){ |
equal( class, "trigger_once" ) || equal( class, "trigger_multiple" ) || |
1576 |
id_j=players[j] |
equal( class, "trigger_gravity" ) || equal( class, "trigger_push" ) || |
1577 |
cflags_j=timer[id_j][TMR_CFLAGS] |
equal( class, "func_door" ) ) |
1578 |
if(!(cflags_j&CF_SOLID)&&i!=j){ |
{ |
1579 |
entity_get_vector(id_j,EV_VEC_origin,c2) |
dllfunc( DLLFunc_Touch, ent, id_i ); |
1580 |
//entity_get_vector(players[j],EV_VEC_velocity,c2d) |
//break; |
|
c2z[2]=c2[2] |
|
|
c2[2]=0.0 |
|
|
if(vector_distance(c1,c2)<90&&vector_distance(c1z,c2z)<110){ |
|
|
if(!(cflags_i&CF_SOLID&&cflags_j&CF_SOLID)){//&&vector_distance(c1,c2)>25&&vector_distance(c1z,c2z)>30)){ |
|
|
unsolid(id_i) |
|
|
unsolid(id_j) |
|
|
j=num |
|
|
} |
|
1581 |
} |
} |
1582 |
|
ent = engfunc( EngFunc_FindEntityInSphere, ent, v_orig, 16.0 ); |
1583 |
} |
} |
1584 |
if(j+1==num)solid(id_i) |
|
1585 |
} |
} |
1586 |
} |
} |
1587 |
} |
} |
1588 |
return PLUGIN_CONTINUE |
|
1589 |
|
return FMRES_IGNORED |
1590 |
} |
} |
1591 |
|
|
1592 |
stock bool:is_between_f( Float:mid, Float:a, Float:b ) |
stock bool:is_between_f( Float:mid, Float:a, Float:b ) |
1611 |
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 ) ) |
1612 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1613 |
|
|
1614 |
if( sclip[id] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX ) |
/* |
1615 |
|
//Auto Semiclip |
1616 |
|
new Float:vOrig[3], ent, count, Float:range |
1617 |
|
|
1618 |
|
range = pev( id, pev_speed ) * 0.5 + 50.0 |
1619 |
|
|
1620 |
|
pev( id, pev_origin, vOrig ) |
1621 |
|
|
1622 |
|
//if( !( timer[ id ][ TMR_CFLAGS ] & CF_SOLID ) ) |
1623 |
|
//{ |
1624 |
|
ent = engfunc( EngFunc_FindEntityInSphere, -1, vOrig, range ) |
1625 |
|
while( ent <= MAXPLAYERS ) |
1626 |
|
{ |
1627 |
|
if( ent != id ) |
1628 |
|
{ |
1629 |
|
set_solid( ent, 0 ) |
1630 |
|
count++ |
1631 |
|
} |
1632 |
|
ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, range ) |
1633 |
|
} |
1634 |
|
//} |
1635 |
|
if( count ) set_solid( id, 0 ) |
1636 |
|
else set_solid( id ) |
1637 |
|
|
1638 |
|
|
1639 |
|
//Semiclip touch detection |
1640 |
|
if( pev( id, pev_solid ) == SOLID_NOT ) |
1641 |
|
{ |
1642 |
|
new class[9], ptr |
1643 |
|
//pev( id, pev_origin, vOrig ) |
1644 |
|
|
1645 |
|
new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, vOrig, 17.0 ) |
1646 |
|
while( ent > 0 ) |
1647 |
|
{ |
1648 |
|
pev( ent, pev_classname, ptr, class, 8 ) |
1649 |
|
if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) ) |
1650 |
|
dllfunc( DLLFunc_Touch, ent, id ) |
1651 |
|
ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, 17.0 ) |
1652 |
|
} |
1653 |
|
|
1654 |
|
} |
1655 |
|
*/ |
1656 |
|
|
1657 |
//Detect button use. Replicated from HL SDK |
//Detect button use. Replicated from HL SDK |
1658 |
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 ) ) |
1737 |
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) ) |
1738 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1739 |
|
|
|
if( sclip[id] ) entity_set_int( id, EV_INT_solid, SOLID_NOT ) |
|
|
|
|
1740 |
if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) ) |
if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) ) |
1741 |
{ |
{ |
1742 |
entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] ) |
entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] ) |
1754 |
{ |
{ |
1755 |
new Float:coords[3] |
new Float:coords[3] |
1756 |
entity_get_vector( id, EV_VEC_origin, coords ) |
entity_get_vector( id, EV_VEC_origin, coords ) |
1757 |
for( new i=0; i<3; i++ ) origins[id][ORIG_PAUS+i] = coords[i] |
|
1758 |
origins[id][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity ) |
origins[id][ORIG_PAUSX] = coords[0] |
1759 |
|
origins[id][ORIG_PAUSY] = coords[1] |
1760 |
|
origins[id][ORIG_PAUSZ] = coords[2] |
1761 |
|
origins[id][ORIG_PAUSG] = entity_get_float( id, EV_FL_gravity ) |
1762 |
} |
} |
1763 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
1764 |
} |
} |
1784 |
|
|
1785 |
//new cflags = timer[id][TMR_CFLAGS] |
//new cflags = timer[id][TMR_CFLAGS] |
1786 |
|
|
1787 |
if( btn_type == 1 )//Start Button |
if( btn_type == 1 && !check_timeout( id, time_stamps[id][TS_SPAWN], SPAWN_TIMEOUT ) )//Start Button |
1788 |
{ |
{ |
1789 |
new Float:orig[3], bool:need_respawn = true //Float:view[3] |
new Float:orig[3], bool:need_respawn = true //Float:view[3] |
1790 |
if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false |
if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false |
1792 |
for( new i = 0; i < 48; i++ ) origins[id][i] = 0.0 //Erase checkpoints |
for( new i = 0; i < 48; i++ ) origins[id][i] = 0.0 //Erase checkpoints |
1793 |
|
|
1794 |
//Set all associated variables |
//Set all associated variables |
1795 |
timer[id][TMR_STARTD] = get_systime() |
timer[id][TMR_CNTTME] = 0 |
|
change_status(id,CF_START) |
|
1796 |
timer[id][TMR_CNTCPS] = 0 |
timer[id][TMR_CNTCPS] = 0 |
1797 |
timer[id][TMR_CNTGCS] = 0 |
timer[id][TMR_CNTGCS] = 0 |
1798 |
timer[id][TMR_CNTBST] = 0 |
timer[id][TMR_CNTBST] = 0 |
1799 |
timer[id][TMR_CPPOS] = 0 |
timer[id][TMR_CPPOS] = 0 |
1800 |
timer[id][TMR_CNTWPN] = 0 |
timer[id][TMR_CNTWPN] = 0 |
1801 |
time_stamps[id][TS_BOOST] = BOOST_TIMEOUT |
time_stamps[id][TS_BOOST] = BOOST_TIMEOUT |
1802 |
|
change_status(id,CF_START) |
1803 |
|
|
1804 |
if( timer[id][TMR_CFLAGS] & CF_COUNTDOWN ) set_countdown_time( id ) |
if( timer[id][TMR_CFLAGS] & CF_COUNTDOWN ) set_countdown_time( id ) |
1805 |
|
|
1828 |
case 2:client_cmd( id, "spk barney/c1a2_ba_climb" ) |
case 2:client_cmd( id, "spk barney/c1a2_ba_climb" ) |
1829 |
} |
} |
1830 |
|
|
1831 |
change_boost( id, CF_NULL ) //Disable Boosts |
change_boost( id, CF_NULL, SILENT ) //Disable Boosts |
1832 |
//time_stamps[id][TS_BOOST]=0 |
//time_stamps[id][TS_BOOST]=0 |
1833 |
clmsg(id,"Timer started. Go Go Go!!!") |
clmsg(id,"Timer started. Go Go Go!!!") |
1834 |
//client_print(id,print_chat,"Timer started. Go Go Go!!!") |
//client_print(id,print_chat,"Timer started. Go Go Go!!!") |
1841 |
{ |
{ |
1842 |
if( timer[id][TMR_CFLAGS] & CF_START) |
if( timer[id][TMR_CFLAGS] & CF_START) |
1843 |
{ |
{ |
1844 |
|
new cnttme = timer[id][TMR_CNTTME] / 10 |
1845 |
|
new cntbst = timer[id][TMR_CNTBST] |
1846 |
|
new cntcps = timer[id][TMR_CNTCPS] |
1847 |
|
new cntgcs = timer[id][TMR_CNTGCS] |
1848 |
|
new cntwpn = timer[id][TMR_CNTWPN] |
1849 |
|
|
1850 |
//Set client variables |
//Set client variables |
|
timer[id][TMR_FINISH] = get_systime( ) |
|
1851 |
change_status( id, CF_STOP ) |
change_status( id, CF_STOP ) |
1852 |
timer[id][TMR_SESFIN]++ |
timer[id][TMR_SESFIN]++ |
1853 |
timer[id][TMR_MAPFIN]++ |
timer[id][TMR_MAPFIN]++ |
1856 |
if( get_pcvar_num( p_sounds ) ) client_cmd( 0, "spk woop" ) |
if( get_pcvar_num( p_sounds ) ) client_cmd( 0, "spk woop" ) |
1857 |
clmsg( id, "Congratulations 1337 climber." ) |
clmsg( id, "Congratulations 1337 climber." ) |
1858 |
//client_print(id,print_chat,"Congratulations 1337 climber.") |
//client_print(id,print_chat,"Congratulations 1337 climber.") |
1859 |
new name[32], msg[21] |
new name[32], msg[23] |
1860 |
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] ) ) |
1861 |
//clmsg(id,msg) |
//clmsg(id,msg) |
1862 |
//client_print(id,print_chat,msg) |
//client_print(id,print_chat,msg) |
1863 |
|
|
1864 |
new wpn[11] |
new wpn[11] |
1865 |
get_weapon_name( timer[id][TMR_CNTWPN], wpn, 10 ) |
get_weapon_name( cntwpn, wpn, 10 ) |
1866 |
|
|
1867 |
//Announce to all |
//Announce to all |
1868 |
get_user_name( id, name, 32 ) |
get_user_name( id, name, 32 ) |
1869 |
client_print( 0, print_chat, "%s^t%s^t(%s/ %d CPS/ %d GCS/ %d Boosts)^tCompleted (%d, %d)", |
client_print( 0, print_chat, |
1870 |
name, msg, |
"%s^t%s^t(%s/ %d CPS/ %d GCS/ %d Boosts)^tCompleted (%d, %d)", |
1871 |
wpn, timer[id][TMR_CNTCPS], timer[id][TMR_CNTGCS], timer[id][TMR_CNTBST], |
name, msg, wpn, cntcps, cntgcs, cntbst, |
1872 |
timer[id][TMR_SESFIN], timer[id][TMR_MAPFIN] ) |
timer[id][TMR_SESFIN], timer[id][TMR_MAPFIN] |
1873 |
|
) |
1874 |
|
|
1875 |
|
new cntscore = ( ( ( cntbst > 0 ? 1 : 0 ) * 1000000 ) + |
1876 |
|
( ( cntcps > 0 ? 1 : 0 ) * 100000 ) + |
1877 |
|
( cntwpn * 10000 ) + |
1878 |
|
cnttme ) |
1879 |
|
|
1880 |
new cnt_score = ( ( ( timer[id][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
new bstscore = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
( ( timer[id][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
|
|
( timer[id][TMR_CNTWPN] * 10000 ) + |
|
|
get_climber_time( id ) ) |
|
|
|
|
|
new bst_score = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
1881 |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
1882 |
( timer[id][TMR_BSTWPN] * 10000 ) + |
( timer[id][TMR_BSTWPN] * 10000 ) + |
1883 |
timer[id][TMR_BSTTME] ) |
timer[id][TMR_BSTTME] / 10 ) |
1884 |
|
|
1885 |
if( cnt_score < bst_score || bst_score == 0 ) |
if( cntscore < bstscore || bstscore == 0 ) |
1886 |
{ |
{ |
1887 |
timer[id][TMR_BSTTME] = get_climber_time( id ) |
timer[id][TMR_BSTTME] = cnttme |
1888 |
timer[id][TMR_BSTCPS] = timer[id][TMR_CNTCPS] |
timer[id][TMR_BSTCPS] = cntcps |
1889 |
timer[id][TMR_BSTGCS] = timer[id][TMR_CNTGCS] |
timer[id][TMR_BSTGCS] = cntgcs |
1890 |
timer[id][TMR_BSTBST] = timer[id][TMR_CNTBST] |
timer[id][TMR_BSTBST] = cntbst |
1891 |
timer[id][TMR_BSTWPN] = timer[id][TMR_CNTWPN] |
timer[id][TMR_BSTWPN] = cntwpn |
1892 |
} |
} |
1893 |
|
|
1894 |
sfexec( id, 2 )//Execute commands from start/finish config |
sfexec( id, 2 )//Execute commands from start/finish config |
1914 |
} |
} |
1915 |
|
|
1916 |
//Execute commands from start/finish config |
//Execute commands from start/finish config |
1917 |
public sfexec(id,clevent){ |
public sfexec( id, clevent ) |
1918 |
|
{ |
1919 |
new clstat[3],cflags=timer[id][TMR_CFLAGS] |
new clstat[3],cflags=timer[id][TMR_CFLAGS] |
1920 |
/*switch(timer[id][TMR_CFLAGS]){ |
|
|
case TMR_CFLAGS_STOP: clstat="ns" |
|
|
case TMR_CFLAGS_STRT: clstat="st" |
|
|
case TMR_CFLAGS_FNSH: clstat="fn" |
|
|
}*/ |
|
1921 |
if(is_finished(id))clstat="fn" |
if(is_finished(id))clstat="fn" |
1922 |
else if(cflags&CF_STOP)clstat="ns" |
else if(cflags&CF_STOP)clstat="ns" |
1923 |
else if(cflags&CF_START)clstat="st" |
else if(cflags&CF_START)clstat="st" |
|
//else if(timer[id][TMR_CFLAGS]&CF_FINISH)clstat="fn" |
|
|
//if(equal(clstat,"ns")&&(get_user_flags(id)&VIP||timer[id][TMR_SESFIN]>0))clstat="fn" |
|
1924 |
|
|
1925 |
for(new i=0;i<sfcount;i++){ |
new cmdstat[3], cmdevent[2], cmdtype[3], cmd[60], idtype[5], name[24] |
1926 |
new cmdstat[3],cmdevent[2],cmdtype[3],cmd[60],idtype[5] |
for( new i = 0; i < sfcount; i++ ) |
1927 |
parse(sfactions[i],cmdstat,2,cmdevent,1,cmdtype,2,cmd,sizeof(cmd)-1,idtype,4) |
{ |
1928 |
if((equali(cmdstat,clstat)||equali(cmdstat,"ay"))&&str_to_num(cmdevent)&clevent){ |
parse( sfactions[i], cmdstat, 2, cmdevent, 1, cmdtype, 2, cmd, 59, idtype, 4 ) |
1929 |
if(equali(cmdtype,"sc")){ |
if( ( equali( cmdstat, clstat ) || equali( cmdstat, "ay" ) ) && str_to_num( cmdevent ) & clevent ) |
1930 |
if(equali(idtype,"uid"))format(cmd,sizeof(cmd)-1,cmd,get_user_userid(id)) |
{ |
1931 |
else{ |
if( equali( cmdtype, "sc" ) ) |
1932 |
new name[24] |
{ |
1933 |
get_user_name(id,name,sizeof(name)-1) |
if( equali( idtype, "uid" ) ) |
1934 |
format(name,sizeof(name),"^"%s^"",name) |
format( cmd, 59, cmd, get_user_userid( id ) ) |
1935 |
format(cmd,sizeof(cmd)-1,cmd,name) |
else |
1936 |
|
{ |
1937 |
|
get_user_name( id, name, 23 ) |
1938 |
|
format( name, 23, "^"%s^"", name ) |
1939 |
|
format( cmd, 59, cmd, name ) |
1940 |
client_print(id,print_chat,cmd) |
client_print(id,print_chat,cmd) |
1941 |
} |
} |
1942 |
server_cmd(cmd) |
server_cmd(cmd) |
1943 |
} |
} |
1944 |
else{ |
else |
1945 |
|
{ |
1946 |
client_cmd(id,cmd) |
client_cmd(id,cmd) |
1947 |
} |
} |
1948 |
} |
} |
1949 |
} |
} |
|
return PLUGIN_HANDLED |
|
1950 |
} |
} |
1951 |
|
|
1952 |
//Update frags to reorder scoreboard |
//Update frags to reorder scoreboard |
1990 |
pdata[i][1] = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
pdata[i][1] = ( ( ( timer[id][TMR_BSTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
1991 |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
( ( timer[id][TMR_BSTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
1992 |
( timer[id][TMR_BSTWPN] * 10000 ) + |
( timer[id][TMR_BSTWPN] * 10000 ) + |
1993 |
timer[id][TMR_BSTTME] ) |
timer[id][TMR_BSTTME] / 10 ) |
1994 |
} |
} |
1995 |
else if( timer[id][TMR_CFLAGS] & CF_START || timer[id][TMR_CFLAGS] & CF_PAUSE ) |
else if( timer[id][TMR_CFLAGS] & CF_START || timer[id][TMR_CFLAGS] & CF_PAUSE ) |
1996 |
{//Has time but no high score |
{//Has time but no high score |
1998 |
pdata[i][1] = ( ( ( timer[id][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
pdata[i][1] = ( ( ( timer[id][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
1999 |
( ( timer[id][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
( ( timer[id][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
2000 |
( timer[id][TMR_CNTWPN] * 10000 ) + |
( timer[id][TMR_CNTWPN] * 10000 ) + |
2001 |
get_climber_time( id ) ) |
timer[id][TMR_CNTTME] / 10 ) |
2002 |
} |
} |
2003 |
else pdata[i][0] = 2 //No time or high score |
else pdata[i][0] = 2 //No time or high score |
2004 |
} |
} |
2008 |
players[i] = pdata[i][2] |
players[i] = pdata[i][2] |
2009 |
} |
} |
2010 |
|
|
|
/*public get_limit(){ |
|
|
//if(get_pcvar_num(p_webmod)) |
|
|
//return 0 |
|
|
new url[100] |
|
|
get_pcvar_string(p_stats_url,url,99) |
|
|
if(strlen(url)) |
|
|
return false |
|
|
return true |
|
|
}*/ |
|
|
|
|
|
/*public get_url( id, file[] ) |
|
|
{ |
|
|
new url[100] |
|
|
get_pcvar_string( p_stats_url, url, 99 ) |
|
|
//if(get_pcvar_num(p_webmod)){ |
|
|
// new ip[10],iip[33],eip[33],port[10] |
|
|
// get_user_ip(id,ip,9) |
|
|
// get_pcvar_string(p_ip_internal,iip,32) |
|
|
// get_pcvar_string(p_ip_external,eip,32) |
|
|
// get_pcvar_string(p_port,port,9) |
|
|
// if(equal(ip,"192.168.",8))format(url,99,"http://%s:%s/%s",iip,port,file) |
|
|
// else format(url,99,"http://%s:%s/%s",eip,port,file) |
|
|
//} |
|
|
if( strlen( url ) ) format( url, 99, "%sclimb_scores.html", url ) |
|
|
return url |
|
|
}*/ |
|
|
|
|
2011 |
stock sb_add_tabs( str[], size) |
stock sb_add_tabs( str[], size) |
2012 |
{ |
{ |
2013 |
new len = strlen( str )// > 7 ? 1 : 2 |
new len = strlen( str )// > 7 ? 1 : 2 |
2017 |
|
|
2018 |
public climbscores( id ) |
public climbscores( id ) |
2019 |
{//Show scoreboard |
{//Show scoreboard |
2020 |
if( get_pcvar_num( p_climb ) ) |
if( !get_pcvar_num( p_climb ) ) return PLUGIN_HANDLED |
2021 |
{ |
|
2022 |
if( get_systime() - ts_score > 2 ) |
if( get_systime() - ts_score > 2 ) |
2023 |
{ |
{ |
2024 |
new fh = fopen( SCORES_PATH, "w" ) |
new fh = fopen( SCORES_PATH, "w" ) |
2035 |
|
|
2036 |
get_players_ordered( players, num ) |
get_players_ordered( players, num ) |
2037 |
|
|
2038 |
for(new i = 1; i <= num; i++ ) |
for( new i = 0; i < num; i++ ) |
2039 |
{ |
{ |
2040 |
tid = players[i] |
tid = players[i] |
2041 |
|
|
2042 |
get_user_name( tid, name, NAMELEN) |
get_user_name( tid, name, NAMELEN) |
2043 |
sb_add_tabs( name, NAMELEN+2 ) |
sb_add_tabs( name, NAMELEN+2 ) |
2044 |
|
|
2045 |
ctime = get_climber_time(tid) |
ctime = timer[tid][TMR_CNTTME] |
2046 |
cwpn = timer[tid][TMR_CNTWPN] |
cwpn = timer[tid][TMR_CNTWPN] |
2047 |
ccp = timer[tid][TMR_CNTCPS] |
ccp = timer[tid][TMR_CNTCPS] |
2048 |
cgc = timer[tid][TMR_CNTGCS] |
cgc = timer[tid][TMR_CNTGCS] |
2061 |
formatex( line, 250, |
formatex( line, 250, |
2062 |
"%s%d %s%s %s %s%s %s%d%s", |
"%s%d %s%s %s %s%s %s%d%s", |
2063 |
i % 2 ? NULLSTR : "<div>", |
i % 2 ? NULLSTR : "<div>", |
2064 |
i, htmlspecialchars( name ), |
i + 1, htmlspecialchars( name ), |
2065 |
getuserstatus( tid ), |
getuserstatus( tid ), |
2066 |
parsetime( ctime ), ctime_str, |
parsetime( ctime ), ctime_str, |
2067 |
parsetime( btime ), btime_str, |
parsetime( btime ), btime_str, |
2083 |
} |
} |
2084 |
|
|
2085 |
show_motd( id, SCORES_PATH, "Current Scores" ) |
show_motd( id, SCORES_PATH, "Current Scores" ) |
2086 |
} |
|
2087 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
2088 |
} |
} |
2089 |
|
|
2090 |
public parsetime(sec){//Convert seconds to time string with zero padded seconds field |
//Convert seconds to time string with zero padded seconds field |
2091 |
new timestr[9],mins |
public parsetime( decisec ) |
2092 |
|
{ |
2093 |
|
new timestr[11], mins, sec, dec, decstr[3] |
2094 |
|
|
2095 |
|
sec = decisec / 10 |
2096 |
|
dec = decisec % 10 |
2097 |
mins=sec/60 |
mins=sec/60 |
2098 |
sec=sec%60 |
sec=sec%60 |
2099 |
formatex(timestr,8,"%d:%s%d",mins,sec<10?"0":"",sec) |
if( dec ) formatex( decstr, 2, ".%d", dec ) |
2100 |
|
formatex( timestr, 10, "%d:%s%d%s", mins, sec < 10 ? "0" : NULLSTR , sec, decstr ) |
2101 |
return timestr |
return timestr |
2102 |
} |
} |
2103 |
|
|
|
public get_climber_time( id ) |
|
|
{//Calculate client climb time in seconds |
|
|
/*new ptime,cflags=timer[id][TMR_CFLAGS] |
|
|
ptime=timer[id][TMR_FINISH]-timer[id][TMR_STARTD] |
|
|
if(cflags&CF_STOP&&timer[id=1][TMR_SESFIN]>0)ptime=timer[id][TMR_FINISH]-timer[id][TMR_STARTD] |
|
|
else if(cflags&CF_STOP)ptime=0 |
|
|
else if(cflags&CF_START)ptime=get_systime()-timer[id][TMR_STARTD] |
|
|
else if(cflags&CF_PAUSE)ptime=timer[id][TMR_STARTD]*/ |
|
|
new cflags = timer[id][TMR_CFLAGS] |
|
|
if( cflags & CF_START ) return get_systime()-timer[id][TMR_STARTD] |
|
|
else if( cflags & CF_PAUSE ) return timer[id][TMR_STARTD] |
|
|
return timer[id][TMR_FINISH]-timer[id][TMR_STARTD] |
|
|
} |
|
|
|
|
2104 |
public hudtime( ) |
public hudtime( ) |
2105 |
{//Set clock on HUD to current climb time |
{//Set clock on HUD to current climb time |
2106 |
if( !get_pcvar_num( p_climb ) ) return |
if( !get_pcvar_num( p_climb ) ) return |
2111 |
{ |
{ |
2112 |
id = players[i] |
id = players[i] |
2113 |
cflags = timer[id][TMR_CFLAGS] |
cflags = timer[id][TMR_CFLAGS] |
2114 |
cltime = get_climber_time(id) + 1 |
cltime = timer[id][TMR_CNTTME] / 10 + 1 |
2115 |
if( cflags & CF_PAUSE ) |
if( cflags & CF_PAUSE ) |
2116 |
{ |
{ |
2117 |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
clmsg( id, "PAUSED - say '/unpause' to resume." ) |
2118 |
cl_pause( id ) |
cl_pause( id ) |
2119 |
} |
} |
2120 |
|
|
2121 |
if( !( cflags & CF_COUNTDOWN ) || ( timer[id][TMR_BSTTME] - get_climber_time( id ) < 0 ) ) |
if( !( cflags & CF_COUNTDOWN ) || ( timer[id][TMR_BSTTME] >= timer[id][TMR_CNTTME] ) ) |
2122 |
hudtime_msg( id, cltime ) |
hudtime_msg( id, cltime ) |
2123 |
else if( cflags & CF_PAUSE ) |
else if( cflags & CF_PAUSE ) |
2124 |
hudtime_msg( id, timer[id][TMR_BSTTME] - cltime + 1 ) |
hudtime_msg( id, timer[id][TMR_BSTTME] / 10 - cltime + 1 ) |
2125 |
|
|
2126 |
for( new j = 1; j <= spec_ids[id][0]; j++ ) |
for( new j = 1; j <= spec_ids[id][0]; j++ ) |
2127 |
hudtime_msg( spec_ids[id][j], cltime ) |
hudtime_msg( spec_ids[id][j], cltime ) |
2143 |
|
|
2144 |
public bool:set_countdown_time( id ) |
public bool:set_countdown_time( id ) |
2145 |
{ |
{ |
2146 |
new bsttime = timer[id][TMR_BSTTME] |
new bsttme = timer[id][TMR_BSTTME] / 10 |
2147 |
if( bsttime > 0 ) |
if( bsttme > 0 ) |
2148 |
{ |
{ |
2149 |
new cflags = timer[id][TMR_CFLAGS] |
new cflags = timer[id][TMR_CFLAGS] |
2150 |
if( cflags & CF_START || cflags & CF_PAUSE ) |
if( cflags & CF_START || cflags & CF_PAUSE ) |
2151 |
hudtime_msg( id, timer[id][TMR_BSTTME] - get_climber_time( id ) ) |
hudtime_msg( id, bsttme - timer[id][TMR_CNTTME] / 10 ) |
2152 |
return true |
return true |
2153 |
} |
} |
2154 |
clmsg( id, "Countdown disabled: No high score available." ) |
clmsg( id, "Countdown disabled: No high score available." ) |
2180 |
|
|
2181 |
stock clmsg( id, msg[] ) |
stock clmsg( id, msg[] ) |
2182 |
{//Show Hud Message |
{//Show Hud Message |
2183 |
|
//if( !strlen( msg ) ) return PLUGIN_HANDLED; |
2184 |
set_hudmessage( get_pcvar_num( p_msg_r ), get_pcvar_num( p_msg_g ), get_pcvar_num( p_msg_b ), |
set_hudmessage( get_pcvar_num( p_msg_r ), get_pcvar_num( p_msg_g ), get_pcvar_num( p_msg_b ), |
2185 |
get_pcvar_float( p_msg_x ), get_pcvar_float( p_msg_y ), 0, 0.0, 5.0, 0.5, 0.5, 4 ) |
get_pcvar_float( p_msg_x ), get_pcvar_float( p_msg_y ), 0, 0.0, 5.0, 0.5, 0.5, 4 ); |
2186 |
show_hudmessage( id, msg ) |
show_hudmessage( id, msg ); |
2187 |
|
|
2188 |
//Show to spectators |
//Show to spectators |
2189 |
for( new i = 1; i <= spec_ids[id][0]; i++ ) |
for( new i = 1; i <= spec_ids[id][0]; i++ ) |
2190 |
show_hudmessage( spec_ids[id][i], msg ) |
show_hudmessage( spec_ids[id][i], msg ); |
2191 |
|
|
2192 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED; |
2193 |
} |
} |
2194 |
|
|
2195 |
//Fill spectator data array used for msg replication |
//Fill spectator data array used for msg replication |
2196 |
public spec_update(){ |
public spec_update() |
2197 |
if(get_pcvar_num(p_climb)){ |
{ |
2198 |
new players[32],num,id,id2,i |
if( !get_pcvar_num( p_climb ) ) return; |
2199 |
for(i=1;i<33;i++)spec_ids[i][0]=0 |
|
2200 |
get_players(players,num,"bch") |
new players[32], num, id, id2, i; |
2201 |
for(i=0;i<num;i++){ |
for( i = 1; i < 33; i++ ) spec_ids[i][0] = 0; |
2202 |
id=players[i] |
get_players( players, num, "bch" ); |
2203 |
id2=pev(id,pev_iuser2) |
for( i = 0; i < num; i++ ) |
2204 |
if(id2){ |
{ |
2205 |
spec_ids[id2][0]++ |
id = players[i]; |
2206 |
spec_ids[id2][spec_ids[id2][0]]=id |
id2 = pev( id, pev_iuser2 ); |
2207 |
|
if( id2 ) |
2208 |
|
{ |
2209 |
|
spec_ids[id2][0]++; |
2210 |
|
spec_ids[id2][ spec_ids[id2][0] ] = id; |
2211 |
} |
} |
2212 |
} |
} |
2213 |
} |
} |
2214 |
return PLUGIN_HANDLED |
|
2215 |
|
//Make client solid or unsolid |
2216 |
|
stock set_solid( id, solid = 1 ) |
2217 |
|
{ |
2218 |
|
static old_fx[33], Float:old_col[33][3], old_render[33], old_amt[33]; |
2219 |
|
if( solid && pev( id, pev_solid ) == SOLID_NOT ) |
2220 |
|
{ |
2221 |
|
set_pev( id, pev_renderfx, old_fx[id] ); |
2222 |
|
set_pev( id, pev_rendermode, old_render[id] ); |
2223 |
|
set_pev( id, pev_rendercolor, old_col[id] ); |
2224 |
|
set_pev( id, pev_renderamt, old_amt[id] ); |
2225 |
|
|
2226 |
|
set_pev( id, pev_solid, SOLID_SLIDEBOX ); |
2227 |
} |
} |
2228 |
//Make client solid |
else if( !solid && pev( id, pev_solid ) == SOLID_SLIDEBOX ) |
|
public solid(id) |
|
2229 |
{ |
{ |
2230 |
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,255) |
old_fx[id] = pev( id, pev_renderfx ); |
2231 |
entity_set_int(id,EV_INT_solid,SOLID_BBOX) |
old_render[id] = pev( id, pev_rendermode ); |
2232 |
sclip[id]=false |
pev( id, pev_rendercolor, old_col[id] ); |
2233 |
return PLUGIN_CONTINUE |
old_amt[id] = pev( id, pev_renderamt ); |
2234 |
|
|
2235 |
|
set_pev( id, pev_rendercolor, Float:{ 0.0, 0.0, 0.0 } ); |
2236 |
|
if( get_pcvar_num(p_render) ) |
2237 |
|
{ |
2238 |
|
set_pev( id, pev_renderfx, kRenderFxHologram ); |
2239 |
|
set_pev( id, pev_rendermode, kRenderTransAdd ); |
2240 |
|
set_pev( id, pev_renderamt, float( 0 ) ); |
2241 |
} |
} |
2242 |
//Make client unsolid |
else |
|
public unsolid(id) |
|
2243 |
{ |
{ |
2244 |
if(get_pcvar_num(p_render))set_user_rendering(id,kRenderFxHologram,0,0,0,kRenderTransAdd,0) |
set_pev( id, pev_renderfx, kRenderFxPulseSlow ); |
2245 |
else set_user_rendering(id,kRenderFxPulseSlow,0,0,0,kRenderTransTexture,50) |
set_pev( id, pev_rendermode, kRenderTransTexture ); |
2246 |
entity_set_int(id,EV_INT_solid,SOLID_NOT) |
set_pev( id, pev_renderamt, float( 50 ) ); |
2247 |
sclip[id]=true |
} |
2248 |
return PLUGIN_CONTINUE |
|
2249 |
|
set_pev( id, pev_solid, SOLID_NOT ); |
2250 |
} |
} |
2251 |
|
} |
2252 |
|
|
2253 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2254 |
// Start: Functions for use in if statements |
// Start: Functions for use in if statements |
2255 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2263 |
|
|
2264 |
public playersolid( id ) |
public playersolid( id ) |
2265 |
{ |
{ |
2266 |
if(entity_get_int(id,EV_INT_solid)==SOLID_BBOX)return 1 |
if( pev( id, pev_solid ) == SOLID_SLIDEBOX ) return 1 |
2267 |
return 0 |
return 0 |
2268 |
} |
} |
2269 |
|
|
2357 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2358 |
// End: Auto Heal functions |
// End: Auto Heal functions |
2359 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
2360 |
// Start: Multiplay Bunny Hop functions |
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
2361 |
public pfn_touch( ent, id ) |
public pfn_touch( ent, id ) |
2362 |
{ |
{ |
2363 |
if( !get_pcvar_num( p_climb ) ) |
if( !get_pcvar_num( p_climb ) ) |
2382 |
} |
} |
2383 |
else return PLUGIN_HANDLED |
else return PLUGIN_HANDLED |
2384 |
|
|
|
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] != ent ) |
|
|
{ |
|
|
bhop_failid[id] = ent |
|
|
bhop_fail[id] = 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] ) |
|
|
{ |
|
|
teleport( id, door_tp_pos[dpos] ) |
|
|
bhop_failid[id] = 0 |
|
|
bhop_fail[id] = false |
|
|
} |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
2385 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
2386 |
} |
} |
2387 |
|
|
|
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] = true |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
|
public bhop_clear_fail( tskid ) |
|
|
{ |
|
|
new id = tskid - TSK_CLEAR_FAIL |
|
|
bhop_failid[id] = 0 |
|
|
bhop_fail[id] = false |
|
|
return PLUGIN_HANDLED |
|
|
} |
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
// End: Multiplay Bunny Hop functions |
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
|
/*public spawn_distance_sort(elem1[],elem2[]){ |
|
|
if(elem1[1]<elem2[1])return -1 |
|
|
if(elem1[1]>elem2[1])return 1 |
|
|
return 0 |
|
|
}*/ |
|
|
|
|
2388 |
//Future use, to block hook, or detect hook cheaters a.k.a. hookers |
//Future use, to block hook, or detect hook cheaters a.k.a. hookers |
2389 |
public phook( id ) |
public phook( id ) |
2390 |
{ |
{ |
2475 |
|
|
2476 |
new Float:c2[3], player, players[32], num |
new Float:c2[3], player, players[32], num |
2477 |
get_players( players, num, "ac" ) |
get_players( players, num, "ac" ) |
2478 |
unsolid( id ) |
set_solid( id, 0 ); |
2479 |
for( new i = 0; i < num; i++ ) |
for( new i = 0; i < num; i++ ) |
2480 |
{ |
{ |
2481 |
player = players[i] |
player = players[i] |
2482 |
if( id != player ) |
if( id != player ) |
2483 |
{ |
{ |
2484 |
entity_get_vector( player, EV_VEC_origin, c2 ) |
entity_get_vector( player, EV_VEC_origin, c2 ) |
2485 |
if( vector_distance( orig, c2 ) < 90 ) unsolid( player ) |
if( vector_distance( orig, c2 ) < 90 ) set_solid( player, 0 ); |
2486 |
} |
} |
2487 |
} |
} |
2488 |
entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} ) |
entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} ) |
2502 |
set_entity_flags(ida[0],FL_DUCKING,1) |
set_entity_flags(ida[0],FL_DUCKING,1) |
2503 |
} |
} |
2504 |
|
|
2505 |
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 |
2506 |
if(get_pcvar_num(p_cvar)==0){ |
stock cvar_enabled( id, p_cvar, silent = 0 ) |
2507 |
|
{ |
2508 |
|
if( get_pcvar_num(p_cvar) == 0 ) |
2509 |
|
{ |
2510 |
|
if( !silent ) |
2511 |
|
{ |
2512 |
clmsg(id,"This command is disabled.") |
clmsg(id,"This command is disabled.") |
2513 |
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.") |
2514 |
|
} |
2515 |
return 0 |
return 0 |
2516 |
} |
} |
2517 |
return 1 |
return 1 |
2586 |
if( get_pcvar_num( p_climb ) ) |
if( get_pcvar_num( p_climb ) ) |
2587 |
show_motd( id, "http://ian.cammarata.us/projects/climb/help/2a3/en/boosts?agent=hl", "Climb Plugin Help" ) |
show_motd( id, "http://ian.cammarata.us/projects/climb/help/2a3/en/boosts?agent=hl", "Climb Plugin Help" ) |
2588 |
|
|
2589 |
|
//Admin command, teleport to client |
2590 |
public goto_player( id ) |
public goto_player( id ) |
|
{//Admin command, teleport to client |
|
|
if( is_finished( id ) && get_pcvar_num( p_climb ) ) |
|
2591 |
{ |
{ |
2592 |
|
if( !is_finished( id ) || !get_pcvar_num( p_climb ) ) |
2593 |
|
return |
2594 |
|
|
2595 |
new tid, arg[24] |
new tid, arg[24] |
2596 |
read_argv( 1, arg, sizeof( arg ) - 1 ) |
read_argv( 1, arg, 23 ) |
2597 |
tid = cmd_target( tid, arg, 4 ) |
tid = cmd_target( tid, arg, 4 ) |
2598 |
if( tid ) |
if( tid ) |
2599 |
{ |
{ |
2602 |
teleport( id, orig ) |
teleport( id, orig ) |
2603 |
} |
} |
2604 |
} |
} |
|
return PLUGIN_HANDLED |
|
|
} |
|
2605 |
|
|
2606 |
public spectate( id ) |
public spectate( id ) |
2607 |
{//Client switch to spectator |
{//Client switch to spectator |
2609 |
{ |
{ |
2610 |
if( !is_climber_alive( id ) ) |
if( !is_climber_alive( id ) ) |
2611 |
{ |
{ |
|
/* |
|
|
cs_set_user_team(id,3)//fixes respawn bug? |
|
|
frespawn( id ) |
|
|
*/ |
|
|
|
|
2612 |
climb_user_spawn( id ) |
climb_user_spawn( id ) |
2613 |
|
|
2614 |
if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
//already does this in the resethud function |
2615 |
|
/*if( timer[id][TMR_CFLAGS] & CF_PAUSE ) |
2616 |
{//If they are paused tp to pause spot and freeze them again. |
{//If they are paused tp to pause spot and freeze them again. |
2617 |
new Float:coords[3] |
new Float:coords[3] |
2618 |
for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] |
|
2619 |
|
coords[0] = origins[ id ][ ORIG_PAUSX ] |
2620 |
|
coords[1] = origins[ id ][ ORIG_PAUSY ] |
2621 |
|
coords[2] = origins[ id ][ ORIG_PAUSZ ] |
2622 |
|
|
2623 |
teleport( id, coords ) |
teleport( id, coords ) |
2624 |
cl_pause( id ) |
cl_pause( id ) |
2625 |
} |
}*/ |
2626 |
|
|
2627 |
} |
} |
2628 |
else if( get_user_flags( id ) & VIP ? 1 : ( cvar_enabled( id, p_allow_spectators ) ) ) |
else if( get_user_flags( id ) & VIP ? 1 : ( cvar_enabled( id, p_allow_spectators ) ) ) |
2629 |
{ |
{ |
|
//Move client way outside the map so we don't have to see their retarded model |
|
|
new Float:orig[3] |
|
|
entity_get_vector( id, EV_VEC_origin, orig ) |
|
|
entity_set_vector( id, EV_VEC_origin, Float:{ 99999.9, 99999.9, 99999.9 } ) |
|
|
|
|
|
//Set a task to move them back to where they were originally |
|
|
new ida[4] |
|
|
ida[0] = id |
|
|
ida[1] = _:orig[0] |
|
|
ida[2] = _:orig[1] |
|
|
ida[3] = _:orig[2] |
|
|
set_task( 0.1, "tsk_spec_tp_back", _, ida, 4 ) |
|
|
|
|
2630 |
set_pev( id, pev_movetype, MOVETYPE_NOCLIP ) |
set_pev( id, pev_movetype, MOVETYPE_NOCLIP ) |
2631 |
set_pev( id, pev_solid, SOLID_NOT ) |
set_pev( id, pev_solid, SOLID_NOT ) |
2632 |
set_pev( id, pev_effects, EF_NODRAW ) |
set_pev( id, pev_effects, EF_NODRAW ) |
3119 |
server_ip char(15),\ |
server_ip char(15),\ |
3120 |
user_id integer,\ |
user_id integer,\ |
3121 |
map_name varchar(32),\ |
map_name varchar(32),\ |
3122 |
fin_time integer,\ |
fin_time float,\ |
3123 |
cps integer,\ |
cps integer,\ |
3124 |
gcs integer,\ |
gcs integer,\ |
3125 |
boosts integer,\ |
boosts integer,\ |
3284 |
new query[351], mapname[33], data[1] |
new query[351], mapname[33], data[1] |
3285 |
data[0] = id |
data[0] = id |
3286 |
get_mapname( mapname, 32 ) |
get_mapname( mapname, 32 ) |
3287 |
/*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][TMR_DBUSER], mapname )*/ |
|
3288 |
formatex( query, 350, |
formatex( query, 350, |
3289 |
"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", |
3290 |
DB_PREFIX, DB_PREFIX, mapname, mapname, timer[id][TMR_DBUSER], timer[id][TMR_DBUSER] ) |
DB_PREFIX, DB_PREFIX, mapname, mapname, timer[id][TMR_DBUSER], timer[id][TMR_DBUSER] ) |
3291 |
|
|
3292 |
SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 ) |
SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 ) |
3293 |
} |
} |
3294 |
|
|
3302 |
msg="^x04No stats available for this account on the current map." |
msg="^x04No stats available for this account on the current map." |
3303 |
else |
else |
3304 |
{ |
{ |
3305 |
new mapname[33],timestr[9] |
new mapname[33], Float:fTmp |
3306 |
get_mapname(mapname,32) |
get_mapname(mapname,32) |
3307 |
timer[id][TMR_BSTTME] = SQL_ReadResult( query, 0 ) |
SQL_ReadResult( query, 0, fTmp ) |
3308 |
|
timer[id][TMR_BSTTME] = floatround( fTmp * 10 ) |
3309 |
timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 ) |
timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 ) |
3310 |
timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 ) |
timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 ) |
3311 |
timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 ) |
timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 ) |
3312 |
timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 ) |
timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 ) |
3313 |
timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 ) |
timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 ) |
3314 |
//timer[id][TMR_CFLAGS]+=SQL_ReadResult(query,5)?CF_BSTSCT:0 |
//timer[id][TMR_CFLAGS]+=SQL_ReadResult(query,5)?CF_BSTSCT:0 //Read cflag preferences from db, maybe this should be setinfos instead |
3315 |
|
|
|
timestr = parsetime(timer[id][TMR_BSTTME]) |
|
3316 |
formatex( msg, 99, |
formatex( msg, 99, |
3317 |
"^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", |
3318 |
mapname, timestr, timer[id][TMR_BSTWPN], timer[id][TMR_BSTCPS], |
mapname, parsetime( timer[id][TMR_BSTTME] ), timer[id][TMR_BSTWPN], timer[id][TMR_BSTCPS], |
3319 |
timer[id][TMR_BSTGCS], timer[id][TMR_BSTBST], timer[id][TMR_MAPFIN] ) |
timer[id][TMR_BSTGCS], timer[id][TMR_BSTBST], timer[id][TMR_MAPFIN] ) |
3320 |
} |
} |
3321 |
saytext( id, id, msg ) |
saytext( id, id, msg ) |
3326 |
|
|
3327 |
public db_save( id ) |
public db_save( id ) |
3328 |
{ |
{ |
3329 |
if( timer[id][TMR_DBUSER] < 1 ) |
new user_id = timer[id][TMR_DBUSER] |
3330 |
|
|
3331 |
|
if( user_id < 1 ) |
3332 |
{ |
{ |
3333 |
auto_reg( id ) |
auto_reg( id ) |
3334 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
3335 |
} |
} |
3336 |
|
|
3337 |
new query[351], name[33], data[2] |
new query[351], name[33], data[2] |
3338 |
data[0] = id |
data[0] = id |
3339 |
get_mapname( name, 32 ) |
get_mapname( name, 32 ) |
3340 |
strtolower( name ) |
strtolower( name ) |
3341 |
|
|
3342 |
new user_id = timer[id][TMR_DBUSER] |
new cntbst = timer[id][TMR_CNTBST] |
3343 |
new fin_time = get_climber_time( id ) |
new cntcps = timer[id][TMR_CNTCPS] |
3344 |
|
new cntwpn = timer[id][TMR_CNTWPN] |
3345 |
|
|
3346 |
|
new score = ( ( ( cntbst > 0 ? 1 : 0 ) * 1000000 ) + |
3347 |
|
( ( cntcps > 0 ? 1 : 0 ) * 100000 ) + |
3348 |
|
( cntwpn * 10000 ) + |
3349 |
|
timer[id][TMR_CNTTME] / 10 ) |
3350 |
|
|
|
new wpn_rank = timer[id][TMR_CNTWPN] |
|
|
|
|
|
new score = ( ( ( timer[id][TMR_CNTBST] > 0 ? 1 : 0 ) * 1000000 ) + |
|
|
( ( timer[id][TMR_CNTCPS] > 0 ? 1 : 0 ) * 100000 ) + |
|
|
( wpn_rank * 10000 ) + |
|
|
fin_time ) |
|
|
|
|
|
/*if( timer[id][TMR_MAPFIN] == 1 ) |
|
|
formatex( query, 350, |
|
|
"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);",\ |
|
|
DB_PREFIX, user_id, name, fin_time, timer[id][TMR_BSTCPS], timer[id][TMR_BSTGCS], timer[id][TMR_MAPFIN], timer[id][TMR_BSTBST], sctd, sort, get_systime() ) |
|
|
else*/ |
|
3351 |
formatex( query, 350, |
formatex( query, 350, |
3352 |
"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)",\ |
"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)",\ |
3353 |
DB_PREFIX, DB_SERVER_ID, user_id, name, fin_time, timer[id][TMR_CNTCPS], timer[id][TMR_CNTGCS], timer[id][TMR_CNTBST], wpn_rank, score, 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() ) |
3354 |
SQL_ThreadQuery(DB_TUPLE,"db_save_handler",query,data,2) |
SQL_ThreadQuery(DB_TUPLE,"db_save_handler",query,data,2) |
3355 |
|
|
3356 |
data[1] = 0 |
data[1] = 0 |
3357 |
get_user_name( id, name, 32 ) |
get_user_name( id, name, 32 ) |
3358 |
formatex( query, 350, "update %splayers set alias=^"%s^" where user_id=%d;", DB_PREFIX, name, timer[id][TMR_DBUSER] ) |
formatex( query, 350, "update %splayers set alias=^"%s^" where user_id=%d;", DB_PREFIX, name, user_id ) |
3359 |
SQL_ThreadQuery( DB_TUPLE, "db_name_update_handler", query, data, 2 ) |
SQL_ThreadQuery( DB_TUPLE, "db_name_update_handler", query, data, 2 ) |
3360 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
3361 |
} |
} |
3438 |
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) |
3439 |
SQL_ThreadQuery(DB_TUPLE,"reg_handler",query,data,43) |
SQL_ThreadQuery(DB_TUPLE,"reg_handler",query,data,43) |
3440 |
} |
} |
|
//Else register SteamID |
|
|
/*else if(timer[id][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) |
|
|
}*/ |
|
3441 |
} |
} |
3442 |
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.") |
3443 |
} |
} |
3483 |
} |
} |
3484 |
|
|
3485 |
public highscores(id) |
public highscores(id) |
3486 |
{//Show High Scores |
{ |
3487 |
if( !CLIMB_SAVE ) return clmsg( id, "Stats not enabled.") |
if( !CLIMB_SAVE ) return clmsg( id, "Stats not enabled.") |
3488 |
|
|
3489 |
new hsurl[150], mapname[33] |
new hsurl[150], mapname[33] |
3499 |
{ |
{ |
3500 |
new query[501], data[1] |
new query[501], data[1] |
3501 |
data[0] = id |
data[0] = id |
3502 |
/*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 )*/ |
|
3503 |
formatex( query, 500, |
formatex( query, 500, |
3504 |
"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", |
3505 |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
3506 |
|
|
3507 |
SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 ) |
SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 ) |
3508 |
ts_hscore = get_systime() |
ts_hscore = get_systime() |
3509 |
} |
} |
3547 |
sb_add_tabs( name, NAMELEN+2 ) |
sb_add_tabs( name, NAMELEN+2 ) |
3548 |
|
|
3549 |
|
|
3550 |
format( btime_str, 19, "%d/%d/%d/%d",\ |
format( btime_str, 19, "%d/%d/%d/%d", |
3551 |
SQL_ReadResult( query, 6 ),\ |
SQL_ReadResult( query, 6 ), |
3552 |
SQL_ReadResult( query, 2 ),\ |
SQL_ReadResult( query, 2 ), |
3553 |
SQL_ReadResult( query, 3 ),\ |
SQL_ReadResult( query, 3 ), |
3554 |
SQL_ReadResult( query, 5 ) ) |
SQL_ReadResult( query, 5 ) |
3555 |
|
) |
3556 |
sb_add_tabs( btime_str, 19 ) |
sb_add_tabs( btime_str, 19 ) |
3557 |
|
|
3558 |
|
new Float:fTmp |
3559 |
|
SQL_ReadResult( query, 1, fTmp ) |
3560 |
|
|
3561 |
formatex( line, 150,\ |
formatex( line, 150,\ |
3562 |
"%s%d %s%s %s %d%s", |
"%s%d %s%s %s %d%s", |
3563 |
i % 2 ? NULLSTR : "<div>", |
i % 2 ? NULLSTR : "<div>", |
3564 |
i, htmlspecialchars( name ), |
i, htmlspecialchars( name ), |
3565 |
parsetime( SQL_ReadResult( query, 1 ) ), |
parsetime( floatround( fTmp * 10 ) ), |
3566 |
btime_str, |
btime_str, |
3567 |
SQL_ReadResult( query, 4 ), |
SQL_ReadResult( query, 4 ), |
3568 |
i % 2 ? NULLSTR : "</div>" ) |
i % 2 ? NULLSTR : "</div>" ) |
3615 |
new query[501], data[1] |
new query[501], data[1] |
3616 |
data[0]=id |
data[0]=id |
3617 |
|
|
|
/*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)*/ |
|
3618 |
formatex( query, 500, |
formatex( query, 500, |
3619 |
"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", |
3620 |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) |
3806 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
3807 |
// End: Database functions |
// End: Database functions |
3808 |
//////////////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////////////// |
3809 |
public rotwtf( string[], out_len ) |
//Simple Password Encryption |
3810 |
{//Simple Password Encryption |
public rotwtf( string[], out_len )//I should replace this with md5 since it's available now |
3811 |
|
{ |
3812 |
new len=strlen( string ),str[99],cnt=0,tok=len-1 |
new len=strlen( string ),str[99],cnt=0,tok=len-1 |
3813 |
copy( str, out_len, string ) |
copy( str, out_len, string ) |
3814 |
for( new index=0; index<11; index++ ) |
for( new index=0; index<11; index++ ) |