--- climb.sma 2007/11/18 00:28:32 21 +++ climb.sma 2007/11/18 13:22:37 22 @@ -268,7 +268,10 @@ #include #include -#define VERSION "a3.7.0 Nov 17 16:17 MST" +new const VERSION[ ] = "a3.7.1 Nov 18 06:22 MST" +new const TRKCVAR[ ] = "climb_version" +new const DONOTHING[ ] = "donothing" +new const NULLSTR[ ] = "" #define IN_ATTACK_EITHER ( IN_ATTACK + IN_ATTACK2 ) @@ -389,37 +392,6 @@ #define CF_COUNTDOWN (1<<11) #define CF_SUNGLASSES (1<<12) -new WPN_CLASS[30][17] = { "weapon_p228", - "", - "weapon_scout", - "", //"weapon_hegrenade", - "weapon_xm1014", - "", //"weapon_c4", - "weapon_mac10", - "weapon_aug", - "", //"weapon_smokegrenade", - "weapon_elite", - "weapon_fiveseven", - "weapon_ump45", - "weapon_sg550", - "weapon_galil", - "weapon_famas", - "weapon_usp", - "weapon_glock18", - "weapon_awp", - "weapon_mp5navy", - "weapon_m249", - "weapon_m3", - "weapon_m4a1", - "weapon_tmp", - "weapon_g3sg1", - "", //"weapon_flashbang", - "weapon_deagle", - "weapon_sg552", - "weapon_ak47", - "", //"weapon_knife", - "weapon_p90" } - new SVC_STATUSICON, SVC_TEAMINFO, SVC_ROUNDTIME, SVC_FLASHLIGHT, SVC_SCREENFADE new SCORES_PATH[100], HSCORES_PATH[100] @@ -428,13 +400,10 @@ // Start: Init forwards //////////////////////////////////////////////////////////////////////////////// public plugin_init( ) -{ - MAXPLAYERS = get_maxplayers( ) +{ register_plugin( "Climb", VERSION, "Ian Cammarata" ) - register_cvar( "climb_version", VERSION, FCVAR_SERVER ) - - //This line is for nightly builds only, to keep tracking cvar updated. - set_cvar_string( "climb_version", VERSION ) + register_cvar( TRKCVAR, VERSION, FCVAR_SERVER ) + set_cvar_string( TRKCVAR, VERSION ) p_climb = register_cvar( "climb", "0", FCVAR_SERVER ) p_auto = register_cvar( "climb_auto", "1" ) @@ -445,11 +414,11 @@ register_cvar( "climb_save", "1" ) register_cvar( "climb_db_type", "sqlite" ) register_cvar( "climb_db_host", "127.0.0.1" ) - register_cvar( "climb_db_user", "" ) - register_cvar( "climb_db_pass", "", FCVAR_PROTECTED ) + register_cvar( "climb_db_user", NULLSTR ) + register_cvar( "climb_db_pass", NULLSTR, FCVAR_PROTECTED ) register_cvar( "climb_db_name", "climb" ) register_cvar( "climb_db_prefix", "climb_" ) - register_cvar( "climb_db_serverid", "" ) + register_cvar( "climb_db_serverid", NULLSTR ) register_cvar( "climb_db_exists", "0" ) p_msg_r = register_cvar( "climb_msg_r", "0" ) @@ -467,13 +436,15 @@ 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", "" ) //Use %s in place of map name - p_stats_msg = register_cvar( "climb_stats_msg", "" ) + 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( ) + TEAM_BALANCE_OLD = get_pcvar_num( p_teambalance ) LIMIT_TEAMS_OLD = get_pcvar_num( p_limitteams ) @@ -505,18 +476,18 @@ //Commands referencing function 'donothing' are picked up by the more flexible code in the client_command forward. register_clcmd( "say help", "help_msg" ) register_clcmd( "say /help", "help_msg" ) - register_clcmd( "climbhelp", "donothing", 0, "- Veiw climb help." ) - register_clcmd( "cp", "donothing", _, "- Make a checkpoint" ) - register_clcmd( "gc", "donothing", _, "- Teleport to last checkpoint" ) - register_clcmd( "stuck", "donothing", _, "- Teleport to previous checkpoint" ) - register_clcmd( "restart","donothing", _, "- Stop and respawn." ) - register_clcmd( "stop", "donothing", _, "- End current climbing run." ) - register_clcmd( "pause", "donothing", _, "- Pause yourself." ) - register_clcmd( "scoreboard", "donothing", _, "- View score board." ) - register_clcmd( "respawn", "donothing", _, "- Force respawn" ) - register_clcmd( "boost", "donothing", _, "- Boost." ) - register_clcmd( "spec", "donothing", _, "- Spectate mode." ) - register_clcmd( "ungc", "donothing", _, "- Undo last gocheck." ) + register_clcmd( "climbhelp", DONOTHING, 0, "- Veiw climb help." ) + register_clcmd( "cp", DONOTHING, _, "- Make a checkpoint" ) + register_clcmd( "gc", DONOTHING, _, "- Teleport to last checkpoint" ) + register_clcmd( "stuck", DONOTHING, _, "- Teleport to previous checkpoint" ) + register_clcmd( "restart", DONOTHING, _, "- Stop and respawn." ) + register_clcmd( "stop", DONOTHING, _, "- End current climbing run." ) + register_clcmd( "pause", DONOTHING, _, "- Pause yourself." ) + register_clcmd( "scoreboard", DONOTHING, _, "- View score board." ) + register_clcmd( "respawn", DONOTHING, _, "- Force respawn" ) + register_clcmd( "boost", DONOTHING, _, "- Boost." ) + register_clcmd( "spec", DONOTHING, _, "- Spectate mode." ) + register_clcmd( "ungc", DONOTHING, _, "- Undo last gocheck." ) //Commands related to stats account system. //register_clcmd( "register", "reg", _, "- (Console Only) Register for stats tracking." ) @@ -540,7 +511,7 @@ //Events register_event("DeathMsg","DeathMsg","a") register_event("ResetHUD","ResetHUD","b") - register_event("Health","damage","b") + register_event("Health","Health","b") register_event("ShowMenu","menuclass","b","4&CT_Select","4&Terrorist_Select") register_event("ShowMenu","menuteam","b","4&Team_Select_Spect","4&Team_Select","4&IG_Team_Select") @@ -556,8 +527,6 @@ set_task( 5.0, "run_tasks", _, _, _, "b" ) register_message( get_user_msgid( "CurWeapon" ), "CurWeapon" ) - register_message( get_user_msgid( "ReqState" ), "bot_msg_block" ) - register_message( get_user_msgid( "Radar" ), "bot_msg_block" ) register_forward( FM_UpdateClientData, "PostUpdateClientData", 1 ) @@ -958,7 +927,7 @@ //erase previous save if exists for( new i=0; i<32; i++ ) - if( equal( saveid, steamid[i] ) ) steamid[i] = "" + if( equal( saveid, steamid[i] ) ) steamid[i] = NULLSTR if( timer[id][TMR_CFLAGS] & CF_START ) change_status( id, CF_PAUSE ) //Pause if running steamid[savepos] = saveid //save steamid to position reference @@ -1259,45 +1228,49 @@ client_oldwpn[id] = wpn + if( wpn == CSW_C4 || + wpn == CSW_HEGRENADE || + wpn == CSW_FLASHBANG || + wpn == CSW_SMOKEGRENADE || + wpn == CSW_KNIFE + ) return PLUGIN_CONTINUE + //If it's a gun, update pack and clip ammo & silencer - if( strlen( WPN_CLASS[wpn-1] ) ) + new wpn_id = get_user_weapon( id ) + if( !wpn_id ) return PLUGIN_CONTINUE + + new clip = get_msg_arg_int( 3 ) + new maxammo = 2 + + //Force silencer w/o animation + if( wpn == CSW_USP || wpn == CSW_M4A1 || wpn == CSW_TMP ) { - new wpn_id = find_ent_by_owner( -1, WPN_CLASS[wpn-1], id ) - if( !wpn_id ) return PLUGIN_CONTINUE - - new clip = get_msg_arg_int( 3 ) - new maxammo = 2 - - //Force silencer w/o animation - if( wpn == CSW_USP || wpn == CSW_M4A1 || wpn == CSW_TMP ) - { - if( wpn != CSW_TMP ) cs_set_weapon_silen( wpn_id, 1, 0 ) - maxammo = 10 - - //Unlimited ammo for VIPs - if( get_user_flags(id) & VIP ) - { - cs_set_weapon_ammo( wpn_id, 12 ) - if( clip != 12 )return PLUGIN_HANDLED - set_msg_arg_int( 3, ARG_BYTE, 12 ) - return PLUGIN_CONTINUE - } - } + if( wpn != CSW_TMP ) cs_set_weapon_silen( wpn_id, 1, 0 ) + maxammo = 10 - //Set clip and backpack ammo - cs_set_user_bpammo( id, wpn, maxammo - clip ) - if( clip > maxammo ) + //Unlimited ammo for VIPs + if( get_user_flags(id) & VIP ) { - set_msg_arg_int( 3, ARG_BYTE, maxammo ) - cs_set_weapon_ammo( wpn_id, maxammo ) + cs_set_weapon_ammo( wpn_id, 12 ) + if( clip != 12 )return PLUGIN_HANDLED + set_msg_arg_int( 3, ARG_BYTE, 12 ) + return PLUGIN_CONTINUE } } + //Set clip and backpack ammo + cs_set_user_bpammo( id, wpn, maxammo - clip ) + if( clip > maxammo ) + { + set_msg_arg_int( 3, ARG_BYTE, maxammo ) + cs_set_weapon_ammo( wpn_id, maxammo ) + } + return PLUGIN_CONTINUE } public rank_mod_update( id ) -{ +{ new rank, maxspeed = pev( id, pev_maxspeed ) switch( maxspeed ) { @@ -1352,12 +1325,6 @@ formatex( ret_name, len, name ) } -public bot_msg_block(msg_id,msg_dest,id) -{ - if(get_pcvar_num(p_climb)&&is_user_bot(id))return PLUGIN_HANDLED - return PLUGIN_CONTINUE -} - public DeathMsg( ) {//Respawn client when they die unless switching to spec if( get_pcvar_num( p_climb ) ) @@ -2179,13 +2146,13 @@ formatex( line, 250, "%s%d %s%s %s %s%s %s%d%s", - i % 2 ? "" : "
", + i % 2 ? NULLSTR : "
", i, htmlspecialchars( name ), getuserstatus( tid ), parsetime( ctime ), ctime_str, parsetime( btime ), btime_str, timer[tid][TMR_MAPFIN], - i % 2 ? "" : "
" ) + i % 2 ? NULLSTR : "
" ) written_len += strlen( line ) //if( limit && written_len > ( 1263 - strlen( cust_msg ) ) ) break if( written_len > 1263 ) break @@ -2405,10 +2372,11 @@ //////////////////////////////////////////////////////////////////////////////// // Start: Auto Heal functions //////////////////////////////////////////////////////////////////////////////// -public damage(id){//Called when client takes damage +public Health( id ) +{//Called when client takes damage new ida[1] - ida[0]=id - set_task(0.1,"damage_handle",_,ida,1) + ida[0] = id + set_task( 0.1, "damage_handle", _, ida, 1 ) } public damage_handle( ida[1] ) @@ -3751,12 +3719,12 @@ formatex( line, 150,\ "%s%d %s%s %s %d%s", - i % 2 ? "" : "
", + i % 2 ? NULLSTR : "
", i, htmlspecialchars( name ), parsetime( SQL_ReadResult( query, 1 ) ), btime_str, SQL_ReadResult( query, 4 ), - i % 2 ? "" : "
" ) + i % 2 ? NULLSTR : "
" ) written_len += strlen( line ) if( written_len > 1263 ) break fprintf( fh, line )