[Half-Life AMXX] / climb.sma Repository:
ViewVC logotype

Diff of /climb.sma

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23, Sun Nov 18 17:46:23 2007 UTC revision 41, Mon Mar 3 05:54:51 2008 UTC
# Line 2  Line 2 
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
# Line 127  Line 128 
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.
# Line 135  Line 135 
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: New semiclip, should be flawless now. (not completely done yet)
139  c: Cvar climb_water_nodraw changes take effect without reloading map.  c: Cvar climb_water_nodraw changes take effect without reloading map.
140  c: Database now stores multiple records per map per player.  c: Database now stores multiple records per map per player.
141  c: Cvar climb_db_pass is now protected.  c: Cvar climb_db_pass is now protected.
# Line 268  Line 268 
268  #include <cstrike>  #include <cstrike>
269  #include <cstrike2>  #include <cstrike2>
270    
271  new const VERSION[ ] = "a3.7.2 Nov 18 10:31 MST"  new const VERSION[ ] = "a3.7.8 Feb 24 20:55 MST"
272  new const TRKCVAR[ ] = "climb_version"  new const TRKCVAR[ ] = "climb_version"
273    
274  new const DONOTHING[ ] = "donothing"  new const DONOTHING[ ] = "donothing"
275  new const NULLSTR[ ] = ""  new const NULLSTR[ ] = ""
276    
# Line 298  Line 299 
299  #define ORIGINS_SIZE 48  #define ORIGINS_SIZE 48
300  new Float:origins[33][ORIGINS_SIZE]  new Float:origins[33][ORIGINS_SIZE]
301  #define ORIG_UNGC 40  #define ORIG_UNGC 40
302  #define ORIG_PAUS 44  #define ORIG_PAUSX 44
303  //#define ORIG_X 0  #define ORIG_PAUSY 45
304  //#define ORIG_Y 1  #define ORIG_PAUSZ 46
305  //#define ORIG_Z 2  #define ORIG_PAUSG 47
306  #define ORIG_GRAV 3  #define ORIG_GRAV 3
307    
308  new time_stamps[33][5]//time_stamps[id][x]  new time_stamps[33][5]//time_stamps[id][x]
# Line 342  Line 343 
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[33],Float:post_think_vel[33][3],sc_fcount  new Float:post_think_vel[33][3]
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[33], bool:bhop_fail[33]  
 //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
# Line 370  Line 365 
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][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
# Line 393  Line 386 
386    
387  #define SILENT 1  #define SILENT 1
388    
389  new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE  //Boost Flags for climb_boost CVAR
390    #define SOLID 1
391    #define DJUMP 2
392    #define SJUMP 4
393    
394    new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE, SVC_CLCORPSE;
395    
396  new SCORES_PATH[100], HSCORES_PATH[100]  new SCORES_PATH[100], HSCORES_PATH[100]
397    
# Line 408  Line 406 
406    
407          p_climb = register_cvar( "climb", "0", FCVAR_SERVER )          p_climb = register_cvar( "climb", "0", FCVAR_SERVER )
408          p_auto = register_cvar( "climb_auto", "1" )          p_auto = register_cvar( "climb_auto", "1" )
409          p_boost = register_cvar( "climb_boost", "1" )          p_boost = register_cvar( "climb_boost", "7" )
410          p_cpprice = register_cvar( "climb_cpprice", "0" )          p_cpprice = register_cvar( "climb_cpprice", "0" )
411          p_startmoney = register_cvar( "climb_startmoney", "1337" )          p_startmoney = register_cvar( "climb_startmoney", "1337" )
412    
# Line 422  Line 420 
420          register_cvar( "climb_db_serverid", NULLSTR )          register_cvar( "climb_db_serverid", NULLSTR )
421          register_cvar( "climb_db_exists", "0" )          register_cvar( "climb_db_exists", "0" )
422    
423          p_msg_r = register_cvar( "climb_msg_r", "0" )          p_msg_r = register_cvar( "climb_msg_r", "0" );
424          p_msg_g = register_cvar( "climb_msg_g", "150" )          p_msg_g = register_cvar( "climb_msg_g", "150" );
425          p_msg_b = register_cvar( "climb_msg_b", "250" )          p_msg_b = register_cvar( "climb_msg_b", "250" );
426          p_msg_x = register_cvar( "climb_msg_x", "0.05" )          p_msg_x = register_cvar( "climb_msg_x", "0.05" );
427          p_msg_y = register_cvar( "climb_msg_y", "0.5" )          p_msg_y = register_cvar( "climb_msg_y", "0.5" );
428    
429          p_light_r = register_cvar( "climb_light_r", "255" )          p_light_r = register_cvar( "climb_light_r", "255" );
430          p_light_g = register_cvar( "climb_light_g", "255" )          p_light_g = register_cvar( "climb_light_g", "255" );
431          p_light_b = register_cvar( "climb_light_b", "255" )          p_light_b = register_cvar( "climb_light_b", "255" );
432    
433          p_sounds = register_cvar( "climb_sounds", "1" )          p_sounds = register_cvar( "climb_sounds", "1" );
434          p_render = register_cvar( "climb_unsolid_type", "0" )          p_render = register_cvar( "climb_unsolid_type", "0" );
435          p_start_respawn = register_cvar( "climb_start_respawn", "0" )          p_start_respawn = register_cvar( "climb_start_respawn", "0" );
436          p_water_nodraw = register_cvar( "climb_water_nodraw", "0" )          p_water_nodraw = register_cvar( "climb_water_nodraw", "0" );
437    
438          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
439          p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR )          p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR );
440    
441          p_allow_spectators = get_cvar_pointer( "allow_spectators" )          p_allow_spectators = get_cvar_pointer( "allow_spectators" );
442          p_teambalance = get_cvar_pointer( "mp_autoteambalance" )          p_teambalance = get_cvar_pointer( "mp_autoteambalance" );
443          p_limitteams = get_cvar_pointer( "mp_limitteams" )          p_limitteams = get_cvar_pointer( "mp_limitteams" );
444    
445          MAXPLAYERS = get_maxplayers( )          MAXPLAYERS = get_maxplayers( );
446    
447          TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance )          TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance );
448          LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams )          LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams );
449    
450          //Message Pseudo-Constants          //Message Pseudo-Constants
451          SVC_STATUSICON = get_user_msgid( "StatusIcon" )          SVC_STATUSICON = get_user_msgid( "StatusIcon" );
452          SVC_TEAMINFO = get_user_msgid( "TeamInfo" )          SVC_TEAMINFO = get_user_msgid( "TeamInfo" );
453          SVC_ROUNDTIME = get_user_msgid( "RoundTime" )          SVC_ROUNDTIME = get_user_msgid( "RoundTime" );
454          SVC_FLASHLIGHT = get_user_msgid( "Flashlight" )          SVC_FLASHLIGHT = get_user_msgid( "Flashlight" );
455          SVC_SCREENFADE = get_user_msgid( "ScreenFade" )          SVC_SCREENFADE = get_user_msgid( "ScreenFade" );
456            SVC_CLCORPSE = get_user_msgid( "ClCorpse" );
457    
458          //These commands get blocked always.          //These commands get blocked always.
459          register_clcmd( "fullupdate", "block_cmd2" )          register_clcmd( "fullupdate", "block_cmd2" );
460    
461          //These commands get blocked when climb is enabled.          //These commands get blocked when climb is enabled.
462          register_clcmd( "chooseteam", "spectate" )          register_clcmd( "chooseteam", "spectate" );
463          register_clcmd( "buy", "block_cmd" )          register_clcmd( "buy", "block_cmd" );
464          register_clcmd( "buyammo1", "block_cmd" )          register_clcmd( "buyammo1", "block_cmd" );
465          register_clcmd( "buyammo2", "block_cmd" )          register_clcmd( "buyammo2", "block_cmd" );
466          register_clcmd( "buyequip", "block_cmd" )          register_clcmd( "buyequip", "block_cmd" );
467    
468          register_clcmd( "jointeam", "block_jointeam" )          register_clcmd( "jointeam", "block_jointeam" );
469    
470          //Commands to detect cheats.          //Commands to detect cheats.
471          register_clcmd( "+hook", "phook" )          register_clcmd( "+hook", "phook" );
472          register_clcmd( "+rope", "phook" )          register_clcmd( "+rope", "phook" );
473          register_clcmd( "-hook", "mhook" )          register_clcmd( "-hook", "mhook" );
474          register_clcmd( "-rope", "mhook" )          register_clcmd( "-rope", "mhook" );
475    
476          //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.
477          register_clcmd( "say help", "help_msg" )          register_clcmd( "say help", "help_msg" )
# Line 549  Line 548 
548          if( file_exists( ini ) )          if( file_exists( ini ) )
549          {          {
550                  new line = 0, text[50], len                  new line = 0, text[50], len
551                  while( read_file( ini, line++, text, sizeof(text)-1 , len ) )                  while( read_file( ini, line++, text, 49 , len ) )
552                  {                  {
553                          if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) )                          if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) )
554                          {                          {
# Line 581  Line 580 
580                  }                  }
581          }          }
582    
         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  
         }  
   
583          return PLUGIN_CONTINUE          return PLUGIN_CONTINUE
584  }  }
585    
# Line 614  Line 587 
587  {  {
588          new ent, ent2, tmpstr[33], Float:tmpflt          new ent, ent2, tmpstr[33], Float:tmpflt
589    
         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  
                                                 }  
                                         }  
                                 }  
                         }  
                 }  
         }  
   
590          //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
591          ent = find_ent_by_class( -1, "func_button" )          ent = find_ent_by_class( -1, "func_button" )
592          while( ent > 0 )          while( ent > 0 )
# Line 777  Line 673 
673                          }                          }
674                  }                  }
675    
                 //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" )  
                         }  
                 }  
   
676                  //Remove map built in start button sounds                  //Remove map built in start button sounds
677                  ent = find_ent_by_class( -1, "ambient_generic" )                  ent = find_ent_by_class( -1, "ambient_generic" )
678                  while( ent > 0 )                  while( ent > 0 )
# Line 1029  Line 914 
914    
915                          //Do gocheck                          //Do gocheck
916                          new cppos = timer[id][TMR_CPPOS] * 4                          new cppos = timer[id][TMR_CPPOS] * 4
917                          for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i]                          coords[0] = origins[id][cppos]
918                            coords[1] = origins[id][cppos + 1]
919                            coords[2] = origins[id][cppos + 2]
920                          entity_set_float( id, EV_FL_gravity, origins[id][3] )                          entity_set_float( id, EV_FL_gravity, origins[id][3] )
921                          teleport( id, coords )                          teleport( id, coords )
922    
# Line 1147  Line 1034 
1034                  {                  {
1035                          cflags_new += CF_START                          cflags_new += CF_START
1036                          set_entity_flags( id, FL_FROZEN, 0 )                          set_entity_flags( id, FL_FROZEN, 0 )
1037                          unsolid( id )                          //set_solid( id, 0 );
1038                          entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] )                          entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUSG] )
1039                          clmsg( id, "UNPAUSED" )                          clmsg( id, "UNPAUSED" )
1040                          sfexec( id, 2 )                          sfexec( id, 2 )
1041                  }                  }
# Line 1172  Line 1059 
1059  {  {
1060          if( is_climber_alive( id ) )          if( is_climber_alive( id ) )
1061          {          {
1062                  unsolid( id )                  set_solid( id, 0 );
1063                  set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 )                  set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 )
1064                    //set_pev( id, pev_flags, pev( id, pev_flags ) & FL_FROZEN )
1065                  set_entity_flags( id, FL_FROZEN, 1 )                  set_entity_flags( id, FL_FROZEN, 1 )
1066                  clmsg( id, "PAUSED - say '/unpause' to resume." )                  clmsg( id, "PAUSED - say '/unpause' to resume." )
1067          }          }
# Line 1248  Line 1136 
1136          ) return PLUGIN_CONTINUE          ) return PLUGIN_CONTINUE
1137    
1138          //If it's a gun, update pack and clip ammo & silencer          //If it's a gun, update pack and clip ammo & silencer
1139          new wpn_id = get_user_weapon( id )          new wpn_name[17]
1140            get_weaponname( wpn, wpn_name,16 )
1141            new wpn_id = find_ent_by_owner( -1, wpn_name, id )
1142          if( !wpn_id ) return PLUGIN_CONTINUE          if( !wpn_id ) return PLUGIN_CONTINUE
1143    
1144          new clip = get_msg_arg_int( 3 )          new clip = get_msg_arg_int( 3 )
# Line 1392  Line 1282 
1282          cs_user_spawn( id )          cs_user_spawn( id )
1283    
1284          set_pev( id, pev_movetype, MOVETYPE_WALK )          set_pev( id, pev_movetype, MOVETYPE_WALK )
1285          set_pev( id, pev_solid, SOLID_BBOX )          set_pev( id, pev_solid, SOLID_SLIDEBOX )
1286          set_pev( id, pev_effects, 0 )          set_pev( id, pev_effects, 0 )
1287          set_pev( id, pev_deadflag, DEAD_NO )          set_pev( id, pev_deadflag, DEAD_NO )
1288          set_pev( id, pev_takedamage, DAMAGE_AIM )          set_pev( id, pev_takedamage, DAMAGE_AIM )
# Line 1409  Line 1299 
1299    
1300  public ResetHUD( id )  public ResetHUD( id )
1301  {//Spawned  {//Spawned
1302          if( get_pcvar_num( p_climb ) )          if( !get_pcvar_num( p_climb ) )
         {  
                 if( !is_user_bot( id ) && !is_user_hltv( id ) )  
1303                  {                  {
1304                          flight_icons( id )//redraw flashlight hud icons                  set_msg_block( SVC_STATUSICON, BLOCK_NOT );
1305                          set_msg_block( SVC_STATUSICON, 2 )//Block buy menu                  set_msg_block( SVC_CLCORPSE, BLOCK_NOT );
1306                    return;
1307            }
1308    
1309            if( is_user_bot( id ) || is_user_hltv( id ) ) return;
1310    
1311            flight_icons( id ); //redraw flashlight hud icons
1312            set_msg_block( SVC_STATUSICON, BLOCK_SET ); //Block buy menu
1313            set_msg_block( SVC_CLCORPSE, BLOCK_SET ); //block client corpses
1314    
1315            flight_icons( id ); //redraw flashlight hud icons
1316    
1317                          if( is_climber_alive( id ) )                          if( is_climber_alive( id ) )
1318                          {                          {
1319                                  //set_pev( id, pev_movetype, MOVETYPE_WALK )                  heal( id );
                                 //cs_set_user_team( id, 2 )  
1320    
1321                                  heal( id )                  //Execute commands from start/finish config
1322                                  sfexec( id, 1 )//Execute commands from start/finish config                  sfexec( id, 1 );
                                 if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard.  
1323    
1324                    //Show admin as VIP on Scoreboard.
1325                    if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 );
1326    
1327                    new cppos = timer[id][TMR_CPPOS] * 4;
1328    
1329                    //If they are paused tp to pause spot and freeze them again.
1330                                  if( timer[id][TMR_CFLAGS] & CF_PAUSE )                                  if( timer[id][TMR_CFLAGS] & CF_PAUSE )
1331                                  {//If they are paused tp to pause spot and freeze them again.                  {
1332                                          new Float:coords[3]                          new Float:coords[3];
1333                                          for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ]                          coords[0] = origins[ id ][ ORIG_PAUSX ];
1334                                          teleport( id, coords )                          coords[1] = origins[ id ][ ORIG_PAUSY ];
1335                                          cl_pause( id )                          coords[2] = origins[ id ][ ORIG_PAUSZ ];
1336                            teleport( id, coords );
1337                            cl_pause( id );
1338                                  }                                  }
   
1339                                  //Teleport to cp, start, or primary spawn position                                  //Teleport to cp, start, or primary spawn position
1340                                  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 );
1341                                  else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig )                  else teleport( id, start_tp_orig );
1342                          }                  //else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig ); //no need to tp to spawn_tp_orig, they're already there
1343                  }                  }
1344                  sortcssb( )                  sortcssb( )
1345          }          }
         else set_msg_block( SVC_STATUSICON, 0 )  
 }  
1346    
1347  public run_tasks( )  public run_tasks( )
1348  {  {
# Line 1451  Line 1352 
1352    
1353  public updatebot( )  public updatebot( )
1354  {  {
1355          if(get_pcvar_num(p_climb))          if( !get_pcvar_num(p_climb) ) return
1356          {  
                 //new players[32], cl  
                 //get_players( players, cl, "ach" )  
1357                  new id = find_player( "i" )                  new id = find_player( "i" )
                 //if(0<cl<3&&!id){  
1358                  new cl = get_playersnum( )                  new cl = get_playersnum( )
1359                  if( cl < MAXPLAYERS - 2 && !id )                  if( cl < MAXPLAYERS - 2 && !id )
1360                  {                  {
# Line 1493  Line 1391 
1391                                  cs_user_spawn( id )                                  cs_user_spawn( id )
1392                          }                          }
1393                  }                  }
                 //else if(cl>2&&id)server_cmd("kick #%d",get_user_userid(id))  
1394                  else if( cl == MAXPLAYERS - 1 && id )                  else if( cl == MAXPLAYERS - 1 && id )
1395                  {                  {
1396                          set_entity_visibility( id, 1 )                          set_entity_visibility( id, 1 )
1397                          server_cmd( "kick #%d", get_user_userid( id ) )                          server_cmd( "kick #%d", get_user_userid( id ) )
1398                  }                  }
1399                  else if( is_user_bot( id ) && id )          else if( id )
1400                  {                  {
1401                          set_entity_visibility( id, 0 )                          set_entity_visibility( id, 0 )
1402                          entity_set_int( id, EV_INT_solid, SOLID_NOT )                          entity_set_int( id, EV_INT_solid, SOLID_NOT )
# Line 1508  Line 1405 
1405                          call_think( id )                          call_think( id )
1406                  }                  }
1407          }          }
 }  
1408    
1409  public check_cvars( )  public check_cvars( )
1410  {  {
1411          static bool:nodraw          static bool:nodraw;
1412          if( get_pcvar_num( p_water_nodraw ) && !nodraw )          if( get_pcvar_num( p_water_nodraw ) && !nodraw )
1413          {          {
1414                  new ent = find_ent_by_class( -1, "func_water" )                  new ent = find_ent_by_class( -1, "func_water" );
1415                  while( ent > 0 )                  while( ent > 0 )
1416                  {                  {
1417                          set_entity_visibility( ent, 0 )                          set_entity_visibility( ent, 0 );
1418                          ent = find_ent_by_class( ent, "func_water" )                          ent = find_ent_by_class( ent, "func_water" );
1419                  }                  }
1420                  nodraw = true                  nodraw = true;
1421          }          }
1422          else if( !get_pcvar_num( p_water_nodraw ) && nodraw )          else if( !get_pcvar_num( p_water_nodraw ) && nodraw )
1423          {          {
1424                  new ent = find_ent_by_class( -1, "func_water" )                  new ent = find_ent_by_class( -1, "func_water" );
1425                  while( ent > 0 )                  while( ent > 0 )
1426                  {                  {
1427                          set_entity_visibility( ent, 1 )                          set_entity_visibility( ent, 1 );
1428                          ent = find_ent_by_class( ent, "func_water" )                          ent = find_ent_by_class( ent, "func_water" );
1429                  }                  }
1430                  nodraw = false                  nodraw = false;
1431          }          }
1432  }  }
1433    
# Line 1559  Line 1455 
1455          return dif          return dif
1456  }  }
1457    
1458    public boost_enabled( id, boost_type, silent )
1459    {
1460            if( get_pcvar_num( p_boost ) & boost_type ) return true;
1461            if( !silent ) clmsg( id, "That boost type has been disabled by the server admin." );
1462            return false;
1463    }
1464    
1465  stock change_boost( id, newboost, silent = 0 )  stock change_boost( id, newboost, silent = 0 )
1466  {//Change Boost flags  {//Change Boost flags
1467          if( !( cvar_enabled( id, p_boost, silent ) && isalive( id ) ) && notpaused( id ) ) return PLUGIN_HANDLED          //if( !( cvar_enabled( id, p_boost, silent ) && isalive( id ) ) && notpaused( id ) ) return;
1468            if( !isalive( id ) || !notpaused( id ) ) return;
1469    
1470          new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ]          new msg[151], rmflag, cflags = timer[ id ][ TMR_CFLAGS ];
1471          if( cflags & CF_SOLID )          if( cflags & CF_SOLID )
1472          {          {
1473                  if( task_exists( 150 + id ) ) remove_task( 150 + id )                  if( task_exists( 150 + id ) ) remove_task( 150 + id );
1474                  rmflag = CF_SOLID                  rmflag = CF_SOLID;
1475                  msg = "Solid Boost Disabled.^n"                  msg = "Solid Boost Disabled.^n";
1476          }          }
1477          else if( cflags & CF_SUPER_JUMP )          else if( cflags & CF_SUPER_JUMP )
1478          {          {
1479                  rmflag = CF_SUPER_JUMP                  rmflag = CF_SUPER_JUMP;
1480                  msg = "Super Jump Disabled.^n"                  msg = "Super Jump Disabled.^n";
1481          }          }
1482          else if( cflags & CF_DOUBLE_JUMP)          else if( cflags & CF_DOUBLE_JUMP)
1483          {          {
1484                  rmflag = CF_DOUBLE_JUMP                  rmflag = CF_DOUBLE_JUMP;
1485                  msg = "Double Jump Disabled.^n"                  msg = "Double Jump Disabled.^n";
1486          }          }
1487          if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag          if( rmflag > 0 ) timer[ id ][ TMR_CFLAGS ] -= rmflag;
1488          if( !( rmflag & newboost ) && \          if( !( rmflag & newboost ) &&
1489                  !check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) )                  !check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) )
1490          {          {
1491                  if( newboost == CF_SOLID )                  if( newboost == CF_SOLID && boost_enabled( id, SOLID, silent ) )
1492                  {                  {
1493                          format( msg, 150, "%sSolid Boost Enabled.", msg )                          format( msg, 150, "%sSolid Boost Enabled.", msg );
1494                          new ida[1]                          new ida[1];
1495                          ida[0] = id                          ida[0] = id;
1496                          set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 )                          set_task( 15.0, "solid_boost_timer", 150 + id, ida, 1 );
1497                          if( timer[ id - 1 ][ TMR_CFLAGS ] & CF_START ) timer[ id - 1 ][ TMR_CNTBST ]++                          if( timer[ id ][ TMR_CFLAGS ] & CF_START ) timer[ id ][ TMR_CNTBST ]++;
1498                    }
1499                    else if( newboost == CF_SUPER_JUMP && boost_enabled( id, SJUMP, silent ) )
1500                            format( msg, 150, "%sSuper Jump Enabled.", msg );
1501                    else if( newboost == CF_DOUBLE_JUMP && boost_enabled( id, DJUMP, silent ) )
1502                            format( msg, 150, "%sDouble Jump Enabled.", msg );
1503                    else return;
1504                    timer[ id ][ TMR_CFLAGS ] += newboost;
1505                  }                  }
1506                  if( newboost == CF_SUPER_JUMP ) format( msg, 150, "%sSuper Jump Enabled.", msg )          clmsg( id, msg );
                 if( newboost == CF_DOUBLE_JUMP ) format( msg, 150, "%sDouble Jump Enabled.", msg )  
                 timer[ id - 1 ][ TMR_CFLAGS ] |= newboost  
         }  
         if(strlen(msg))clmsg(id,msg)  
         return PLUGIN_HANDLED  
1507  }  }
1508    
1509  //Task to auto disable solid boost after timeout  //Task to auto disable solid boost after timeout
1510  public solid_boost_timer( ida[] )  public solid_boost_timer( ida[] )
1511          change_boost( ida[0], CF_SOLID )          change_boost( ida[0], CF_SOLID )
1512    
1513  /*public server_frame( )  //Semi-clip
1514  {//Semi-clip  public server_frame( )
         if( get_pcvar_num( p_climb ) )  
1515          {          {
1516                  new players[32], bool:skip[32], num, i, j          if( !get_pcvar_num( p_climb ) ) return FMRES_IGNORED
1517                  new Float:orig_i[3], Float:orig_j[3]  
1518                  new Float:vel_i[3], Float:vel_iz[3]          new players[32], num, i, j, Float:c1[3], Float:c2[3];
1519                  new id_i, id_j, cflags_i, cflags_j          new Float:c1z[3], Float:c2z[3];
1520                  get_players( players, num, "ac" )          new id_i, id_j, cflags_i, cflags_j;
1521            get_players( players, num, "ach" );
1522    
1523            //new Float:c1d[3],Float:c2d[3],xyadd,zadd
1524                  for( i = 0; i < num; i++ )                  for( i = 0; i < num; i++ )
1525                  {                  {
1526                          id_i = players[i]                  id_i = players[ i ];
1527                          cflags_i = timer[id_i][TMR_CFLAGS]                  cflags_i = timer[id_i][TMR_CFLAGS];
   
1528                          if( !( cflags_i & CF_PAUSE ) )                          if( !( cflags_i & CF_PAUSE ) )
1529                          {                          {
1530                                  entity_get_vector( id_i, EV_VEC_origin, orig_i )                          //Auto Semiclip
1531                                  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  
1532    
1533                            c1z[2] = c1[2];
1534                            c1[2] = 0.0;
1535                                  for( j=0; j<num; j++ )                                  for( j=0; j<num; j++ )
1536                                  {                                  {
1537                                          if( i != j )                                  id_j = players[j];
1538                                    cflags_j = timer[id_j][TMR_CFLAGS];
1539                                    if( !( cflags_j & CF_SOLID ) && i != j )
1540                                          {                                          {
1541                                                  id_j = players[j]                                          entity_get_vector( id_j, EV_VEC_origin, c2 );
                                                 cflags_j = timer[id_j][TMR_CFLAGS]  
1542    
1543                                                  if( ( !( cflags_i & CF_SOLID && cflags_j & CF_SOLID ) || skip[i] ) && !( cflags_j & CF_PAUSE ) )                                          c2z[2] = c2[2];
1544                                            c2[2] = 0.0;
1545                                            if( vector_distance( c1, c2 ) < 90 && vector_distance( c1z, c2z ) < 110)
1546                                                  {                                                  {
1547                                                          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] ) )  
1548                                                          {                                                          {
1549                                                                  unsolid( id_i )                                                          set_solid( id_i, 0 );
1550                                                                  unsolid( id_j )                                                          set_solid( id_j, 0 );
1551                                                                  skip[i] = true                                                          j = num;
                                                                 skip[j] = true  
                                                                 //maybe reset j first time i runs this, to unsolid anyone they might be boosting with  
                                                         }  
1552                                                  }                                                  }
1553                                          }                                          }
1554                                  }                                  }
1555                                  if( !skip[i] ) solid( id_i )                                  if( j + 1 == num ) set_solid( id_i );
1556                          }                          }
                 }  
         }  
         return PLUGIN_CONTINUE  
 }*/  
 public server_frame( )  
 {  
         if( !get_pcvar_num(p_climb) )  
                 return PLUGIN_CONTINUE  
1557    
         sc_fcount++  
         if( sc_fcount > 9 ) sc_fcount = 0  
1558    
1559          //Semi-clip                          //Semiclip touch detection
1560          new players[32],num,i,j,Float:c1[3],Float:c2[3]                          if( pev( id_i, pev_solid ) == SOLID_NOT )
1561          new Float:c1z[3],Float:c2z[3]                          {
1562          new id_i,id_j,cflags_i,cflags_j                                  new class[9], ptr, Float:v_orig[3];
1563          get_players(players,num,"ac")                                  pev( id_i, pev_origin, v_orig );
1564          //new Float:c1d[3],Float:c2d[3],xyadd,zadd                                  //v_orig[2] -= 18;
1565          for(i=0;i<num;i++){                                  v_orig[2] -= 10;
1566                  id_i=players[i]  
1567                  cflags_i=timer[id_i][TMR_CFLAGS]                                  new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, v_orig, 16.0 );
1568                  if(!(cflags_i&CF_PAUSE)){                                  while( ent > MAXPLAYERS )
1569                          //solid(players[i])                                  {
1570                          entity_get_vector(id_i,EV_VEC_origin,c1)                                          pev( ent, pev_classname, ptr, class, 8 );
1571                          //entity_get_vector(players[i],EV_VEC_velocity,c1d)                                          //trigger_teleport, trigger_once, trigger_multiple, trigger_gravity, trigger_push, trigger_hurt, func_door
1572                          c1z[2]=c1[2]                                          //if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) && !equal( class, "func_water" ) )
1573                          c1[2]=0.0                                          if( equal( class, "trigger_teleport" ) || equal( class, "trigger_hurt" ) ||
1574                          for(j=0;j<num;j++){                                                          equal( class, "trigger_once" ) || equal( class, "trigger_multiple" ) ||
1575                                  id_j=players[j]                                                          equal( class, "trigger_gravity" ) || equal( class, "trigger_push" ) ||
1576                                  cflags_j=timer[id_j][TMR_CFLAGS]                                                          equal( class, "func_door" ) )
1577                                  if(!(cflags_j&CF_SOLID)&&i!=j){                                                  {
1578                                          entity_get_vector(id_j,EV_VEC_origin,c2)                                                          dllfunc( DLLFunc_Touch, ent, id_i );
1579                                          //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  
                                                 }  
1580                                          }                                          }
1581                                            ent = engfunc( EngFunc_FindEntityInSphere, ent, v_orig, 16.0 );
1582                                  }                                  }
1583                                  if(j+1==num)solid(id_i)  
1584                          }                          }
1585                  }                  }
1586          }          }
1587          return PLUGIN_CONTINUE  
1588            return FMRES_IGNORED
1589  }  }
1590    
1591  stock bool:is_between_f( Float:mid, Float:a, Float:b )  stock bool:is_between_f( Float:mid, Float:a, Float:b )
# Line 1729  Line 1610 
1610          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 ) )
1611                  return PLUGIN_CONTINUE                  return PLUGIN_CONTINUE
1612    
1613          if( sclip[id] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX )          /*
1614            //Auto Semiclip
1615            new Float:vOrig[3], ent, count, Float:range
1616    
1617            range = pev( id, pev_speed ) * 0.5 + 50.0
1618    
1619            pev( id, pev_origin, vOrig )
1620    
1621            //if( !( timer[ id ][ TMR_CFLAGS ] & CF_SOLID ) )
1622            //{
1623            ent = engfunc( EngFunc_FindEntityInSphere, -1, vOrig, range )
1624            while( ent <= MAXPLAYERS )
1625            {
1626                    if( ent != id )
1627                    {
1628                            set_solid( ent, 0 )
1629                            count++
1630                    }
1631                    ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, range )
1632            }
1633            //}
1634            if( count ) set_solid( id, 0 )
1635            else set_solid( id )
1636    
1637    
1638            //Semiclip touch detection
1639            if( pev( id, pev_solid ) == SOLID_NOT )
1640            {
1641                    new class[9], ptr
1642                    //pev( id, pev_origin, vOrig )
1643    
1644                    new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, vOrig, 17.0 )
1645                    while( ent > 0 )
1646                    {
1647                            pev( ent, pev_classname, ptr, class, 8 )
1648                            if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) )
1649                                    dllfunc( DLLFunc_Touch, ent, id )
1650                            ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, 17.0 )
1651                    }
1652    
1653            }
1654            */
1655    
1656          //Detect button use. Replicated from HL SDK          //Detect button use. Replicated from HL SDK
1657          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 ) )
# Line 1814  Line 1736 
1736          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) )
1737                  return PLUGIN_CONTINUE                  return PLUGIN_CONTINUE
1738    
         if( sclip[id] ) entity_set_int( id, EV_INT_solid, SOLID_NOT )  
   
1739          if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) )          if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) )
1740          {          {
1741                  entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] )                  entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] )
# Line 1833  Line 1753 
1753          {          {
1754                  new Float:coords[3]                  new Float:coords[3]
1755                  entity_get_vector( id, EV_VEC_origin, coords )                  entity_get_vector( id, EV_VEC_origin, coords )
1756                  for( new i=0; i<3; i++ ) origins[id][ORIG_PAUS+i] = coords[i]  
1757                  origins[id][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity )                  origins[id][ORIG_PAUSX] = coords[0]
1758                    origins[id][ORIG_PAUSY] = coords[1]
1759                    origins[id][ORIG_PAUSZ] = coords[2]
1760                    origins[id][ORIG_PAUSG] = entity_get_float( id, EV_FL_gravity )
1761          }          }
1762          return PLUGIN_CONTINUE          return PLUGIN_CONTINUE
1763  }  }
# Line 1860  Line 1783 
1783    
1784          //new cflags = timer[id][TMR_CFLAGS]          //new cflags = timer[id][TMR_CFLAGS]
1785    
1786          if( btn_type == 1 )//Start Button          if( btn_type == 1 && !check_timeout( id, time_stamps[id][TS_SPAWN], SPAWN_TIMEOUT ) )//Start Button
1787          {          {
1788                  new Float:orig[3], bool:need_respawn = true //Float:view[3]                  new Float:orig[3], bool:need_respawn = true //Float:view[3]
1789                  if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false                  if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false
# Line 1990  Line 1913 
1913  }  }
1914    
1915  //Execute commands from start/finish config  //Execute commands from start/finish config
1916  public sfexec(id,clevent){  public sfexec( id, clevent )
1917    {
1918          new clstat[3],cflags=timer[id][TMR_CFLAGS]          new clstat[3],cflags=timer[id][TMR_CFLAGS]
1919          /*switch(timer[id][TMR_CFLAGS]){  
                 case TMR_CFLAGS_STOP: clstat="ns"  
                 case TMR_CFLAGS_STRT: clstat="st"  
                 case TMR_CFLAGS_FNSH: clstat="fn"  
         }*/  
1920          if(is_finished(id))clstat="fn"          if(is_finished(id))clstat="fn"
1921          else if(cflags&CF_STOP)clstat="ns"          else if(cflags&CF_STOP)clstat="ns"
1922          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"  
1923    
1924          for(new i=0;i<sfcount;i++){          new cmdstat[3], cmdevent[2], cmdtype[3], cmd[60], idtype[5], name[24]
1925                  new cmdstat[3],cmdevent[2],cmdtype[3],cmd[60],idtype[5]          for( new i = 0; i < sfcount; i++ )
1926                  parse(sfactions[i],cmdstat,2,cmdevent,1,cmdtype,2,cmd,sizeof(cmd)-1,idtype,4)          {
1927                  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 )
1928                          if(equali(cmdtype,"sc")){                  if( ( equali( cmdstat, clstat ) || equali( cmdstat, "ay" ) ) && str_to_num( cmdevent ) & clevent )
1929                                  if(equali(idtype,"uid"))format(cmd,sizeof(cmd)-1,cmd,get_user_userid(id))                  {
1930                                  else{                          if( equali( cmdtype, "sc" ) )
1931                                          new name[24]                          {
1932                                          get_user_name(id,name,sizeof(name)-1)                                  if( equali( idtype, "uid" ) )
1933                                          format(name,sizeof(name),"^"%s^"",name)                                          format( cmd, 59, cmd, get_user_userid( id ) )
1934                                          format(cmd,sizeof(cmd)-1,cmd,name)                                  else
1935                                    {
1936                                            get_user_name( id, name, 23 )
1937                                            format( name, 23, "^"%s^"", name )
1938                                            format( cmd, 59, cmd, name )
1939                                          client_print(id,print_chat,cmd)                                          client_print(id,print_chat,cmd)
1940                                  }                                  }
1941                                  server_cmd(cmd)                                  server_cmd(cmd)
1942                          }                          }
1943                          else{                          else
1944                            {
1945                                  client_cmd(id,cmd)                                  client_cmd(id,cmd)
1946                          }                          }
1947                  }                  }
1948          }          }
         return PLUGIN_HANDLED  
1949  }  }
1950    
1951  //Update frags to reorder scoreboard  //Update frags to reorder scoreboard
# Line 2085  Line 2007 
2007                  players[i] = pdata[i][2]                  players[i] = pdata[i][2]
2008  }  }
2009    
 /*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  
 }*/  
   
2010  stock sb_add_tabs( str[], size)  stock sb_add_tabs( str[], size)
2011  {  {
2012          new len = strlen( str )// > 7 ? 1 : 2          new len = strlen( str )// > 7 ? 1 : 2
# Line 2139  Line 2034 
2034    
2035                  get_players_ordered( players, num )                  get_players_ordered( players, num )
2036    
2037                  for( new i = 1; i <= num; i++ )                  for( new i = 0; i < num; i++ )
2038                  {                  {
2039                          tid = players[i]                          tid = players[i]
2040    
# Line 2165  Line 2060 
2060                          formatex( line, 250,                          formatex( line, 250,
2061                                  "%s%d   %s%s    %s      %s%s    %s%d%s",                                  "%s%d   %s%s    %s      %s%s    %s%d%s",
2062                                  i % 2 ? NULLSTR : "<div>",                                  i % 2 ? NULLSTR : "<div>",
2063                                  i, htmlspecialchars( name ),                                  i + 1, htmlspecialchars( name ),
2064                                  getuserstatus( tid ),                                  getuserstatus( tid ),
2065                                  parsetime( ctime ), ctime_str,                                  parsetime( ctime ), ctime_str,
2066                                  parsetime( btime ), btime_str,                                  parsetime( btime ), btime_str,
# Line 2284  Line 2179 
2179    
2180  stock clmsg( id, msg[] )  stock clmsg( id, msg[] )
2181  {//Show Hud Message  {//Show Hud Message
2182            //if( !strlen( msg ) ) return PLUGIN_HANDLED;
2183          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 ),
2184                  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 );
2185          show_hudmessage( id, msg )          show_hudmessage( id, msg );
2186    
2187          //Show to spectators          //Show to spectators
2188          for( new i = 1; i <= spec_ids[id][0]; i++ )          for( new i = 1; i <= spec_ids[id][0]; i++ )
2189                  show_hudmessage( spec_ids[id][i], msg )                  show_hudmessage( spec_ids[id][i], msg );
2190    
2191          return PLUGIN_HANDLED          return PLUGIN_HANDLED;
2192  }  }
2193    
2194  //Fill spectator data array used for msg replication  //Fill spectator data array used for msg replication
2195  public spec_update(){  public spec_update()
2196          if(get_pcvar_num(p_climb)){  {
2197                  new players[32],num,id,id2,i          if( !get_pcvar_num( p_climb ) ) return;
2198                  for(i=1;i<33;i++)spec_ids[i][0]=0  
2199                  get_players(players,num,"bch")          new players[32], num, id, id2, i;
2200                  for(i=0;i<num;i++){          for( i = 1; i < 33; i++ ) spec_ids[i][0] = 0;
2201                          id=players[i]          get_players( players, num, "bch" );
2202                          id2=pev(id,pev_iuser2)          for( i = 0; i < num; i++ )
2203                          if(id2){          {
2204                                  spec_ids[id2][0]++                  id = players[i];
2205                                  spec_ids[id2][spec_ids[id2][0]]=id                  id2 = pev( id, pev_iuser2 );
2206                    if( id2 )
2207                    {
2208                            spec_ids[id2][0]++;
2209                            spec_ids[id2][ spec_ids[id2][0] ] = id;
2210                          }                          }
2211                  }                  }
2212          }          }
2213          return PLUGIN_HANDLED  
2214    //Make client solid or unsolid
2215    stock set_solid( id, solid = 1 )
2216    {
2217            static old_fx[33], Float:old_col[33][3], old_render[33], old_amt[33];
2218            if( solid && pev( id, pev_solid ) == SOLID_NOT )
2219            {
2220                    set_pev( id, pev_renderfx, old_fx[id] );
2221                    set_pev( id, pev_rendermode, old_render[id] );
2222                    set_pev( id, pev_rendercolor, old_col[id] );
2223                    set_pev( id, pev_renderamt, old_amt[id] );
2224    
2225                    set_pev( id, pev_solid, SOLID_SLIDEBOX );
2226  }  }
2227  //Make client solid          else if( !solid && pev( id, pev_solid ) == SOLID_SLIDEBOX )
 public solid(id)  
2228  {  {
2229          set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,255)                  old_fx[id] = pev( id, pev_renderfx );
2230          entity_set_int(id,EV_INT_solid,SOLID_BBOX)                  old_render[id] = pev( id, pev_rendermode );
2231          sclip[id]=false                  pev( id, pev_rendercolor, old_col[id] );
2232          return PLUGIN_CONTINUE                  old_amt[id] = pev( id, pev_renderamt );
2233    
2234                    set_pev( id, pev_rendercolor, Float:{ 0.0, 0.0, 0.0 } );
2235                    if( get_pcvar_num(p_render) )
2236                    {
2237                            set_pev( id, pev_renderfx, kRenderFxHologram );
2238                            set_pev( id, pev_rendermode, kRenderTransAdd );
2239                            set_pev( id, pev_renderamt, float( 0 ) );
2240  }  }
2241  //Make client unsolid                  else
 public unsolid(id)  
2242  {  {
2243          if(get_pcvar_num(p_render))set_user_rendering(id,kRenderFxHologram,0,0,0,kRenderTransAdd,0)                          set_pev( id, pev_renderfx, kRenderFxPulseSlow );
2244          else set_user_rendering(id,kRenderFxPulseSlow,0,0,0,kRenderTransTexture,50)                          set_pev( id, pev_rendermode, kRenderTransTexture );
2245          entity_set_int(id,EV_INT_solid,SOLID_NOT)                          set_pev( id, pev_renderamt, float( 50 ) );
2246          sclip[id]=true                  }
2247          return PLUGIN_CONTINUE  
2248                    set_pev( id, pev_solid, SOLID_NOT );
2249            }
2250  }  }
2251    
2252  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
2253  //      Start: Functions for use in if statements  //      Start: Functions for use in if statements
2254  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
# Line 2341  Line 2262 
2262    
2263  public playersolid( id )  public playersolid( id )
2264  {  {
2265          if(entity_get_int(id,EV_INT_solid)==SOLID_BBOX)return 1          if( pev( id, pev_solid ) == SOLID_SLIDEBOX ) return 1
2266          return 0          return 0
2267  }  }
2268    
# Line 2435  Line 2356 
2356  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
2357  //      End: Auto Heal functions  //      End: Auto Heal functions
2358  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
2359  //      Start: Multiplay Bunny Hop functions  
 ////////////////////////////////////////////////////////////////////////////////  
2360  public pfn_touch( ent, id )  public pfn_touch( ent, id )
2361  {  {
2362          if( !get_pcvar_num( p_climb ) )          if( !get_pcvar_num( p_climb ) )
# Line 2461  Line 2381 
2381          }          }
2382          else return PLUGIN_HANDLED          else return PLUGIN_HANDLED
2383    
         if ( !ent || !id )  
2384                  return PLUGIN_CONTINUE                  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  
         }  
   
         return PLUGIN_CONTINUE  
 }  
   
 public door_in_array( door )  
 {  
         for( new i = 0; i < door_count; i++ )  
                 if( func_doors[i][0] == door )  
                         return i  
         return -1  
2385  }  }
2386    
 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  
 }*/  
   
2387  //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
2388  public phook( id )  public phook( id )
2389  {  {
# Line 2630  Line 2474 
2474    
2475          new Float:c2[3], player, players[32], num          new Float:c2[3], player, players[32], num
2476          get_players( players, num, "ac" )          get_players( players, num, "ac" )
2477          unsolid( id )          set_solid( id, 0 );
2478          for( new i = 0; i < num; i++ )          for( new i = 0; i < num; i++ )
2479          {          {
2480                  player = players[i]                  player = players[i]
2481                  if( id != player )                  if( id != player )
2482                  {                  {
2483                          entity_get_vector( player, EV_VEC_origin, c2 )                          entity_get_vector( player, EV_VEC_origin, c2 )
2484                          if( vector_distance( orig, c2 ) < 90 ) unsolid( player )                          if( vector_distance( orig, c2 ) < 90 ) set_solid( player, 0 );
2485                  }                  }
2486          }          }
2487          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} )
# Line 2741  Line 2585 
2585          if( get_pcvar_num( p_climb ) )          if( get_pcvar_num( p_climb ) )
2586                  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" )
2587    
2588    //Admin command, teleport to client
2589  public goto_player( id )  public goto_player( id )
 {//Admin command, teleport to client  
         if( is_finished( id ) && get_pcvar_num( p_climb ) )  
2590          {          {
2591            if( !is_finished( id ) || !get_pcvar_num( p_climb ) )
2592                    return
2593    
2594                  new tid, arg[24]                  new tid, arg[24]
2595                  read_argv( 1, arg, sizeof( arg ) - 1 )          read_argv( 1, arg, 23 )
2596                  tid = cmd_target( tid, arg, 4 )                  tid = cmd_target( tid, arg, 4 )
2597                  if( tid )                  if( tid )
2598                  {                  {
# Line 2755  Line 2601 
2601                          teleport( id, orig )                          teleport( id, orig )
2602                  }                  }
2603          }          }
         return PLUGIN_HANDLED  
 }  
2604    
2605  public spectate( id )  public spectate( id )
2606  {//Client switch to spectator  {//Client switch to spectator
# Line 2764  Line 2608 
2608          {          {
2609                  if( !is_climber_alive( id ) )                  if( !is_climber_alive( id ) )
2610                  {                  {
                         /*  
                         cs_set_user_team(id,3)//fixes respawn bug?  
                         frespawn( id )  
                         */  
   
2611                          climb_user_spawn( id )                          climb_user_spawn( id )
2612    
2613                          if( timer[id][TMR_CFLAGS] & CF_PAUSE )                          //already does this in the resethud function
2614                            /*if( timer[id][TMR_CFLAGS] & CF_PAUSE )
2615                          {//If they are paused tp to pause spot and freeze them again.                          {//If they are paused tp to pause spot and freeze them again.
2616                                  new Float:coords[3]                                  new Float:coords[3]
2617                                  for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ]  
2618                                    coords[0] = origins[ id ][ ORIG_PAUSX ]
2619                                    coords[1] = origins[ id ][ ORIG_PAUSY ]
2620                                    coords[2] = origins[ id ][ ORIG_PAUSZ ]
2621    
2622                                  teleport( id, coords )                                  teleport( id, coords )
2623                                  cl_pause( id )                                  cl_pause( id )
2624                          }                          }*/
2625    
2626                  }                  }
2627                  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 ) ) )
2628                  {                  {
                         //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 )  
   
2629                          set_pev( id, pev_movetype, MOVETYPE_NOCLIP )                          set_pev( id, pev_movetype, MOVETYPE_NOCLIP )
2630                          set_pev( id, pev_solid, SOLID_NOT )                          set_pev( id, pev_solid, SOLID_NOT )
2631                          set_pev( id, pev_effects, EF_NODRAW )                          set_pev( id, pev_effects, EF_NODRAW )
# Line 3452  Line 3283 
3283          new query[351], mapname[33], data[1]          new query[351], mapname[33], data[1]
3284          data[0] = id          data[0] = id
3285          get_mapname( mapname, 32 )          get_mapname( mapname, 32 )
3286          /*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 )*/  
3287          formatex( query, 350,          formatex( query, 350,
3288                  "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",
3289                  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] )
3290    
3291          SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 )          SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 )
3292  }  }
3293    
# Line 3471  Line 3301 
3301                          msg="^x04No stats available for this account on the current map."                          msg="^x04No stats available for this account on the current map."
3302                  else                  else
3303                  {                  {
3304                          new mapname[33]                          new mapname[33], Float:fTmp
3305                          get_mapname(mapname,32)                          get_mapname(mapname,32)
3306                          SQL_ReadResult( query, 0, timer[id][TMR_BSTTME] )                          SQL_ReadResult( query, 0, fTmp )
3307                          timer[id][TMR_BSTTME] *= 10                          timer[id][TMR_BSTTME] = floatround( fTmp * 10 )
3308                          timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 )                          timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 )
3309                          timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 )                          timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 )
3310                          timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 )                          timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 )
3311                          timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 )                          timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 )
3312                          timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 )                          timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 )
3313                          //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
3314    
3315                          formatex( msg, 99,                          formatex( msg, 99,
3316                                  "^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",
# Line 3668  Line 3498 
3498          {          {
3499                  new query[501], data[1]                  new query[501], data[1]
3500                  data[0] = id                  data[0] = id
3501                    //old
3502                    //select distinct p.alias, s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns, s.score from climb_scores s join climb_players p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt from climb_scores where map_name="clintmo_longjumper" group by user_id, wpns) g on p.user_id=g.user_id where map_name="clintmo_longjumper" and s.score=g.minscore order by s.score limit 20
3503                    //new
3504                    //select p.alias, s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns, s.score, s.score_id from climb_scores s join climb_players p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt, score_id from climb_scores where map_name="clintmo_longjumper" group by user_id, wpns) g on g.score_id=s.score_id order by s.score limit 20
3505                  formatex( query, 500,                  formatex( query, 500,
3506                          "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",
3507                          DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname )                          //DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname )
3508                            "select p.alias, s.fin_time, s.cps, s.gcs, g.fin_cnt, s.boosts, s.wpns, s.score, s.score_id from %sscores s join %splayers p on s.user_id = p.user_id join (select user_id, min(score) minscore, count(*) fin_cnt, score_id from %sscores where map_name=^"%s^" group by user_id, wpns) g on g.score_id=s.score_id order by s.score limit 20",
3509                            DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname )
3510    
3511                  SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 )                  SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 )
3512                  ts_hscore = get_systime()                  ts_hscore = get_systime()
3513          }          }
# Line 3723  Line 3559 
3559                          )                          )
3560                          sb_add_tabs( btime_str, 19 )                          sb_add_tabs( btime_str, 19 )
3561    
3562                            new Float:fTmp
3563                            SQL_ReadResult( query, 1, fTmp )
3564    
3565                          formatex( line, 150,\                          formatex( line, 150,\
3566                                  "%s%d   %s%s    %s      %d%s",                                  "%s%d   %s%s    %s      %d%s",
3567                                  i % 2 ? NULLSTR : "<div>",                                  i % 2 ? NULLSTR : "<div>",
3568                                  i, htmlspecialchars( name ),                                  i, htmlspecialchars( name ),
3569                                  parsetime( SQL_ReadResult( query, 1 ) * 10 ),                                  parsetime( floatround( fTmp * 10 ) ),
3570                                  btime_str,                                  btime_str,
3571                                  SQL_ReadResult( query, 4 ),                                  SQL_ReadResult( query, 4 ),
3572                                  i % 2 ? NULLSTR : "</div>" )                                  i % 2 ? NULLSTR : "</div>" )
# Line 3971  Line 3810 
3810  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
3811  //      End: Database functions  //      End: Database functions
3812  ////////////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////
3813  public rotwtf( string[], out_len )  //Simple Password Encryption
3814  {//Simple Password Encryption  public rotwtf( string[], out_len )//I should replace this with md5 since it's available now
3815    {
3816          new len=strlen( string ),str[99],cnt=0,tok=len-1          new len=strlen( string ),str[99],cnt=0,tok=len-1
3817          copy( str, out_len, string )          copy( str, out_len, string )
3818          for( new index=0; index<11; index++ )          for( new index=0; index<11; index++ )

Legend:
Removed from v.23  
changed lines
  Added in v.41

Contact
ViewVC Help
Powered by ViewVC 1.0.4