diff --git a/plugins/cstrike/miscstats.sma b/plugins/cstrike/miscstats.sma index 70e68f8e..8087b5c0 100755 --- a/plugins/cstrike/miscstats.sma +++ b/plugins/cstrike/miscstats.sma @@ -66,12 +66,10 @@ public FirstBloodSound new g_streakKills[33][2] new g_multiKills[33][2] -new g_Planter -new g_Defuser new g_C4Timer new g_Defusing +new g_Planter new Float:g_LastOmg -new Float:g_LastPlan new g_LastAnnounce new g_roundCount new Float:g_doubleKill @@ -80,13 +78,13 @@ new g_friend[33] new g_firstBlood new g_MultiKillMsg[7][] = { - "Multi-Kill! %s^n%L %d kills (%d hs)", - "Ultra-Kill!!! %s^n%L %d kills (%d hs)", - "%s IS ON A KILLING SPREE!!!^n%L %d kills (%d hs)", - "RAMPAGE!!! %s^n%L %d kills (%d hs)" , - "%s IS UNSTOPPABLE!!!^n%L %d kills (%d hs)", - "%s IS A MONSTER!^n%L %d kills (%d hs)", - "%s IS GODLIKE!!!!^n%L %d kills (%d hs)" + "Multi-Kill! %s^n%L %d %L (%d %L)", + "Ultra-Kill!!! %s^n%L %d %L (%d %L)", + "%s IS ON A KILLING SPREE!!!^n%L %d %L (%d %L)", + "RAMPAGE!!! %s^n%L %d %L (%d hs)" , + "%s IS UNSTOPPABLE!!!^n%L %d %L (%d %L)", + "%s IS A MONSTER!^n%L %d %L (%d %L)", + "%s IS GODLIKE!!!!^n%L %d %L (%d %L)" } new g_Sounds[7][] = { "multikill", @@ -140,15 +138,16 @@ new g_HeadShots[7][] = { "HS_MSG_7" } -new g_teamsNames[2][] = { +new g_teamsNames[4][] = { "TERRORIST", - "CT" + "CT", + "TERRORISTS", + "CTS" } public plugin_init() { register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team") register_dictionary("miscstats.txt") - register_event("DeathMsg","eDeathMsg","a") register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w") register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw") register_event("RoundTime", "eNewRound", "bc") @@ -159,11 +158,6 @@ public plugin_init() { get_mapname(mapname,31) if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)) { register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") - register_event("SendAudio", "eBombPlanted", "a", "2&%!MRAD_BOMBPL") - register_event("SendAudio", "eBombDef", "a", "2&%!MRAD_BOMBDEF") - register_event("TextMsg", "eBombFail", "a", "2&#Target_B") - register_event("BarTime", "eBombDefG", "be", "1=10", "1=5","1=3") - register_event("BarTime", "eBombDefL", "be", "1=0") register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") } @@ -209,25 +203,23 @@ public plugin_cfg() { public client_putinserver(id) g_multiKills[id] = g_streakKills[ id ] = { 0 , 0 } -public eDeathMsg() { - new killerId = read_data(1) - if ( killerId == 0 ) return - new victimId = read_data(2) - new bool:enemykill = (get_user_team(killerId) != get_user_team(victimId)) - new headshot = read_data(3) +public client_death(killer,victim,wpnindex,hitplace,TK) { + + new headshot = ( hitplace == HIT_HEAD ) ? 1:0 + if ( g_firstBlood ) { g_firstBlood = 0 if ( FirstBloodSound ) client_cmd(0,"spk misc/firstblood") } - if ( (KillingStreak || KillingStreakSound) && enemykill ) { - g_streakKills[ killerId ][ 0 ]++ - g_streakKills[ killerId ][ 1 ] = 0 - g_streakKills[ victimId ][ 1 ]++ - g_streakKills[ victimId ][ 0 ] = 0 - new a = g_streakKills[ killerId ][ 0 ] - 3 + if ( (KillingStreak || KillingStreakSound) && !TK ) { + g_streakKills[ killer ][ 0 ]++ + g_streakKills[ killer ][ 1 ] = 0 + g_streakKills[ victim ][ 1 ]++ + g_streakKills[ victim ][ 0 ] = 0 + new a = g_streakKills[ killer ][ 0 ] - 3 if ( (a > -1) && !( a % 2 ) ) { new name[32] - get_user_name( killerId , name , 31 ) + get_user_name( killer , name , 31 ) if ( (a >>= 1) > 6 ) a = 6 if ( KillingStreak ){ set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3) @@ -237,28 +229,30 @@ public eDeathMsg() { } } if ( MultiKill || MultiKillSound ) { - if (killerId && enemykill ) { - g_multiKills[killerId][0]++ - g_multiKills[killerId][1] += headshot + if (killer && !TK ) { + g_multiKills[killer][0]++ + g_multiKills[killer][1] += headshot new param[2] - param[0] = killerId - param[1] = g_multiKills[killerId][0] + param[0] = killer + param[1] = g_multiKills[killer][0] set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) } } if ( EnemyRemaining ) { new ppl[32], pplnum - new team = get_user_team( victimId ) - 1 + new team = get_user_team( victim ) - 1 get_players(ppl,pplnum,"e", g_teamsNames[1 - team] ) if (pplnum) { new eppl[32], epplnum get_players(eppl,epplnum,"ae",g_teamsNames[team]) if (epplnum) { - new message[128] - format(message,127,"%d %s%s Remaining...",epplnum,g_teamsNames[team],(epplnum==1)?"":"S" ) - set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3) - for(new a=0; a 6 ) a = 6 - show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],g_multiKills[id][1]) + show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],LANG_PLAYER,"KILLS",g_multiKills[id][1],LANG_PLAYER,"HS") } if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a]) } @@ -461,42 +454,20 @@ announceEvent( id, message[] ) { show_hudmessage(0,"%L",LANG_PLAYER,message,name) } -public eGotBomb(id) { - g_Planter = id - g_Defuser = g_Defusing = 0 +public eBombPickUp(id) + if (BombPickUp) announceEvent(id , "PICKED_BOMB") + +public eBombDrop() + if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") + +public eGotBomb(id) { + g_Planter = id if ( BombReached && read_data(1)==2 && g_LastOmg 0) { if (BombCountVoice) { @@ -516,14 +487,29 @@ public bombTimer() { else remove_task(8038) } -public eBombDef() - if (BombDefused) announceEvent(g_Defuser, "DEFUSED_BOMB" ) - -public eBombFail() - if (BombFailed && g_Defuser ) announceEvent(g_Defuser , "FAILED_DEFU" ) +public bomb_planted(planter){ + g_Defusing = 0 + if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" ) + g_C4Timer = get_cvar_num("mp_c4timer") + set_task(1.0,"bombTimer",8038,"",0,"b") -public eBombPickUp(id) - if (BombPickUp) announceEvent(id , "PICKED_BOMB") +} -public eBombDrop() - if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") \ No newline at end of file +public bomb_planting(planter) + if (BombPlanting) announceEvent(planter, "PLANT_BOMB" ) + +public bomb_defusing(defuser){ + if (BombDefusing) announceEvent(defuser, "DEFUSING_BOMB" ) + g_Defusing = defuser +} + +public bomb_defused(defuser) + if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" ) + +public bomb_explode(planter,defuser) + if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" ) + +public plugin_modules() +{ + require_module("csx") +} \ No newline at end of file diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 07978c93..db6aa113 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -36,16 +36,13 @@ #include #include -#include +#include //-------------------------------- // Uncomment to activate log debug messages. //#define STATSX_DEBUG -// Comment to activate new DeathMsg process (if fixed). -#define STATSX_OLD_DEATHMSG - // HUD statistics duration in seconds (minimum 1.0 seconds). #define HUD_DURATION_CVAR "amx_statsx_duration" #define HUD_DURATION "12.0" @@ -91,7 +88,7 @@ public SayTop15 = 0 // displays first 15 players public SayStatsAll = 0 // displays all players stats and rank public SayMiscFunc = 0 // displays timeleft, thetime, currentmap, ff -public ShowStats = 0 // set client HUD-stats switched off by default +public ShowStats = 1 // set client HUD-stats switched off by default public ShowDistHS = 0 // show distance and HS in attackers and // victims HUD lists public ShowFullStats = 0 // show full HUD stats (more than 78 chars) @@ -197,13 +194,6 @@ public plugin_init() { register_event( "ResetHUD", "eventResetHud", "be" ) register_event( "RoundTime", "eventStartRound", "bc" ) - #if defined STATSX_OLD_DEATHMSG - register_event( "DeathMsg", "eventDeathMsg", "a" ) - register_event( "Damage", "eventDamage", "b", "2!0", "3=0", "4!0" ) - #else - register_event( "CS_DeathMsg", "eventCSDeathMsg", "a" ) - #endif - register_event( "SendAudio", "eventEndRound", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw" ) register_event( "TeamScore", "eventTeamScore", "a" ) @@ -261,7 +251,6 @@ public plugin_cfg() { server_cmd( addStast, "Show Total Stats", "ShowTotalStats" ) server_cmd( addStast, "Show Best Score", "ShowBestScore" ) server_cmd( addStast, "Show Most Disruptive", "ShowMostDisruptive" ) - server_cmd( addStast, "Show HUD Stats", "ShowFullStats" ) server_cmd( addStast, "HUD-stats default", "ShowStats" ) server_cmd( addStast, "Dist&HS in HUD lists", "ShowDistHS" ) @@ -809,12 +798,12 @@ format_stats( id, sBuffer[MAX_BUFFER_LENGTH+1] ) { iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6s %6s %6s %6s %6s %4s^n", lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc ) - for ( iWeapon = 1; iWeapon < 31 && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++ ) { + for ( iWeapon = 1; iWeapon < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++ ) { if ( get_user_wstats( id, iWeapon, izStats, izBody ) ) { get_weaponname( iWeapon, t_sWpn, MAX_WEAPON_LENGTH ) iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6d %6d %6d %6d %6d %3.0f%%^n", - t_sWpn[7], izStats[STATS_KILLS], izStats[STATS_DEATHS], + t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy( izStats ) ) } @@ -1019,7 +1008,7 @@ public cmdReport( id ) { if ( iClip >= 0 ) { format( g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d/%d, %L: %d, %L: %d", - lWeapon, t_sWpn[7], LANG_SERVER, "AMMO", iClip, iAmmo, + lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor ) } else @@ -1296,115 +1285,37 @@ public delay_resethud( args[] ) { return PLUGIN_CONTINUE } -#if defined STATSX_OLD_DEATHMSG - // Save killer info on death. -public eventDeathMsg() { - new iKiller = read_data( 1 ) - new iVictim = read_data( 2 ) +public client_death(killer,victim,wpnindex,hitplace,TK) { // Bail out if no killer. - if ( !iKiller ) return PLUGIN_CONTINUE + if ( !killer ) return PLUGIN_CONTINUE - if ( iKiller != iVictim ) { + if ( killer != victim ) { new iaVOrigin[3], iaKOrigin[3] new iDistance - get_user_origin( iVictim, iaVOrigin ) - get_user_origin( iKiller, iaKOrigin ) - g_izKilled[iVictim][KILLED_KILLER_ID] = iKiller - g_izKilled[iVictim][KILLED_KILLER_HEALTH] = get_user_health( iKiller ) - g_izKilled[iVictim][KILLED_KILLER_ARMOUR] = get_user_armor( iKiller ) - g_izKilled[iVictim][KILLED_KILLER_STATSFIX] = 0 + get_user_origin( victim, iaVOrigin ) + get_user_origin( killer, iaKOrigin ) + g_izKilled[victim][KILLED_KILLER_ID] = killer + g_izKilled[victim][KILLED_KILLER_HEALTH] = get_user_health( killer ) + g_izKilled[victim][KILLED_KILLER_ARMOUR] = get_user_armor( killer ) + g_izKilled[victim][KILLED_KILLER_STATSFIX] = 0 iDistance = get_distance( iaVOrigin, iaKOrigin ) - g_izUserAttackerDistance[iVictim] = iDistance - g_izUserVictimDistance[iKiller][iVictim] = iDistance + g_izUserAttackerDistance[victim] = iDistance + g_izUserVictimDistance[killer][victim] = iDistance } - g_izKilled[iVictim][KILLED_TEAM] = get_user_team( iVictim ) - new args[1] - args[0] = iVictim - set_task( 0.25, "delay_damage", 100 + iVictim, args, 1 ) - - return PLUGIN_CONTINUE -} - -public delay_damage( args[] ) { - new id = args[0] - - // Display stats to killed player if player - // has not already been processed. - if ( !g_izKilled[id][KILLED_KILLER_STATSFIX] ) { - g_izKilled[id][KILLED_KILLER_STATSFIX] = 1 - - // Display round end stats to all players if - // round end has already been triggered. - if ( g_iRoundEndTriggered ) - endround_stats() - // Display kill stats for the player if round - // end stats was not processed. - if ( !g_iRoundEndProcessed ) - kill_stats( id ) - } -} - -// Trigger death stats processing. -public eventDamage( id ) { - // Bail out if player not killed or if player - // player has already been processed. - if ( !g_izKilled[id][KILLED_KILLER_ID] || g_izKilled[id][KILLED_KILLER_STATSFIX] ) - return PLUGIN_CONTINUE - - // Remove task if not alreay done and process. - remove_task( 100 + id ) - - // Process player deaths. - new izData[1] - izData[0] = id - delay_damage( izData ) - - return PLUGIN_CONTINUE -} - -#endif // if defined STATSX_OLD_DEATHMSG - - -#if !defined STATSX_OLD_DEATHMSG - -// Save killer info on death. -public eventCSDeathMsg() { - new iKiller = read_data( 1 ) - new iVictim = read_data( 2 ) - - // Bail out if no killer. - if ( !iKiller ) return PLUGIN_CONTINUE - - if ( iKiller != iVictim ) { - new iaVOrigin[3], iaKOrigin[3] - new iDistance - get_user_origin( iVictim, iaVOrigin ) - get_user_origin( iKiller, iaKOrigin ) - g_izKilled[iVictim][KILLED_KILLER_ID] = iKiller - g_izKilled[iVictim][KILLED_KILLER_HEALTH] = get_user_health( iKiller ) - g_izKilled[iVictim][KILLED_KILLER_ARMOUR] = get_user_armor( iKiller ) - g_izKilled[iVictim][KILLED_KILLER_STATSFIX] = 0 - - iDistance = get_distance( iaVOrigin, iaKOrigin ) - g_izUserAttackerDistance[iVictim] = iDistance - g_izUserVictimDistance[iKiller][iVictim] = iDistance - } - g_izKilled[iVictim][KILLED_TEAM] = get_user_team( iVictim ) - g_izKilled[iVictim][KILLED_KILLER_STATSFIX] = 1 + g_izKilled[victim][KILLED_TEAM] = get_user_team( victim ) + g_izKilled[victim][KILLED_KILLER_STATSFIX] = 1 // Display kill stats for the player if round // end stats was not processed. if ( !g_iRoundEndProcessed ) - kill_stats( iVictim ) + kill_stats( victim ) return PLUGIN_CONTINUE } -#endif - // Display hudmessage stats on death. // This will also update all round and game stats. // Must be called at least once per round. @@ -1646,5 +1557,5 @@ public client_connect( id ) { public plugin_modules() { - require_module("csstats") -} + require_module("csx") +} \ No newline at end of file