--- climb.sma 2007/11/20 22:36:56 25 +++ climb.sma 2008/02/24 09:34:01 40 @@ -128,7 +128,6 @@ +: Cvars mp_autoteambalance and mp_limitteams are set to 0 when a start button is found, and reverted when the map changes. +: Support for a2 maps start/finish buttons. +: Commands measure and measure2. -+: Multiplayer friendly bhops. +: Command 'weapons', gives client one of each speed weapon. +: Ranking by weapon speed. ex: If you beat a map with AWP, you'll be ranked above other weapon scores. +: Command countdown to have time countdown from your best time instead of counting up. @@ -136,7 +135,8 @@ -: Plugin ad on client connect. -: WebMod support since it is a huge security vulnerability. -: Cvars: climb_webmod, climb_stats_path, climb_stats_url, ip_internal, ip_external -c: Tweaked semiclip to hopefully eliminate lag problems reported by some people. +//c: Tweaked semiclip to hopefully eliminate lag problems reported by some people. +//c: New semiclip, should be flawless now. c: Cvar climb_water_nodraw changes take effect without reloading map. c: Database now stores multiple records per map per player. c: Cvar climb_db_pass is now protected. @@ -269,8 +269,9 @@ #include #include -new const VERSION[ ] = "a3.7.3 Nov 18 16:34 MST" +new const VERSION[ ] = "a3.7.7 Feb 23 18:32 MST" new const TRKCVAR[ ] = "climb_version" + new const DONOTHING[ ] = "donothing" new const NULLSTR[ ] = "" @@ -299,10 +300,10 @@ #define ORIGINS_SIZE 48 new Float:origins[33][ORIGINS_SIZE] #define ORIG_UNGC 40 -#define ORIG_PAUS 44 -//#define ORIG_X 0 -//#define ORIG_Y 1 -//#define ORIG_Z 2 +#define ORIG_PAUSX 44 +#define ORIG_PAUSY 45 +#define ORIG_PAUSZ 46 +#define ORIG_PAUSG 47 #define ORIG_GRAV 3 new time_stamps[33][5]//time_stamps[id][x] @@ -343,16 +344,10 @@ new ST_BTNS[9], FN_BTNS[9], ST_BTN_CNT = 0, FN_BTN_CNT = 0 new dyn_spawn_ids[32], dyn_spawn_count, Float:spawn_tp_orig[3], Float:start_tp_orig[3] -new bool:sclip[33],Float:post_think_vel[33][3],sc_fcount +new Float:post_think_vel[33][3] new LIMIT_TEAMS_OLD, TEAM_BALANCE_OLD -//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 } - //Cvar Pointers new p_climb, p_auto, p_boost, p_cpprice, p_startmoney new p_msg_r, p_msg_g, p_msg_b, p_msg_x, p_msg_y @@ -371,9 +366,7 @@ #define TSK_AUTORSPN 100 //100+: Auto Respawn //#define TSK_BOOSTTMR 150 //150+: Solid Boost Timer #define TSK_FLIGHT 200 -#define TSK_BHOP 250 -#define TSK_CLEAR_FAIL 300 -#define TSK_MEASURE2 350 +#define TSK_MEASURE2 250 //Status timer[id][TMR_CFLAGS]&=x #define CF_NULL 0 //Passed to change_boost() to remove all boost flags @@ -394,7 +387,12 @@ #define SILENT 1 -new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE +//Boost Flags for climb_boost CVAR +#define SOLID 1 +#define DJUMP 2 +#define SJUMP 4 + +new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE, SVC_CLCORPSE; new SCORES_PATH[100], HSCORES_PATH[100] @@ -409,7 +407,7 @@ p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) p_auto = register_cvar( "climb_auto", "1" ) - p_boost = register_cvar( "climb_boost", "1" ) + p_boost = register_cvar( "climb_boost", "7" ) p_cpprice = register_cvar( "climb_cpprice", "0" ) p_startmoney = register_cvar( "climb_startmoney", "1337" ) @@ -423,57 +421,58 @@ register_cvar( "climb_db_serverid", NULLSTR ) register_cvar( "climb_db_exists", "0" ) - p_msg_r = register_cvar( "climb_msg_r", "0" ) - p_msg_g = register_cvar( "climb_msg_g", "150" ) - p_msg_b = register_cvar( "climb_msg_b", "250" ) - p_msg_x = register_cvar( "climb_msg_x", "0.05" ) - p_msg_y = register_cvar( "climb_msg_y", "0.5" ) - - p_light_r = register_cvar( "climb_light_r", "255" ) - p_light_g = register_cvar( "climb_light_g", "255" ) - p_light_b = register_cvar( "climb_light_b", "255" ) - - p_sounds = register_cvar( "climb_sounds", "1" ) - p_render = register_cvar( "climb_unsolid_type", "0" ) - p_start_respawn = register_cvar( "climb_start_respawn", "0" ) - p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ) - - p_stats_hsurl = register_cvar( "climb_stats_hsurl", NULLSTR ) //Use %s in place of map name - p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR ) - - p_allow_spectators = get_cvar_pointer( "allow_spectators" ) - p_teambalance = get_cvar_pointer( "mp_autoteambalance" ) - p_limitteams = get_cvar_pointer( "mp_limitteams" ) + p_msg_r = register_cvar( "climb_msg_r", "0" ); + p_msg_g = register_cvar( "climb_msg_g", "150" ); + p_msg_b = register_cvar( "climb_msg_b", "250" ); + p_msg_x = register_cvar( "climb_msg_x", "0.05" ); + p_msg_y = register_cvar( "climb_msg_y", "0.5" ); + + p_light_r = register_cvar( "climb_light_r", "255" ); + p_light_g = register_cvar( "climb_light_g", "255" ); + p_light_b = register_cvar( "climb_light_b", "255" ); + + p_sounds = register_cvar( "climb_sounds", "1" ); + p_render = register_cvar( "climb_unsolid_type", "0" ); + p_start_respawn = register_cvar( "climb_start_respawn", "0" ); + p_water_nodraw = register_cvar( "climb_water_nodraw", "0" ); + + p_stats_hsurl = register_cvar( "climb_stats_hsurl", NULLSTR ); //Use %s in place of map name + p_stats_msg = register_cvar( "climb_stats_msg", NULLSTR ); + + p_allow_spectators = get_cvar_pointer( "allow_spectators" ); + p_teambalance = get_cvar_pointer( "mp_autoteambalance" ); + p_limitteams = get_cvar_pointer( "mp_limitteams" ); - MAXPLAYERS = get_maxplayers( ) + MAXPLAYERS = get_maxplayers( ); - TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ) - LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ) + TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ); + LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ); //Message Pseudo-Constants - SVC_STATUSICON = get_user_msgid( "StatusIcon" ) - SVC_TEAMINFO = get_user_msgid( "TeamInfo" ) - SVC_ROUNDTIME = get_user_msgid( "RoundTime" ) - SVC_FLASHLIGHT = get_user_msgid( "Flashlight" ) - SVC_SCREENFADE = get_user_msgid( "ScreenFade" ) + SVC_STATUSICON = get_user_msgid( "StatusIcon" ); + SVC_TEAMINFO = get_user_msgid( "TeamInfo" ); + SVC_ROUNDTIME = get_user_msgid( "RoundTime" ); + SVC_FLASHLIGHT = get_user_msgid( "Flashlight" ); + SVC_SCREENFADE = get_user_msgid( "ScreenFade" ); + SVC_CLCORPSE = get_user_msgid( "ClCorpse" ); //These commands get blocked always. - register_clcmd( "fullupdate", "block_cmd2" ) + register_clcmd( "fullupdate", "block_cmd2" ); //These commands get blocked when climb is enabled. - register_clcmd( "chooseteam", "spectate" ) - register_clcmd( "buy", "block_cmd" ) - register_clcmd( "buyammo1", "block_cmd" ) - register_clcmd( "buyammo2", "block_cmd" ) - register_clcmd( "buyequip", "block_cmd" ) + register_clcmd( "chooseteam", "spectate" ); + register_clcmd( "buy", "block_cmd" ); + register_clcmd( "buyammo1", "block_cmd" ); + register_clcmd( "buyammo2", "block_cmd" ); + register_clcmd( "buyequip", "block_cmd" ); - register_clcmd( "jointeam", "block_jointeam" ) + register_clcmd( "jointeam", "block_jointeam" ); //Commands to detect cheats. - register_clcmd( "+hook", "phook" ) - register_clcmd( "+rope", "phook" ) - register_clcmd( "-hook", "mhook" ) - register_clcmd( "-rope", "mhook" ) + register_clcmd( "+hook", "phook" ); + register_clcmd( "+rope", "phook" ); + register_clcmd( "-hook", "mhook" ); + register_clcmd( "-rope", "mhook" ); //Commands referencing function 'donothing' are picked up by the more flexible code in the client_command forward. register_clcmd( "say help", "help_msg" ) @@ -550,7 +549,7 @@ if( file_exists( ini ) ) { new line = 0, text[50], len - while( read_file( ini, line++, text, sizeof(text)-1 , len ) ) + while( read_file( ini, line++, text, 49 , len ) ) { if( !equal( text, ";", 1 ) && !equal( text, "#", 1 ) && !equal( text, "//", 2 ) ) { @@ -581,32 +580,6 @@ } } } - - 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 - } return PLUGIN_CONTINUE } @@ -615,83 +588,6 @@ { new ent, ent2, tmpstr[33], Float:tmpflt - 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 - } - } - } - } - } - } - //Store ent id's for start/fin buttons, some maps change target value after timer starts ent = find_ent_by_class( -1, "func_button" ) while( ent > 0 ) @@ -778,17 +674,6 @@ } } - //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" ) - } - } - //Remove map built in start button sounds ent = find_ent_by_class( -1, "ambient_generic" ) while( ent > 0 ) @@ -1030,7 +915,9 @@ //Do gocheck new cppos = timer[id][TMR_CPPOS] * 4 - for( new i=0; i<3; i++ ) coords[i] = origins[id][cppos + i] + coords[0] = origins[id][cppos] + coords[1] = origins[id][cppos + 1] + coords[2] = origins[id][cppos + 2] entity_set_float( id, EV_FL_gravity, origins[id][3] ) teleport( id, coords ) @@ -1148,8 +1035,8 @@ { cflags_new += CF_START set_entity_flags( id, FL_FROZEN, 0 ) - unsolid( id ) - entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUS + ORIG_GRAV] ) + //set_solid( id, 0 ); + entity_set_float( id, EV_FL_gravity, origins[id][ORIG_PAUSG] ) clmsg( id, "UNPAUSED" ) sfexec( id, 2 ) } @@ -1173,8 +1060,9 @@ { if( is_climber_alive( id ) ) { - unsolid( id ) + set_solid( id, 0 ); set_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderTransColor, 1 ) + //set_pev( id, pev_flags, pev( id, pev_flags ) & FL_FROZEN ) set_entity_flags( id, FL_FROZEN, 1 ) clmsg( id, "PAUSED - say '/unpause' to resume." ) } @@ -1395,7 +1283,7 @@ cs_user_spawn( id ) set_pev( id, pev_movetype, MOVETYPE_WALK ) - set_pev( id, pev_solid, SOLID_BBOX ) + set_pev( id, pev_solid, SOLID_SLIDEBOX ) set_pev( id, pev_effects, 0 ) set_pev( id, pev_deadflag, DEAD_NO ) set_pev( id, pev_takedamage, DAMAGE_AIM ) @@ -1412,38 +1300,49 @@ public ResetHUD( id ) {//Spawned - if( get_pcvar_num( p_climb ) ) + if( !get_pcvar_num( p_climb ) ) { - if( !is_user_bot( id ) && !is_user_hltv( id ) ) - { - flight_icons( id )//redraw flashlight hud icons - set_msg_block( SVC_STATUSICON, 2 )//Block buy menu - - if( is_climber_alive( id ) ) - { - //set_pev( id, pev_movetype, MOVETYPE_WALK ) - //cs_set_user_team( id, 2 ) - - heal( id ) - sfexec( id, 1 )//Execute commands from start/finish config - if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 )//Show admin as VIP on Scoreboard. - - if( timer[id][TMR_CFLAGS] & CF_PAUSE ) - {//If they are paused tp to pause spot and freeze them again. - new Float:coords[3] - for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] - teleport( id, coords ) - cl_pause( id ) - } - - //Teleport to cp, start, or primary spawn position - else if( origins[ id - 1 ][ 0 ] || origins[ id - 1][ 1 ] || origins[ id - 1 ][ 2 ]) gocheck( id ) - else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig ) - } + set_msg_block( SVC_STATUSICON, BLOCK_NOT ); + set_msg_block( SVC_CLCORPSE, BLOCK_NOT ); + return; + } + + if( is_user_bot( id ) || is_user_hltv( id ) ) return; + + flight_icons( id ); //redraw flashlight hud icons + set_msg_block( SVC_STATUSICON, BLOCK_SET ); //Block buy menu + set_msg_block( SVC_CLCORPSE, BLOCK_SET ); //block client corpses + + flight_icons( id ); //redraw flashlight hud icons + + if( is_climber_alive( id ) ) + { + heal( id ); + + //Execute commands from start/finish config + sfexec( id, 1 ); + + //Show admin as VIP on Scoreboard. + if( get_user_flags( id ) & VIP ) cs_set_user_scoreattrib( id, 4 ); + + new cppos = timer[id][TMR_CPPOS] * 4; + + //If they are paused tp to pause spot and freeze them again. + if( timer[id][TMR_CFLAGS] & CF_PAUSE ) + { + new Float:coords[3]; + coords[0] = origins[ id ][ ORIG_PAUSX ]; + coords[1] = origins[ id ][ ORIG_PAUSY ]; + coords[2] = origins[ id ][ ORIG_PAUSZ ]; + teleport( id, coords ); + cl_pause( id ); } - sortcssb( ) + //Teleport to cp, start, or primary spawn position + else if( origins[ id ][ cppos ] || origins[ id ][ cppos+1 ] || origins[ id ][ cppos+2 ] ) gocheck( id ); + else teleport( id, start_tp_orig ); + //else if( !teleport( id, start_tp_orig ) ) teleport( id, spawn_tp_orig ); //no need to tp to spawn_tp_orig, they're already there } - else set_msg_block( SVC_STATUSICON, 0 ) + sortcssb( ) } public run_tasks( ) @@ -1454,87 +1353,82 @@ public updatebot( ) { - if(get_pcvar_num(p_climb)) - { - //new players[32], cl - //get_players( players, cl, "ach" ) - new id = find_player( "i" ) - //if(02&&id)server_cmd("kick #%d",get_user_userid(id)) - else if( cl == MAXPLAYERS - 1 && id ) - { - set_entity_visibility( id, 1 ) - server_cmd( "kick #%d", get_user_userid( id ) ) - } - else if( is_user_bot( id ) && id ) - { - set_entity_visibility( id, 0 ) - entity_set_int( id, EV_INT_solid, SOLID_NOT ) - set_pev( id, pev_takedamage, DAMAGE_NO ) - entity_set_vector( id, EV_VEC_origin, Float:{999999,999999,999999} ) - call_think( id ) + if( !get_pcvar_num(p_climb) ) return + + new id = find_player( "i" ) + new cl = get_playersnum( ) + if( cl < MAXPLAYERS - 2 && !id ) + { + //Start borrowed code : from Space Headed's AMXX Bot(bot_api.sma) v0.5.1 + new name[32] + format( name, 31, "Climb v%s", VERSION ) + id = engfunc( EngFunc_CreateFakeClient, name ) + if( pev_valid( id ) ) + { + engfunc( EngFunc_FreeEntPrivateData, id ) + dllfunc( MetaFunc_CallGameEntity, "player", id ) + set_user_info( id, "rate", "3500" ) + set_user_info( id, "cl_updaterate", "25" ) + set_user_info( id, "cl_lw", "1" ) + set_user_info( id, "cl_lc", "1" ) + set_user_info( id, "cl_dlmax", "128" ) + set_user_info( id, "cl_righthand", "1" ) + set_user_info( id, "_vgui_menus", "0" ) + set_user_info( id, "_ah", "0" ) + set_user_info( id, "dm", "0" ) + set_user_info( id, "tracker", "0" ) + set_user_info( id, "friends", "0" ) + set_user_info( id, "*bot", "1" ) + set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT ) + set_pev( id, pev_colormap, id ) + + new msg[128] + dllfunc( DLLFunc_ClientConnect, id, name, "127.0.0.1", msg ) + dllfunc( DLLFunc_ClientPutInServer, id ) + engfunc( EngFunc_RunPlayerMove, id, Float:{0.0,0.0,0.0}, 0.0, 0.0, 0.0, 0, 0, 76 ) + //End borrowed code + + cs_set_user_team( id, 2 ) + cs_user_spawn( id ) } } + else if( cl == MAXPLAYERS - 1 && id ) + { + set_entity_visibility( id, 1 ) + server_cmd( "kick #%d", get_user_userid( id ) ) + } + else if( id ) + { + set_entity_visibility( id, 0 ) + entity_set_int( id, EV_INT_solid, SOLID_NOT ) + set_pev( id, pev_takedamage, DAMAGE_NO ) + entity_set_vector( id, EV_VEC_origin, Float:{999999,999999,999999} ) + call_think( id ) + } } public check_cvars( ) { - static bool:nodraw + static bool:nodraw; if( get_pcvar_num( p_water_nodraw ) && !nodraw ) { - new ent = find_ent_by_class( -1, "func_water" ) + new ent = find_ent_by_class( -1, "func_water" ); while( ent > 0 ) { - set_entity_visibility( ent, 0 ) - ent = find_ent_by_class( ent, "func_water" ) + set_entity_visibility( ent, 0 ); + ent = find_ent_by_class( ent, "func_water" ); } - nodraw = true + nodraw = true; } else if( !get_pcvar_num( p_water_nodraw ) && nodraw ) { - new ent = find_ent_by_class( -1, "func_water" ) + new ent = find_ent_by_class( -1, "func_water" ); while( ent > 0 ) { - set_entity_visibility( ent, 1 ) - ent = find_ent_by_class( ent, "func_water" ) + set_entity_visibility( ent, 1 ); + ent = find_ent_by_class( ent, "func_water" ); } - nodraw = false + nodraw = false; } } @@ -1562,152 +1456,137 @@ return dif } +public boost_enabled( id, boost_type, silent ) +{ + if( get_pcvar_num( p_boost ) & boost_type ) return true; + if( !silent ) clmsg( id, "That boost type has been disabled by the server admin." ); + return false; +} + stock change_boost( id, newboost, silent = 0 ) {//Change Boost flags - 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; + if( !isalive( id ) || !notpaused( id ) ) return; - new msg[151], rmflag, cflags = timer[ id - 1 ][ TMR_CFLAGS ] + new msg[151], rmflag, cflags = timer[ id ][ TMR_CFLAGS ]; if( cflags & CF_SOLID ) { - if( task_exists( 150 + id ) ) remove_task( 150 + id ) - rmflag = CF_SOLID - msg = "Solid Boost Disabled.^n" + if( task_exists( 150 + id ) ) remove_task( 150 + id ); + rmflag = CF_SOLID; + msg = "Solid Boost Disabled.^n"; } else if( cflags & CF_SUPER_JUMP ) { - rmflag = CF_SUPER_JUMP - msg = "Super Jump Disabled.^n" + rmflag = CF_SUPER_JUMP; + msg = "Super Jump Disabled.^n"; } else if( cflags & CF_DOUBLE_JUMP) { - rmflag = CF_DOUBLE_JUMP - msg = "Double Jump Disabled.^n" + rmflag = CF_DOUBLE_JUMP; + msg = "Double Jump Disabled.^n"; } - if( rmflag > 0 ) timer[ id - 1 ][ TMR_CFLAGS ] -= rmflag - if( !( rmflag & newboost ) && \ + if( rmflag > 0 ) timer[ id ][ TMR_CFLAGS ] -= rmflag; + if( !( rmflag & newboost ) && !check_timeout( id, time_stamps[id][TS_BOOST], BOOST_TIMEOUT, ( cflags & CF_START ? timer[id][TMR_CNTTME] / 10 : get_systime() ) ) ) { - if( newboost == CF_SOLID ) + if( newboost == CF_SOLID && boost_enabled( id, SOLID, silent ) ) { - 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 ]++ - } - if( newboost == CF_SUPER_JUMP ) format( msg, 150, "%sSuper Jump Enabled.", msg ) - if( newboost == CF_DOUBLE_JUMP ) format( msg, 150, "%sDouble Jump Enabled.", msg ) - timer[ id - 1 ][ TMR_CFLAGS ] |= newboost + 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 ][ TMR_CFLAGS ] & CF_START ) timer[ id ][ TMR_CNTBST ]++; + } + else if( newboost == CF_SUPER_JUMP && boost_enabled( id, SJUMP, silent ) ) + format( msg, 150, "%sSuper Jump Enabled.", msg ); + else if( newboost == CF_DOUBLE_JUMP && boost_enabled( id, DJUMP, silent ) ) + format( msg, 150, "%sDouble Jump Enabled.", msg ); + else return; + timer[ id ][ TMR_CFLAGS ] += newboost; } - if(strlen(msg))clmsg(id,msg) - return PLUGIN_HANDLED + clmsg( id, msg ); } //Task to auto disable solid boost after timeout public solid_boost_timer( ida[] ) change_boost( ida[0], CF_SOLID ) -/*public server_frame( ) -{//Semi-clip - if( get_pcvar_num( p_climb ) ) +//Semi-clip +public server_frame( ) +{ + if( !get_pcvar_num( p_climb ) ) return FMRES_IGNORED + + new players[32], num, i, j, Float:c1[3], Float:c2[3]; + new Float:c1z[3], Float:c2z[3]; + new id_i, id_j, cflags_i, cflags_j; + get_players( players, num, "ach" ); + + //new Float:c1d[3],Float:c2d[3],xyadd,zadd + for( i = 0; i < num; i++ ) { - new players[32], bool:skip[32], num, i, j - new Float:orig_i[3], Float:orig_j[3] - new Float:vel_i[3], Float:vel_iz[3] - new id_i, id_j, cflags_i, cflags_j - get_players( players, num, "ac" ) - for( i = 0; i < num; i++ ) - { - id_i = players[i] - cflags_i = timer[id_i][TMR_CFLAGS] - - if( !( cflags_i & CF_PAUSE ) ) - { - entity_get_vector( id_i, EV_VEC_origin, orig_i ) - entity_get_vector( id_i, EV_VEC_velocity, vel_i ) - - 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 - - for( j=0; j 9 ) sc_fcount = 0 - - //Semi-clip - new players[32],num,i,j,Float:c1[3],Float:c2[3] - new Float:c1z[3],Float:c2z[3] - new id_i,id_j,cflags_i,cflags_j - get_players(players,num,"ac") - //new Float:c1d[3],Float:c2d[3],xyadd,zadd - for(i=0;i25&&vector_distance(c1z,c2z)>30)){ - unsolid(id_i) - unsolid(id_j) - j=num + + + //Semiclip touch detection + if( pev( id_i, pev_solid ) == SOLID_NOT ) + { + new class[9], ptr, Float:v_orig[3]; + pev( id_i, pev_origin, v_orig ); + //v_orig[2] -= 18; + v_orig[2] -= 10; + + new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, v_orig, 16.0 ); + while( ent > MAXPLAYERS ) + { + pev( ent, pev_classname, ptr, class, 8 ); + //trigger_teleport, trigger_once, trigger_multiple, trigger_gravity, trigger_push, trigger_hurt, func_door + //if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) && !equal( class, "func_water" ) ) + if( equal( class, "trigger_teleport" ) || equal( class, "trigger_hurt" ) || + equal( class, "trigger_once" ) || equal( class, "trigger_multiple" ) || + equal( class, "trigger_gravity" ) || equal( class, "trigger_push" ) || + equal( class, "func_door" ) ) + { + dllfunc( DLLFunc_Touch, ent, id_i ); + //break; } - } + ent = engfunc( EngFunc_FindEntityInSphere, ent, v_orig, 16.0 ); } - if(j+1==num)solid(id_i) + } } } - return PLUGIN_CONTINUE + + return FMRES_IGNORED } stock bool:is_between_f( Float:mid, Float:a, Float:b ) @@ -1732,7 +1611,48 @@ if( !get_pcvar_num( p_climb ) || is_user_bot( id ) || !is_climber_alive( id ) ) return PLUGIN_CONTINUE - if( sclip[id] && sc_fcount == 9 ) entity_set_int( id, EV_INT_solid, SOLID_BBOX ) + /* + //Auto Semiclip + new Float:vOrig[3], ent, count, Float:range + + range = pev( id, pev_speed ) * 0.5 + 50.0 + + pev( id, pev_origin, vOrig ) + + //if( !( timer[ id ][ TMR_CFLAGS ] & CF_SOLID ) ) + //{ + ent = engfunc( EngFunc_FindEntityInSphere, -1, vOrig, range ) + while( ent <= MAXPLAYERS ) + { + if( ent != id ) + { + set_solid( ent, 0 ) + count++ + } + ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, range ) + } + //} + if( count ) set_solid( id, 0 ) + else set_solid( id ) + + + //Semiclip touch detection + if( pev( id, pev_solid ) == SOLID_NOT ) + { + new class[9], ptr + //pev( id, pev_origin, vOrig ) + + new ent = engfunc( EngFunc_FindEntityInSphere, MAXPLAYERS, vOrig, 17.0 ) + while( ent > 0 ) + { + pev( ent, pev_classname, ptr, class, 8 ) + if( equal( class, "trigger_", 8 ) || equal( class, "func_", 5 ) ) + dllfunc( DLLFunc_Touch, ent, id ) + ent = engfunc( EngFunc_FindEntityInSphere, ent, vOrig, 17.0 ) + } + + } + */ //Detect button use. Replicated from HL SDK if( get_user_button( id ) & IN_USE && !( get_user_oldbutton( id ) & IN_USE ) ) @@ -1746,7 +1666,7 @@ { get_brush_entity_origin( entlist[i], orig ) if( is_in_viewcone( id, orig ) ) button_used( id, entlist[i] ) - } + } } } @@ -1817,8 +1737,6 @@ if( !( get_pcvar_num(p_climb) && get_pcvar_num(p_boost) && is_climber_alive( id ) ) || is_user_bot(id) ) return PLUGIN_CONTINUE - if( sclip[id] ) entity_set_int( id, EV_INT_solid, SOLID_NOT ) - if( _:get_distance( _:post_think_vel[id], { 0, 0, 0 } ) ) { entity_set_vector( id, EV_VEC_velocity, post_think_vel[id] ) @@ -1836,8 +1754,11 @@ { new Float:coords[3] entity_get_vector( id, EV_VEC_origin, coords ) - for( new i=0; i<3; i++ ) origins[id][ORIG_PAUS+i] = coords[i] - origins[id][ORIG_PAUS+3] = entity_get_float( id, EV_FL_gravity ) + + origins[id][ORIG_PAUSX] = coords[0] + origins[id][ORIG_PAUSY] = coords[1] + origins[id][ORIG_PAUSZ] = coords[2] + origins[id][ORIG_PAUSG] = entity_get_float( id, EV_FL_gravity ) } return PLUGIN_CONTINUE } @@ -1863,7 +1784,7 @@ //new cflags = timer[id][TMR_CFLAGS] - if( btn_type == 1 )//Start Button + if( btn_type == 1 && !check_timeout( id, time_stamps[id][TS_SPAWN], SPAWN_TIMEOUT ) )//Start Button { new Float:orig[3], bool:need_respawn = true //Float:view[3] if( timer[id][TMR_CFLAGS] & CF_START ) need_respawn = false @@ -1993,40 +1914,39 @@ } //Execute commands from start/finish config -public sfexec(id,clevent){ - new clstat[3],cflags=timer[id][TMR_CFLAGS] - /*switch(timer[id][TMR_CFLAGS]){ - case TMR_CFLAGS_STOP: clstat="ns" - case TMR_CFLAGS_STRT: clstat="st" - case TMR_CFLAGS_FNSH: clstat="fn" - }*/ - if(is_finished(id))clstat="fn" - else if(cflags&CF_STOP)clstat="ns" - 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" - - for(new i=0;i 7 ? 1 : 2 @@ -2168,7 +2061,7 @@ formatex( line, 250, "%s%d %s%s %s %s%s %s%d%s", i % 2 ? NULLSTR : "
", - i, htmlspecialchars( name ), + i + 1, htmlspecialchars( name ), getuserstatus( tid ), parsetime( ctime ), ctime_str, parsetime( btime ), btime_str, @@ -2287,50 +2180,76 @@ stock clmsg( id, msg[] ) {//Show Hud Message + //if( !strlen( msg ) ) return PLUGIN_HANDLED; set_hudmessage( get_pcvar_num( p_msg_r ), get_pcvar_num( p_msg_g ), get_pcvar_num( p_msg_b ), - get_pcvar_float( p_msg_x ), get_pcvar_float( p_msg_y ), 0, 0.0, 5.0, 0.5, 0.5, 4 ) - show_hudmessage( id, msg ) + get_pcvar_float( p_msg_x ), get_pcvar_float( p_msg_y ), 0, 0.0, 5.0, 0.5, 0.5, 4 ); + show_hudmessage( id, msg ); //Show to spectators for( new i = 1; i <= spec_ids[id][0]; i++ ) - show_hudmessage( spec_ids[id][i], msg ) - - return PLUGIN_HANDLED + show_hudmessage( spec_ids[id][i], msg ); + + return PLUGIN_HANDLED; } + //Fill spectator data array used for msg replication -public spec_update(){ - if(get_pcvar_num(p_climb)){ - new players[32],num,id,id2,i - for(i=1;i<33;i++)spec_ids[i][0]=0 - get_players(players,num,"bch") - for(i=0;i -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 -} - -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 - return 0 -}*/ - //Future use, to block hook, or detect hook cheaters a.k.a. hookers public phook( id ) { @@ -2633,14 +2475,14 @@ new Float:c2[3], player, players[32], num get_players( players, num, "ac" ) - unsolid( id ) + set_solid( id, 0 ); for( new i = 0; i < num; i++ ) { player = players[i] if( id != player ) { entity_get_vector( player, EV_VEC_origin, c2 ) - if( vector_distance( orig, c2 ) < 90 ) unsolid( player ) + if( vector_distance( orig, c2 ) < 90 ) set_solid( player, 0 ); } } entity_set_vector( id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0} ) @@ -2744,21 +2586,21 @@ if( get_pcvar_num( p_climb ) ) show_motd( id, "http://ian.cammarata.us/projects/climb/help/2a3/en/boosts?agent=hl", "Climb Plugin Help" ) +//Admin command, teleport to client public goto_player( id ) -{//Admin command, teleport to client - if( is_finished( id ) && get_pcvar_num( p_climb ) ) - { - new tid, arg[24] - read_argv( 1, arg, sizeof( arg ) - 1 ) - tid = cmd_target( tid, arg, 4 ) - if( tid ) - { - new Float:orig[3] - entity_get_vector( tid, EV_VEC_origin, orig ) - teleport( id, orig ) - } +{ + if( !is_finished( id ) || !get_pcvar_num( p_climb ) ) + return + + new tid, arg[24] + read_argv( 1, arg, 23 ) + tid = cmd_target( tid, arg, 4 ) + if( tid ) + { + new Float:orig[3] + entity_get_vector( tid, EV_VEC_origin, orig ) + teleport( id, orig ) } - return PLUGIN_HANDLED } public spectate( id ) @@ -2767,37 +2609,24 @@ { if( !is_climber_alive( id ) ) { - /* - cs_set_user_team(id,3)//fixes respawn bug? - frespawn( id ) - */ - climb_user_spawn( id ) - if( timer[id][TMR_CFLAGS] & CF_PAUSE ) + //already does this in the resethud function + /*if( timer[id][TMR_CFLAGS] & CF_PAUSE ) {//If they are paused tp to pause spot and freeze them again. new Float:coords[3] - for( new i=0; i<3; i++ ) coords[i] = origins[ id - 1 ][ ORIG_PAUS + i ] + + coords[0] = origins[ id ][ ORIG_PAUSX ] + coords[1] = origins[ id ][ ORIG_PAUSY ] + coords[2] = origins[ id ][ ORIG_PAUSZ ] + teleport( id, coords ) cl_pause( id ) - } + }*/ } else if( get_user_flags( id ) & VIP ? 1 : ( cvar_enabled( id, p_allow_spectators ) ) ) { - //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 ) - set_pev( id, pev_movetype, MOVETYPE_NOCLIP ) set_pev( id, pev_solid, SOLID_NOT ) set_pev( id, pev_effects, EF_NODRAW ) @@ -2832,7 +2661,7 @@ if(equal(cmd,"say")||equal(cmd,"say_team")){ read_argv(1,cmd,20) trim(cmd) - if(contain(cmd," ")>-1)return PLUGIN_CONTINUE + if( contain( cmd, " " ) > -1 ) return PLUGIN_CONTINUE } //Remove slashes @@ -3455,12 +3284,11 @@ new query[351], mapname[33], data[1] data[0] = id get_mapname( mapname, 32 ) - /*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 )*/ + formatex( query, 350, - "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", DB_PREFIX, DB_PREFIX, mapname, mapname, timer[id][TMR_DBUSER], timer[id][TMR_DBUSER] ) + SQL_ThreadQuery( DB_TUPLE, "db_load_handler", query, data, 1 ) } @@ -3474,16 +3302,16 @@ msg="^x04No stats available for this account on the current map." else { - new mapname[33] + new mapname[33], Float:fTmp get_mapname(mapname,32) - SQL_ReadResult( query, 0, timer[id][TMR_BSTTME] ) - timer[id][TMR_BSTTME] *= 10 + SQL_ReadResult( query, 0, fTmp ) + timer[id][TMR_BSTTME] = floatround( fTmp * 10 ) timer[id][TMR_BSTCPS] = SQL_ReadResult( query, 1 ) timer[id][TMR_BSTGCS] = SQL_ReadResult( query, 2 ) timer[id][TMR_MAPFIN] = SQL_ReadResult( query, 3 ) timer[id][TMR_BSTBST] = SQL_ReadResult( query, 4 ) timer[id][TMR_BSTWPN] = SQL_ReadResult( query, 5 ) - //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 formatex( msg, 99, "^x04Stats loaded for %s - %s^t(%d/ %d CP/%d GC/%d Boost)^tCompleted %d", @@ -3675,6 +3503,7 @@ formatex( query, 500, "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", DB_PREFIX, DB_PREFIX, DB_PREFIX, mapname, mapname ) + SQL_ThreadQuery( DB_TUPLE, "hs_handler", query, data, 1 ) ts_hscore = get_systime() } @@ -3726,11 +3555,14 @@ ) sb_add_tabs( btime_str, 19 ) + new Float:fTmp + SQL_ReadResult( query, 1, fTmp ) + formatex( line, 150,\ "%s%d %s%s %s %d%s", i % 2 ? NULLSTR : "
", i, htmlspecialchars( name ), - parsetime( SQL_ReadResult( query, 1 ) * 10 ), + parsetime( floatround( fTmp * 10 ) ), btime_str, SQL_ReadResult( query, 4 ), i % 2 ? NULLSTR : "
" ) @@ -3974,9 +3806,10 @@ //////////////////////////////////////////////////////////////////////////////// // End: Database functions //////////////////////////////////////////////////////////////////////////////// -public rotwtf( string[], out_len ) -{//Simple Password Encryption - new len=strlen( string ),str[99],cnt=0,tok=len-1 +//Simple Password Encryption +public rotwtf( string[], out_len )//I should replace this with md5 since it's available now +{ + new len = strlen( string ), str[99], cnt = 0, tok = len - 1 copy( str, out_len, string ) for( new index=0; index<11; index++ ) {