diff --git a/plugins/cstrike/csstats.sma b/plugins/cstrike/csstats.sma index ed9a2091..a39cf396 100755 --- a/plugins/cstrike/csstats.sma +++ b/plugins/cstrike/csstats.sma @@ -50,5 +50,5 @@ * Returning cellmin as value in get_score function * makes that rank won't be saved. */ -public get_score( stats[8] , body[8] ) - return stats[0] - stats[1] - stats[3] // kills - deaths - teamkills \ No newline at end of file +public get_score(stats[8], body[8]) + return stats[0] - stats[1] - stats[3] // kills - deaths - teamkills diff --git a/plugins/cstrike/miscstats.sma b/plugins/cstrike/miscstats.sma index 934511e7..819087ab 100755 --- a/plugins/cstrike/miscstats.sma +++ b/plugins/cstrike/miscstats.sma @@ -18,12 +18,12 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, +* along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception @@ -78,478 +78,638 @@ new g_doubleKillId new g_friend[33] new g_firstBlood -new g_MultiKillMsg[7][] = { - "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", - "ultrakill", - "killingspree", - "rampage", - "unstoppable", - "monsterkill", - "godlike" -} -new g_KillingMsg[7][] = { - "%s: Multi-Kill!", - "%s: Ultra-Kill!!!", - "%s IS ON A KILLING SPREE!!!", - "%s: RAMPAGE!!!", - "%s IS UNSTOPPABLE!!!", - "%s IS A MONSTER!", - "%s IS GODLIKE!!!" -} -new g_KinfeMsg[4][] = { - "KNIFE_MSG_1", - "KNIFE_MSG_2", - "KNIFE_MSG_3", - "KNIFE_MSG_4" -} -new g_LastMessages[4][] = { - "LAST_MSG_1", - "LAST_MSG_2", - "LAST_MSG_3", - "LAST_MSG_4" -} -new g_HeMessages[4][] = { - "HE_MSG_1", - "HE_MSG_2", - "HE_MSG_3", - "HE_MSG_4" -} -new g_SHeMessages[4][] = { - "SHE_MSG_1", - "SHE_MSG_2", - "SHE_MSG_3", - "SHE_MSG_4" -} -new g_HeadShots[7][] = { - "HS_MSG_1", - "HS_MSG_2", - "HS_MSG_3", - "HS_MSG_4", - "HS_MSG_5", - "HS_MSG_6", - "HS_MSG_7" +new g_MultiKillMsg[7][] = +{ + "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_teamsNames[4][] = { - "TERRORIST", - "CT", - "TERRORISTS", - "CTS" +new g_Sounds[7][] = +{ + "multikill", + "ultrakill", + "killingspree", + "rampage", + "unstoppable", + "monsterkill", + "godlike" +} +new g_KillingMsg[7][] = +{ + "%s: Multi-Kill!", + "%s: Ultra-Kill!!!", + "%s IS ON A KILLING SPREE!!!", + "%s: RAMPAGE!!!", + "%s IS UNSTOPPABLE!!!", + "%s IS A MONSTER!", + "%s IS GODLIKE!!!" } -public plugin_init() { - register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team") - register_dictionary("miscstats.txt") - 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") - register_event("StatusValue","setTeam","be","1=1") - register_event("StatusValue","showStatus","be","1=2","2!0") - register_event("StatusValue","hideStatus","be","1=1","2=0") - new mapname[32] - 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("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") - register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") - } - else if ( equali( mapname , "cs_italy" ) ) { - register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" ) - register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" ) - } +new g_KinfeMsg[4][] = +{ + "KNIFE_MSG_1", + "KNIFE_MSG_2", + "KNIFE_MSG_3", + "KNIFE_MSG_4" } -public plugin_cfg() { - new g_addStast[] = "amx_statscfg add ^"%s^" %s" - server_cmd(g_addStast,"MultiKill","MultiKill") - server_cmd(g_addStast,"MultiKillSound","MultiKillSound") - server_cmd(g_addStast,"Bomb Planting","BombPlanting") - server_cmd(g_addStast,"Bomb Defusing","BombDefusing") - server_cmd(g_addStast,"Bomb Planted","BombPlanted") - server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused") - server_cmd(g_addStast,"Bomb Def. Failure","BombFailed") - server_cmd(g_addStast,"Bomb PickUp","BombPickUp") - server_cmd(g_addStast,"Bomb Drop","BombDrop") - server_cmd(g_addStast,"Bomb Count Down","BombCountVoice") - server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef") - server_cmd(g_addStast,"Bomb Site Reached","BombReached") - server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill") - server_cmd(g_addStast,"Last Man","LastMan") - server_cmd(g_addStast,"Knife Kill","KnifeKill") - server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") - server_cmd(g_addStast,"Grenade Kill","GrenadeKill") - server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide") - server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") - server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound") - server_cmd(g_addStast,"Round Counter","RoundCounter") - server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound") - server_cmd(g_addStast,"Killing Streak","KillingStreak") - server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") - server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining") - server_cmd(g_addStast,"Double Kill","DoubleKill") - server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") - server_cmd(g_addStast,"Player Name","PlayerName") - server_cmd(g_addStast,"First Blood Sound","FirstBloodSound") +new g_LastMessages[4][] = +{ + "LAST_MSG_1", + "LAST_MSG_2", + "LAST_MSG_3", + "LAST_MSG_4" +} + +new g_HeMessages[4][] = +{ + "HE_MSG_1", + "HE_MSG_2", + "HE_MSG_3", + "HE_MSG_4" +} + +new g_SHeMessages[4][] = +{ + "SHE_MSG_1", + "SHE_MSG_2", + "SHE_MSG_3", + "SHE_MSG_4" +} + +new g_HeadShots[7][] = +{ + "HS_MSG_1", + "HS_MSG_2", + "HS_MSG_3", + "HS_MSG_4", + "HS_MSG_5", + "HS_MSG_6", + "HS_MSG_7" +} + +new g_teamsNames[4][] = +{ + "TERRORIST", + "CT", + "TERRORISTS", + "CTS" +} + +public plugin_init() +{ + register_plugin("CS Misc. Stats", AMXX_VERSION_STR, "AMXX Dev Team") + register_dictionary("miscstats.txt") + 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") + register_event("StatusValue", "setTeam", "be", "1=1") + register_event("StatusValue", "showStatus", "be", "1=2", "2!0") + register_event("StatusValue", "hideStatus", "be", "1=1", "2=0") + + new mapname[32] + 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("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") + register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") + } + else if (equali(mapname, "cs_italy")) + { + register_event("23", "chickenKill", "a", "1=108", /*"12=106", */ "15=4") + register_event("23", "radioKill", "a", "1=108", /*"12=294", */ "15=2") + } +} + +public plugin_cfg() +{ + new g_addStast[] = "amx_statscfg add ^"%s^" %s" + + server_cmd(g_addStast, "MultiKill", "MultiKill") + server_cmd(g_addStast, "MultiKillSound", "MultiKillSound") + server_cmd(g_addStast, "Bomb Planting", "BombPlanting") + server_cmd(g_addStast, "Bomb Defusing", "BombDefusing") + server_cmd(g_addStast, "Bomb Planted", "BombPlanted") + server_cmd(g_addStast, "Bomb Defuse Succ.", "BombDefused") + server_cmd(g_addStast, "Bomb Def. Failure", "BombFailed") + server_cmd(g_addStast, "Bomb PickUp", "BombPickUp") + server_cmd(g_addStast, "Bomb Drop", "BombDrop") + server_cmd(g_addStast, "Bomb Count Down", "BombCountVoice") + server_cmd(g_addStast, "Bomb Count Down (def)", "BombCountDef") + server_cmd(g_addStast, "Bomb Site Reached", "BombReached") + server_cmd(g_addStast, "Italy Bonus Kill", "ItalyBonusKill") + server_cmd(g_addStast, "Last Man", "LastMan") + server_cmd(g_addStast, "Knife Kill", "KnifeKill") + server_cmd(g_addStast, "Knife Kill Sound", "KnifeKillSound") + server_cmd(g_addStast, "Grenade Kill", "GrenadeKill") + server_cmd(g_addStast, "Grenade Suicide", "GrenadeSuicide") + server_cmd(g_addStast, "HeadShot Kill", "HeadShotKill") + server_cmd(g_addStast, "HeadShot Kill Sound", "HeadShotKillSound") + server_cmd(g_addStast, "Round Counter", "RoundCounter") + server_cmd(g_addStast, "Round Counter Sound", "RoundCounterSound") + server_cmd(g_addStast, "Killing Streak", "KillingStreak") + server_cmd(g_addStast, "Killing Streak Sound", "KillingStreakSound") + server_cmd(g_addStast, "Enemy Remaining", "EnemyRemaining") + server_cmd(g_addStast, "Double Kill", "DoubleKill") + server_cmd(g_addStast, "Double Kill Sound", "DoubleKillSound") + server_cmd(g_addStast, "Player Name", "PlayerName") + server_cmd(g_addStast, "First Blood Sound", "FirstBloodSound") } public client_putinserver(id) { - g_multiKills[id] = { 0 , 0 } - g_streakKills[ id ] = { 0 , 0 } + g_multiKills[id] = {0, 0} + g_streakKills[id] = {0, 0} } -public client_death(killer,victim,wpnindex,hitplace,TK) { +public client_death(killer, victim, wpnindex, hitplace, TK) +{ + if (wpnindex == CSW_C4) + return - if ( wpnindex == CSW_C4 ) - return + new headshot = (hitplace == HIT_HEAD) ? 1 : 0 + new selfkill = (killer == victim) ? 1 : 0 - - new headshot = ( hitplace == HIT_HEAD ) ? 1:0 - new selfkill = ( killer == victim ) ? 1:0 - - if ( g_firstBlood ) { - g_firstBlood = 0 - if ( FirstBloodSound ) play_sound("misc/firstblood") - } - if ( (KillingStreak || KillingStreakSound) && !TK ) { - g_streakKills[ victim ][ 1 ]++ - g_streakKills[ victim ][ 0 ] = 0 - if (!selfkill){ - g_streakKills[ killer ][ 0 ]++ - g_streakKills[ killer ][ 1 ] = 0 - new a = g_streakKills[ killer ][ 0 ] - 3 - if ( (a > -1) && !( a % 2 ) ) { - new name[32] - 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) - show_hudmessage(0,g_KillingMsg[ a ], name ) - } - if ( KillingStreakSound ) { - new file[32] - format(file, 32, "misc/%s", g_Sounds[a]) - play_sound(file) + if (g_firstBlood) + { + g_firstBlood = 0 + if (FirstBloodSound) + play_sound("misc/firstblood") } - } - } - } - if ( MultiKill || MultiKillSound ) { - if (!selfkill && !TK ) { - g_multiKills[killer][0]++ - g_multiKills[killer][1] += headshot - new param[2] - 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 = 0 - new team = get_user_team( victim ) - 1 - if ( team >= 0 && team < 4 ) - get_players(ppl,pplnum,"e", g_teamsNames[1 - team] ) - if (pplnum) - { - new eppl[32], epplnum - if (team >= 0 && team < 4) - { - get_players(eppl,epplnum,"ae",g_teamsNames[team]) - if (epplnum) - { - new message[128],team_name[32] - set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3) - for(new a=0; a 1 ) { - g_LastAnnounce = cts[0] - oposite = tsnum - team = 0 - } - else if ( tsnum == 1 && ctsnum > 1 ) { - g_LastAnnounce = ts[0] - oposite = ctsnum - team = 1 - } - if (g_LastAnnounce) { - new name[32] - get_user_name(g_LastAnnounce,name,31) - set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) - show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %L",name, - get_user_health(g_LastAnnounce),oposite, - g_teamsNames[team],(oposite==1)?"":"S",LANG_PLAYER,g_LastMessages[ random_num(0,3) ] ) - if (!is_user_connecting(g_LastAnnounce)) - client_cmd(g_LastAnnounce,"spk misc/oneandonly") - } - } - } - if ( wpnindex == CSW_KNIFE && ( KnifeKill || KnifeKillSound ) ) { - if ( KnifeKill ) { - new killer_name[32],victim_name[32] - get_user_name(killer,killer_name,31) - get_user_name(victim,victim_name,31) - set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0,"%L",LANG_PLAYER,g_KinfeMsg[ random_num(0,3) ],killer_name,victim_name) - } - if ( KnifeKillSound ) play_sound("misc/humiliation") - } + if ((KillingStreak || KillingStreakSound) && !TK) + { + g_streakKills[victim][1]++ + g_streakKills[victim][0] = 0 - if ( wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide) ) { - new killer_name[32],victim_name[32] - get_user_name(killer,killer_name,32) - get_user_name(victim,victim_name,32) - set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) - if ( !selfkill ) { - if ( GrenadeKill ) show_hudmessage(0,"%L",LANG_PLAYER,g_HeMessages[ random_num(0,3)],killer_name,victim_name) - } - else if ( GrenadeSuicide ) show_hudmessage(0,"%L",LANG_PLAYER,g_SHeMessages[ random_num(0,3) ],victim_name) - } - if ( headshot && (HeadShotKill || HeadShotKillSound) ) { - if ( HeadShotKill && wpnindex ) { - new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum - xmod_get_wpnname(wpnindex,weapon_name,31) - get_user_name(killer,killer_name,31) - get_user_name(victim,victim_name,31) + if (!selfkill) + { + g_streakKills[killer][0]++ + g_streakKills[killer][1] = 0 + + new a = g_streakKills[killer][0] - 3 - get_players(players,pnum,"c") - for (new i=0;i -1) && !(a % 2)) + { + new name[32] + 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) + show_hudmessage(0, g_KillingMsg[a], name) + } + + if (KillingStreakSound) + { + new file[32] + + format(file, 32, "misc/%s", g_Sounds[a]) + play_sound(file) + } + } + } + } -public hideStatus(id) { - if ( PlayerName ) { - set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4) - show_hudmessage(id,"") - } + if (MultiKill || MultiKillSound) + { + if (!selfkill && !TK) + { + g_multiKills[killer][0]++ + g_multiKills[killer][1] += headshot + + new param[2] + + 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 = 0 + new team = get_user_team(victim) - 1 + + if (team >= 0 && team < 4) + get_players(ppl, pplnum, "e", g_teamsNames[1 - team]) + + if (pplnum) + { + new eppl[32], epplnum + + if (team >= 0 && team < 4) + { + get_players(eppl, epplnum, "ae", g_teamsNames[team]) + + if (epplnum) + { + new message[128], team_name[32] + + set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, 3) + + for (new a = 0; a < pplnum; ++a) + { + format(team_name, 31, "%L", ppl[a], (epplnum == 1) ? g_teamsNames[team] : g_teamsNames[team + 2]) + format(message, 127, "%L", ppl[a], "REMAINING", epplnum, team_name) + + show_hudmessage(ppl[a], message) + } + } + } + } + } + + if (LastMan) + { + new cts[32], ts[32], ctsnum, tsnum + + get_players(cts, ctsnum, "ae", g_teamsNames[1]) + get_players(ts, tsnum, "ae", g_teamsNames[0]) + + if (ctsnum == 1 && tsnum == 1) + { + new ctname[32], tname[32] + + get_user_name(cts[0], ctname, 31) + get_user_name(ts[0], tname, 31) + + set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) + show_hudmessage(0, "%s vs. %s", ctname, tname) + + play_sound("misc/maytheforce") + } + else if (!g_LastAnnounce) + { + new oposite = 0, team = 0 + + if (ctsnum == 1 && tsnum > 1) + { + g_LastAnnounce = cts[0] + oposite = tsnum + team = 0 + } + else if (tsnum == 1 && ctsnum > 1) + { + g_LastAnnounce = ts[0] + oposite = ctsnum + team = 1 + } + + if (g_LastAnnounce) + { + new name[32] + + get_user_name(g_LastAnnounce, name, 31) + + set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) + show_hudmessage(0, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)]) + + if (!is_user_connecting(g_LastAnnounce)) + client_cmd(g_LastAnnounce, "spk misc/oneandonly") + } + } + } + + if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound)) + { + if (KnifeKill) + { + new killer_name[32], victim_name[32] + + get_user_name(killer, killer_name, 31) + get_user_name(victim, victim_name, 31) + + set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(0, "%L", LANG_PLAYER, g_KinfeMsg[random_num(0, 3)], killer_name, victim_name) + } + + if (KnifeKillSound) + play_sound("misc/humiliation") + } + + if (wpnindex == CSW_HEGRENADE && (GrenadeKill || GrenadeSuicide)) + { + new killer_name[32], victim_name[32] + + get_user_name(killer, killer_name, 32) + get_user_name(victim, victim_name, 32) + + set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) + + if (!selfkill) + { + if (GrenadeKill) + show_hudmessage(0, "%L", LANG_PLAYER, g_HeMessages[random_num(0, 3)], killer_name, victim_name) + } + else if (GrenadeSuicide) + show_hudmessage(0, "%L", LANG_PLAYER, g_SHeMessages[random_num(0, 3)], victim_name) + } + + if (headshot && (HeadShotKill || HeadShotKillSound)) + { + if (HeadShotKill && wpnindex) + { + new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum + + xmod_get_wpnname(wpnindex, weapon_name, 31) + get_user_name(killer, killer_name, 31) + get_user_name(victim, victim_name, 31) + get_players(players, pnum, "c") + + for (new i = 0; i < pnum; i++) + { + format(message, 127, "%L", players[i], g_HeadShots[random_num(0, 6)]) + + replace(message, 127, "$vn", victim_name) + replace(message, 127, "$wn", weapon_name) + replace(message, 127, "$kn", killer_name) + + set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(players[i], message) + } + } + + if (HeadShotKillSound) + { + client_cmd(killer, "spk misc/headshot") + client_cmd(victim, "spk misc/headshot") + } + } + + if ((DoubleKill || DoubleKillSound) && !selfkill) + { + new Float:nowtime = get_gametime() + + if (g_doubleKill == nowtime && g_doubleKillId == killer) + { + if (DoubleKill) + { + new name[32] + + get_user_name(killer, name, 31) + + set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) + show_hudmessage(0, "%L", LANG_PLAYER, "DOUBLE_KILL", name) + } + + if (DoubleKillSound) + play_sound("misc/doublekill") + } + + g_doubleKill = nowtime + g_doubleKillId = killer + } } -public setTeam(id) - g_friend[id] = read_data(2) +public hideStatus(id) +{ + if (PlayerName) + { + set_hudmessage(0, 0, 0, 0.0, 0.0, 0, 0.0, 0.01, 0.0, 0.0, 4) + show_hudmessage(id, "") + } +} -public showStatus(id) { - if ( PlayerName ) { - new name[32],pid = read_data(2) - get_user_name(pid,name,31) - new color1 = 0,color2 = 0 - if ( get_user_team(pid)==1 ) - color1 = 255 - else - color2 = 255 - if (g_friend[id]==1) { // friend - new clip, ammo, wpnid = get_user_weapon(pid,clip,ammo) - new wpnname[32] - if ( wpnid ) - xmod_get_wpnname(wpnid,wpnname,31) - set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4) - show_hudmessage(id,"%s -- %d HP / %d AP / %s",name, - get_user_health(pid),get_user_armor(pid),wpnname) - } - else { - set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4) - show_hudmessage(id,name) - } - } +public setTeam(id) + g_friend[id] = read_data(2) + +public showStatus(id) +{ + if (PlayerName) + { + new name[32], pid = read_data(2) + + get_user_name(pid, name, 31) + new color1 = 0, color2 = 0 + + if (get_user_team(pid) == 1) + color1 = 255 + else + color2 = 255 + + if (g_friend[id] == 1) // friend + { + new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo) + new wpnname[32] + + if (wpnid) + xmod_get_wpnname(wpnid, wpnname, 31) + + set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4) + show_hudmessage(id, "%s -- %d HP / %d AP / %s", name, get_user_health(pid), get_user_armor(pid), wpnname) + } else { + set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4) + show_hudmessage(id, name) + } + } } public eNewRound() - if ( read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0) ) { - g_firstBlood = 1 - g_C4Timer = 0 - ++g_roundCount - if ( RoundCounter ) { - set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount ) - } - if ( RoundCounterSound ) play_sound("misc/prepare") - if ( KillingStreak ) { - new appl[32],ppl, i - get_players(appl,ppl, "ac" ) - for (new a = 0; a < ppl; ++a) { - i = appl[ a ] - if ( g_streakKills[ i ][ 0 ] >= 2 ) - client_print( i , print_chat , "* %L", i, "KILLED_ROW", g_streakKills[ i ][ 0 ] ) - else if ( g_streakKills[ i ][ 1 ] >= 2 ) - client_print( i , print_chat , "* %L", i, "DIED_ROUNDS", g_streakKills[ i ][ 1 ] ) - } - } - } - -public eRestart() { - eEndRound() - g_roundCount = 0 - g_firstBlood = 1 +{ + if (read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0)) + { + g_firstBlood = 1 + g_C4Timer = 0 + ++g_roundCount + + if (RoundCounter) + { + set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount) + } + + if (RoundCounterSound) + play_sound("misc/prepare") + + if (KillingStreak) + { + new appl[32], ppl, i + get_players(appl, ppl, "ac") + + for (new a = 0; a < ppl; ++a) + { + i = appl[a] + + if (g_streakKills[i][0] >= 2) + client_print(i, print_chat, "* %L", i, "KILLED_ROW", g_streakKills[i][0]) + else if (g_streakKills[i][1] >= 2) + client_print(i, print_chat, "* %L", i, "DIED_ROUNDS", g_streakKills[i][1]) + } + } + } } -public eEndRound() { - g_C4Timer = -2 - g_LastOmg = 0.0 - remove_task(8038) - g_LastAnnounce = 0 +public eRestart() +{ + eEndRound() + g_roundCount = 0 + g_firstBlood = 1 } -public checkKills(param[]) { - new id = param[0] - new a = param[1] - if (a == g_multiKills[id][0]) { - a -= 3 - if ( a > -1 ) { - if ( MultiKill ) { - new name[32] - get_user_name(id,name,31) - set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) - if ( a > 6 ) a = 6 - 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 ) - { - new sound[24] - format(sound, 23, "misc/%s", g_Sounds[a]) - play_sound(sound) - } - } - g_multiKills[id] = { 0,0 } - } +public eEndRound() +{ + g_C4Timer = -2 + g_LastOmg = 0.0 + remove_task(8038) + g_LastAnnounce = 0 +} + +public checkKills(param[]) +{ + new id = param[0] + new a = param[1] + + if (a == g_multiKills[id][0]) + { + a -= 3 + + if (a > -1) + { + if (MultiKill) + { + new name[32] + + get_user_name(id, name, 31) + set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) + + if (a > 6) + a = 6 + + 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) + { + new sound[24] + format(sound, 23, "misc/%s", g_Sounds[a]) + play_sound(sound) + } + } + g_multiKills[id] = {0, 0} + } } public chickenKill() - if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" ) + if (ItalyBonusKill) + announceEvent(0, "KILLED_CHICKEN") -public radioKill() { - if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" ) +public radioKill() +{ + if (ItalyBonusKill) + announceEvent(0, "BLEW_RADIO") } -announceEvent( id, message[] ) { - new name[32] - get_user_name(id, name , 31) - set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0,"%L",LANG_PLAYER,message,name) +announceEvent(id, message[]) +{ + new name[32] + + get_user_name(id, name, 31) + set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(0, "%L", LANG_PLAYER, message, name) } public eBombPickUp(id) - if (BombPickUp) announceEvent(id , "PICKED_BOMB") + if (BombPickUp) + announceEvent(id, "PICKED_BOMB") public eBombDrop() - if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") + if (BombDrop) + announceEvent(g_Planter, "DROPPED_BOMB") -public eGotBomb(id) { - g_Planter = id - if ( BombReached && read_data(1)==2 && g_LastOmg 0) { - if (BombCountVoice) { - if (g_C4Timer == 30 || g_C4Timer == 20) { - new temp[64] - num_to_word(g_C4Timer,temp,63) - format(temp, 63, "^"vox/%s seconds until explosion^"", temp) - play_sound(temp) - } - else if (g_C4Timer < 11) { - new temp[64] - num_to_word(g_C4Timer,temp,63) - format(temp, 63, "^"vox/%s^"", temp) - play_sound(temp) - } - } - if (BombCountDef && g_Defusing) client_print(g_Defusing,print_center,"%d",g_C4Timer) - } - else remove_task(8038) +public eGotBomb(id) +{ + g_Planter = id + + if (BombReached && read_data(1) == 2 && g_LastOmg < get_gametime()) + { + g_LastOmg = get_gametime() + 15.0 + announceEvent(g_Planter, "REACHED_TARGET") + } } -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 bombTimer() +{ + if (--g_C4Timer > 0) + { + if (BombCountVoice) + { + if (g_C4Timer == 30 || g_C4Timer == 20) + { + new temp[64] + + num_to_word(g_C4Timer, temp, 63) + format(temp, 63, "^"vox/%s seconds until explosion^"", temp) + play_sound(temp) + } + else if (g_C4Timer < 11) + { + new temp[64] + + num_to_word(g_C4Timer, temp, 63) + format(temp, 63, "^"vox/%s^"", temp) + play_sound(temp) + } + } + if (BombCountDef && g_Defusing) + client_print(g_Defusing, print_center, "%d", g_C4Timer) + } + else + remove_task(8038) +} +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 bomb_planting(planter) - if (BombPlanting) announceEvent(planter, "PLANT_BOMB" ) + if (BombPlanting) + announceEvent(planter, "PLANT_BOMB") -public bomb_defusing(defuser){ - if (BombDefusing) announceEvent(defuser, "DEFUSING_BOMB" ) +public bomb_defusing(defuser) +{ + if (BombDefusing) + announceEvent(defuser, "DEFUSING_BOMB") + g_Defusing = defuser } public bomb_defused(defuser) - if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" ) + if (BombDefused) + announceEvent(defuser, "DEFUSED_BOMB") -public bomb_explode(planter,defuser) - if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" ) +public bomb_explode(planter, defuser) + if (BombFailed && defuser) + announceEvent(defuser, "FAILED_DEFU") public play_sound(sound[]) { new players[32], pnum get_players(players, pnum, "c") new i - for (i=0; i= MAXMENUPOS) start = MAXMENUPOS - 1 - new end = start + 10 - if (end > MAXMENUPOS) end = MAXMENUPOS - new lName[16],lValue[16],lStatus[16],lOnOff[16] - format(lName,15,"%L",id,"NAME") - format(lValue,15,"%L",id,"VALUE") - format(lStatus,15,"%L",id,"STATUS") - console_print(id, "^n----- %L: -----", id, "WEAP_RES") - console_print(id, " %-32.31s %-10.9s %-9.8s",lName,lValue,lStatus) - if ( start != -1 ) { - for (new a = start; a < end; ++a) { - format(lOnOff,15,"%L",id,positionBlocked(a) ? "ON" : "OFF") - console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1, - g_WeaponNames[a], g_Aliases[a], lOnOff) - } - } - console_print(id,"----- %L -----",id,"REST_ENTRIES_OF",start+1,end,MAXMENUPOS) - if (end < MAXMENUPOS) - console_print(id,"----- %L -----",id,"REST_USE_MORE",end+1) - else - console_print(id,"----- %L -----",id,"REST_USE_BEGIN") - } - else if ( equali( "save" , cmd ) ) { - if ( saveSettings( g_saveFile ) ){ - console_print( id , "%L", id, "REST_CONF_SAVED", g_saveFile ) - g_Modified = false - } - else console_print( id, "%L", id, "REST_COULDNT_SAVE", g_saveFile ) - } - else if ( equali( "load" , cmd ) ) { - setc( g_blockPos, 112, 0 ) // Clear current settings - new arg1[64] - if ( read_argv(2, arg1 , 63 ) ) { - new configsdir[32] - get_configsdir(configsdir,31) - format(arg1,63,"%s/%s",configsdir,arg1) - } - if ( loadSettings( arg1 ) ) { - console_print( id, "%L", id, "REST_CONF_LOADED", arg1 ) - g_Modified = true - } - else console_print( id, "%L", id, "REST_COULDNT_LOAD", arg1 ) - } - else { - console_print(id,"%L",id,"COM_REST_USAGE") - console_print(id,"%L",id,"COM_REST_COMMANDS") - console_print(id,"%L",id,"COM_REST_ON") - console_print(id,"%L",id,"COM_REST_OFF") - console_print(id,"%L",id,"COM_REST_ONV") - console_print(id,"%L",id,"COM_REST_OFFV") - console_print(id,"%L",id,"COM_REST_LIST") - console_print(id,"%L",id,"COM_REST_SAVE") - console_print(id,"%L",id,"COM_REST_LOAD") - console_print(id,"%L",id,"COM_REST_VALUES") - console_print(id,"%L",id,"COM_REST_TYPE") - } - return PLUGIN_HANDLED +public cmdRest(id, level, cid) +{ + if (!cmd_access(id, level, cid, 1)) + return PLUGIN_HANDLED + + new cmd[8] + + read_argv(1, cmd, 7) + + if (equali("on", cmd)) + switchCommand(id, 1) + else if (equali("off", cmd)) + switchCommand(id, 0) + else if (equali("list", cmd)) + { + new arg1[8] + new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1 + + if (--start < 0) + start = 0 + + if (start >= MAXMENUPOS) + start = MAXMENUPOS - 1 + + new end = start + 10 + + if (end > MAXMENUPOS) + end = MAXMENUPOS + + new lName[16], lValue[16], lStatus[16], lOnOff[16] + + format(lName, 15, "%L", id, "NAME") + format(lValue, 15, "%L", id, "VALUE") + format(lStatus, 15, "%L", id, "STATUS") + + console_print(id, "^n----- %L: -----", id, "WEAP_RES") + console_print(id, " %-32.31s %-10.9s %-9.8s", lName, lValue, lStatus) + + if (start != -1) + { + for (new a = start; a < end; ++a) + { + format(lOnOff, 15, "%L", id, positionBlocked(a) ? "ON" : "OFF") + console_print(id, "%3d: %-32.31s %-10.9s %-9.8s", a + 1, g_WeaponNames[a], g_Aliases[a], lOnOff) + } + } + + console_print(id, "----- %L -----", id, "REST_ENTRIES_OF", start + 1, end, MAXMENUPOS) + + if (end < MAXMENUPOS) + console_print(id, "----- %L -----", id, "REST_USE_MORE", end + 1) + else + console_print(id, "----- %L -----", id, "REST_USE_BEGIN") + } + else if (equali("save", cmd)) + { + if (saveSettings(g_saveFile)) + { + console_print(id, "%L", id, "REST_CONF_SAVED", g_saveFile) + g_Modified = false + } + else + console_print(id, "%L", id, "REST_COULDNT_SAVE", g_saveFile) + } + else if (equali("load", cmd)) + { + setc(g_blockPos, 112, 0) // Clear current settings + new arg1[64] + + if (read_argv(2, arg1, 63)) + { + new configsdir[32] + get_configsdir(configsdir, 31) + + format(arg1, 63, "%s/%s", configsdir, arg1) + } + + if (loadSettings(arg1)) + { + console_print(id, "%L", id, "REST_CONF_LOADED", arg1) + g_Modified = true + } + else + console_print(id, "%L", id, "REST_COULDNT_LOAD", arg1) + } else { + console_print(id, "%L", id, "COM_REST_USAGE") + console_print(id, "%L", id, "COM_REST_COMMANDS") + console_print(id, "%L", id, "COM_REST_ON") + console_print(id, "%L", id, "COM_REST_OFF") + console_print(id, "%L", id, "COM_REST_ONV") + console_print(id, "%L", id, "COM_REST_OFFV") + console_print(id, "%L", id, "COM_REST_LIST") + console_print(id, "%L", id, "COM_REST_SAVE") + console_print(id, "%L", id, "COM_REST_LOAD") + console_print(id, "%L", id, "COM_REST_VALUES") + console_print(id, "%L", id, "COM_REST_TYPE") + } + + return PLUGIN_HANDLED } -displayMenu(id,pos) { - if (pos < 0) return - new menubody[512], start = pos * 7 - if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0 - new len = format(menubody,511,"\y%L\R%d/5^n^n\w",id,"REST_WEAP",pos+1) - new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 - if (end > MAXMENUPOS) end = MAXMENUPOS +displayMenu(id, pos) +{ + if (pos < 0) + return + + new menubody[512], start = pos * 7 + + if (start >= MAXMENUPOS) + start = pos = g_Position[id] = 0 + + new len = format(menubody, 511, "\y%L\R%d/5^n^n\w", id, "REST_WEAP", pos + 1) + new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 + + if (end > MAXMENUPOS) + end = MAXMENUPOS - for (new a = start; a < end; ++a) { - keys |= (1< 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */ - return PLUGIN_CONTINUE + if (read_argv(0, arg, 12) > 11) /* Longest buy command has 11 chars so if command is longer then don't care */ + return PLUGIN_CONTINUE - new a = 0 + new a = 0 - do { - if ( equali( g_Aliases[g_AliasBlock[ a ]] , arg ) || - equali( g_Aliases2[g_AliasBlock[ a ]] , arg ) ) - { - client_print(id,print_center,g_Restricted ) - return PLUGIN_HANDLED - } - } while( ++a < g_AliasBlockNum ) - } - return PLUGIN_CONTINUE + do + { + if (equali(g_Aliases[g_AliasBlock[a]], arg) || equali(g_Aliases2[g_AliasBlock[a]], arg)) + { + client_print(id, print_center, g_Restricted) + return PLUGIN_HANDLED + } + } while (++a < g_AliasBlockNum) + } + + return PLUGIN_CONTINUE } -public blockcommand(id) { - client_print(id,print_center, g_Restricted ) - return PLUGIN_HANDLED +public blockcommand(id) +{ + client_print(id, print_center, g_Restricted) + return PLUGIN_HANDLED } -public cmdMenu(id,level,cid){ - if (cmd_access(id,level,cid,1)) - displayMenu(id, g_Position[id] = 0 ) - return PLUGIN_HANDLED +public cmdMenu(id, level, cid) +{ + if (cmd_access(id, level, cid, 1)) + displayMenu(id, g_Position[id] = 0) + + return PLUGIN_HANDLED } -checkRest(id,menu,key){ - new team = get_user_team(id) - if (team != 1 && team != 2) - return PLUGIN_HANDLED - if ( g_blockPos[ (menu * 8 + key) + (get_user_team(id) - 1) * 56 ] ){ - engclient_cmd(id,"menuselect","10") - client_print(id,print_center, g_Restricted ) - return PLUGIN_HANDLED - } - return PLUGIN_CONTINUE +checkRest(id, menu, key) +{ + new team = get_user_team(id) + + if (team != 1 && team != 2) + return PLUGIN_HANDLED + + if (g_blockPos[(menu * 8 + key) + (get_user_team(id) - 1) * 56]) + { + engclient_cmd(id, "menuselect", "10") + client_print(id, print_center, g_Restricted) + + return PLUGIN_HANDLED + } + + return PLUGIN_CONTINUE } -public ammoRest1(id) return checkRest(id,0,5) -public ammoRest2(id) return checkRest(id,0,6) -public menuBuy(id,key) return checkRest(id,0,key) -public menuPistol(id,key) return checkRest(id,1,key) -public menuShotgun(id,key) return checkRest(id,2,key) -public menuSub(id,key) return checkRest(id,3,key) -public menuRifle(id,key) return checkRest(id,4,key) -public menuMachine(id,key) return checkRest(id,5,key) -public menuItem(id,key) return checkRest(id,6,key) +public ammoRest1(id) return checkRest(id, 0, 5) +public ammoRest2(id) return checkRest(id, 0, 6) +public menuBuy(id, key) return checkRest(id, 0, key) +public menuPistol(id, key) return checkRest(id, 1, key) +public menuShotgun(id, key) return checkRest(id, 2, key) +public menuSub(id, key) return checkRest(id, 3, key) +public menuRifle(id, key) return checkRest(id, 4, key) +public menuMachine(id, key) return checkRest(id, 5, key) +public menuItem(id, key) return checkRest(id, 6, key) -saveSettings(filename[]) { - if (file_exists(filename)) - delete_file(filename) - if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name")) - return 0 - new text[64] - for(new a = 0; a < MAXMENUPOS; ++a) { - if ( positionBlocked( a ) ) { - format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a]) - write_file(filename,text) - } - } - return 1 +saveSettings(filename[]) +{ + if (file_exists(filename)) + delete_file(filename) + + if (!write_file(filename, "; Generated by Restrict Weapons Plugin. Do not modify!^n; value name")) + return 0 + + new text[64] + + for (new a = 0; a < MAXMENUPOS; ++a) + { + if (positionBlocked(a)) + { + format(text, 63, "%-16.15s ; %s", g_Aliases[a], g_WeaponNames[a]) + write_file(filename, text) + } + } + + return 1 } -loadSettings(filename[]) { - if (!file_exists(filename)) return 0 - new text[16] - new a, pos = 0 - while (read_file(filename,pos++,text,15, a )) { - if ( text[0] == ';' || !a ) continue // line is a comment - parse( text, text , 15 ) - if ( (a = findAliasId( text )) != -1 ) - setWeapon( a , 1 ) - } - return 1 +loadSettings(filename[]) +{ + if (!file_exists(filename)) + return 0 + + new text[16] + new a, pos = 0 + + while (read_file(filename, pos++, text, 15, a)) + { + if (text[0] == ';' || !a) + continue // line is a comment + + parse(text, text, 15) + + if ((a = findAliasId(text)) != -1) + setWeapon(a, 1) + } + + return 1 } // JGHG -public fn_setautobuy(id) { - // Don't do anything if no items are blocked. - if (!g_AliasBlockNum) - return PLUGIN_CONTINUE +public fn_setautobuy(id) +{ + // Don't do anything if no items are blocked. + if (!g_AliasBlockNum) + return PLUGIN_CONTINUE - // Empty user's autobuy prefs. (unnecessary?) - g_Autobuy[id][0] = '^0' + // Empty user's autobuy prefs. (unnecessary?) + g_Autobuy[id][0] = '^0' - new argCount = read_argc() + new argCount = read_argc() + new arg[128] + new autobuyLen = 0 + + for (new i = 1; i < argCount; i++) // Start at parameter 1; parameter 0 is just "cl_setautobuy" + { + read_argv(i, arg, 127) + // Add this parameter to user's autobuy prefs + autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) + + // If we detect more parameters, add a space + if (i + 1 < argCount) + autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ") + } - new arg[128] - new autobuyLen = 0 - for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy" - read_argv(i, arg, 127) + // Strip any blocked items + new strippedItems[AUTOBUYLENGTH + 1] + + if (!StripBlockedItems(g_Autobuy[id], strippedItems)) + return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... - // Add this parameter to user's autobuy prefs - autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) - // If we detect more parameters, add a space - if (i + 1 < argCount) - autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ") - } - - // Strip any blocked items - new strippedItems[AUTOBUYLENGTH + 1] - if (!StripBlockedItems(g_Autobuy[id], strippedItems)) - return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... - - //server_print("Stripped items: ^"%s^"", strippedItems) - engclient_cmd(id, "cl_setautobuy", strippedItems) - return PLUGIN_HANDLED + //server_print("Stripped items: ^"%s^"", strippedItems) + engclient_cmd(id, "cl_setautobuy", strippedItems) + + return PLUGIN_HANDLED } // Returns true if this strips any items, else false. -StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) { - // First copy string - format(outString, AUTOBUYLENGTH, inString) +StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) +{ + // First copy string + format(outString, AUTOBUYLENGTH, inString) - // Then strip those that are blocked. - for (new i = 0; i < g_AliasBlockNum; i++) { - while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1) - replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "") - while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1) - replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "") - } + // Then strip those that are blocked. + for (new i = 0; i < g_AliasBlockNum; i++) + { + while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1) + replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "") + while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1) + replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "") + } - // We COULD trim white space from outString here, but I don't think it really is necessary currently... + // We COULD trim white space from outString here, but I don't think it really is necessary currently... + if (strlen(outString) < strlen(inString)) + return true // outstring is shorter: we stripped items, return true - if (strlen(outString) < strlen(inString)) - return true // outstring is shorter: we stripped items, return true - - return false // else end here, return false, no items were stripped + return false // else end here, return false, no items were stripped } -public fn_autobuy(id) { - // Don't do anything if no items are blocked. - if (!g_AliasBlockNum) - return PLUGIN_CONTINUE +public fn_autobuy(id) +{ + // Don't do anything if no items are blocked. + if (!g_AliasBlockNum) + return PLUGIN_CONTINUE - // Strip any blocked items - new strippedItems[AUTOBUYLENGTH + 1] - if (!StripBlockedItems(g_Autobuy[id], strippedItems)) - return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... + // Strip any blocked items + new strippedItems[AUTOBUYLENGTH + 1] + + if (!StripBlockedItems(g_Autobuy[id], strippedItems)) + return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... - engclient_cmd(id, "cl_setautobuy", strippedItems) - return PLUGIN_HANDLED + engclient_cmd(id, "cl_setautobuy", strippedItems) + + return PLUGIN_HANDLED } -public plugin_init() { - register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team") - register_dictionary("restmenu.txt") - register_dictionary("common.txt") - register_clcmd("buyammo1","ammoRest1") - register_clcmd("buyammo2","ammoRest2") - register_clcmd("cl_setautobuy", "fn_setautobuy") - register_clcmd("cl_autobuy", "fn_autobuy") - register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu") - register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy") - register_menucmd(register_menuid("Restrict Weapons"),1023,"actionMenu") - register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol") - register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun") - register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub") - register_menucmd(register_menuid("BuyRifle", 1 ),511,"menuRifle") - register_menucmd(register_menuid("BuyMachine", 1 ),511,"menuMachine") - register_menucmd(register_menuid("BuyItem", 1 ),511,"menuItem") - register_menucmd(-28,511,"menuBuy" ) - register_menucmd(-29,511,"menuPistol" ) - register_menucmd(-30,511,"menuShotgun") - register_menucmd(-32,511,"menuSub") - register_menucmd(-31,511,"menuRifle") - register_menucmd(-33,511,"menuMachine") - register_menucmd(-34,511,"menuItem") - register_concmd("amx_restrict","cmdRest",ADMIN_CFG,"- displays help for weapons restriction") +public plugin_init() +{ + register_plugin("Restrict Weapons", AMXX_VERSION_STR, "AMXX Dev Team") + register_dictionary("restmenu.txt") + register_dictionary("common.txt") + register_clcmd("buyammo1", "ammoRest1") + register_clcmd("buyammo2", "ammoRest2") + register_clcmd("cl_setautobuy", "fn_setautobuy") + register_clcmd("cl_autobuy", "fn_autobuy") + register_clcmd("amx_restmenu", "cmdMenu", ADMIN_CFG, "- displays weapons restriction menu") + register_menucmd(register_menuid("#Buy", 1), 511, "menuBuy") + register_menucmd(register_menuid("Restrict Weapons"), 1023, "actionMenu") + register_menucmd(register_menuid("BuyPistol", 1), 511, "menuPistol") + register_menucmd(register_menuid("BuyShotgun", 1), 511, "menuShotgun") + register_menucmd(register_menuid("BuySub", 1), 511, "menuSub") + register_menucmd(register_menuid("BuyRifle", 1), 511, "menuRifle") + register_menucmd(register_menuid("BuyMachine", 1), 511, "menuMachine") + register_menucmd(register_menuid("BuyItem", 1), 511, "menuItem") + register_menucmd(-28, 511, "menuBuy") + register_menucmd(-29, 511, "menuPistol") + register_menucmd(-30, 511, "menuShotgun") + register_menucmd(-32, 511, "menuSub") + register_menucmd(-31, 511, "menuRifle") + register_menucmd(-33, 511, "menuMachine") + register_menucmd(-34, 511, "menuItem") + register_concmd("amx_restrict", "cmdRest", ADMIN_CFG, "- displays help for weapons restriction") - new configsDir[64]; - get_configsdir(configsDir, 63); + new configsDir[64]; + get_configsdir(configsDir, 63); #if defined MAPSETTINGS - new mapname[32] - get_mapname(mapname,31) - format(g_saveFile,63,"%s/weaprest_%s.ini",configsDir,mapname) + new mapname[32] + get_mapname(mapname, 31) + format(g_saveFile, 63, "%s/weaprest_%s.ini", configsDir, mapname) #else - format(g_saveFile,63,"%s/weaprest.ini",configsDir) + format(g_saveFile, 63, "%s/weaprest.ini", configsDir) #endif - loadSettings(g_saveFile) + loadSettings(g_saveFile) } diff --git a/plugins/cstrike/stats_logging.sma b/plugins/cstrike/stats_logging.sma index 185d9e93..5d228400 100755 --- a/plugins/cstrike/stats_logging.sma +++ b/plugins/cstrike/stats_logging.sma @@ -18,12 +18,12 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, +* along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception @@ -38,46 +38,60 @@ new g_pingSum[33] new g_pingCount[33] -public plugin_init() { - register_plugin("CS Stats Logging",AMXX_VERSION_STR,"AMXX Dev Team") +public plugin_init() +{ + register_plugin("CS Stats Logging", AMXX_VERSION_STR, "AMXX Dev Team") } -public client_disconnect(id) { - if ( is_user_bot(id) ) { - return - } - remove_task(id) - new szTeam[16],szName[32],szAuthid[32], iStats[8], iHits[8], szWeapon[24] - new iUserid = get_user_userid( id ) - get_user_team(id, szTeam, 15 ) - get_user_name(id, szName ,31 ) - get_user_authid(id, szAuthid , 31 ) - for (new i = 1 ; i < 31 ; ++i ) { - if ( get_user_wstats( id , i ,iStats , iHits ) ) { - xmod_get_wpnname( i , szWeapon , 23 ) - log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", - szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1]) - log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", - szName,iUserid,szAuthid,szTeam,szWeapon,iHits[1],iHits[2],iHits[3], iHits[4],iHits[5],iHits[6],iHits[7]) - } - } - new iTime = get_user_time(id,1) - log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", - szName,iUserid,szAuthid,szTeam, (iTime / 60), (iTime % 60) ) - log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")", - szName,iUserid,szAuthid,szTeam, (g_pingSum[id] / ( g_pingCount[id] ? g_pingCount[id] : 1 ) ) ) +public client_disconnect(id) +{ + if (is_user_bot(id)) + { + return + } + + remove_task(id) + + new szTeam[16], szName[32], szAuthid[32], iStats[8], iHits[8], szWeapon[24] + new iUserid = get_user_userid(id) + + get_user_team(id, szTeam, 15) + get_user_name(id, szName, 31) + get_user_authid(id, szAuthid, 31) + + for (new i = 1 ; i < 31 ; ++i) + { + if (get_user_wstats(id, i, iStats, iHits)) + { + xmod_get_wpnname(i, szWeapon, 23) + + log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", + szName, iUserid, szAuthid, szTeam, szWeapon, iStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1]) + log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", + szName, iUserid, szAuthid, szTeam, szWeapon, iHits[1], iHits[2], iHits[3], iHits[4], iHits[5], iHits[6], iHits[7]) + } + } + + new iTime = get_user_time(id, 1) + + log_message("^"%s<%d><%s><%s>^" triggered ^"time^" (time ^"%d:%02d^")", szName, iUserid, szAuthid, szTeam, (iTime / 60), (iTime % 60)) + log_message("^"%s<%d><%s><%s>^" triggered ^"latency^" (ping ^"%d^")", szName, iUserid, szAuthid, szTeam, (g_pingSum[id] / (g_pingCount[id] ? g_pingCount[id] : 1))) } -public client_putinserver(id) { - if ( !is_user_bot(id) ) { - g_pingSum[ id ] = g_pingCount[ id ] = 0 - set_task( 19.5 , "getPing" , id , "" , 0 , "b" ) - } +public client_putinserver(id) +{ + if (!is_user_bot(id)) + { + g_pingSum[id] = g_pingCount[id] = 0 + set_task(19.5, "getPing", id, "", 0, "b") + } } -public getPing(id) { - new iPing, iLoss - get_user_ping( id , iPing, iLoss) - g_pingSum[ id ] += iPing - ++g_pingCount[ id ] +public getPing(id) +{ + new iPing, iLoss + + get_user_ping(id, iPing, iLoss) + g_pingSum[id] += iPing + ++g_pingCount[id] } diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 621ab34b..5d173974 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -18,12 +18,12 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, +* along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception @@ -33,11 +33,9 @@ */ //-------------------------------- - #include #include #include - //-------------------------------- // Uncomment to activate log debug messages. @@ -64,7 +62,7 @@ // However amx_statscfg command is recommended public KillerChat = 0 // displays killer hp&ap to victim console - // and screen + // and screen public ShowAttackers = 0 // shows attackers public ShowVictims = 0 // shows victims @@ -114,16 +112,16 @@ public SpecRankInfo = 0 // displays rank info when spectating #define STATS_DAMAGE 6 // Global player flags. - -new BODY_PART[8][] = { - "WHOLEBODY", - "HEAD", - "CHEST", - "STOMACH", - "LEFTARM", - "RIGHTARM", - "LEFTLEG", - "RIGHTLEG" +new BODY_PART[8][] = +{ + "WHOLEBODY", + "HEAD", + "CHEST", + "STOMACH", + "LEFTARM", + "RIGHTARM", + "LEFTLEG", + "RIGHTLEG" } // Killer information, save killer info at the time when player is killed. @@ -141,15 +139,15 @@ new g_izKilled[MAX_PLAYERS][5] new g_iPluginMode = 0 -new g_izUserMenuPosition[MAX_PLAYERS] = { 0, ... } -new g_izUserMenuAction[MAX_PLAYERS] = { 0, ... } +new g_izUserMenuPosition[MAX_PLAYERS] = {0, ...} +new g_izUserMenuAction[MAX_PLAYERS] = {0, ...} new g_izUserMenuPlayers[MAX_PLAYERS][32] -new g_izSpecMode[MAX_PLAYERS] = { 0, ... } +new g_izSpecMode[MAX_PLAYERS] = {0, ...} -new g_izShowStatsFlags[MAX_PLAYERS] = { 0, ... } -new g_izStatsSwitch[MAX_PLAYERS] = { 0, ... } -new Float:g_fzShowUserStatsTime[MAX_PLAYERS] = { 0.0, ... } +new g_izShowStatsFlags[MAX_PLAYERS] = {0, ...} +new g_izStatsSwitch[MAX_PLAYERS] = {0, ...} +new Float:g_fzShowUserStatsTime[MAX_PLAYERS] = {0.0, ...} new Float:g_fShowStatsTime = 0.0 new Float:g_fFreezeTime = 0.0 new Float:g_fFreezeLimitTime = 0.0 @@ -159,1392 +157,1578 @@ new g_iRoundEndTriggered = 0 new g_iRoundEndProcessed = 0 new Float:g_fStartGame = 0.0 -new g_izTeamScore[MAX_TEAMS] = { 0, ... } -new g_izTeamEventScore[MAX_TEAMS] = { 0, ... } +new g_izTeamScore[MAX_TEAMS] = {0, ...} +new g_izTeamEventScore[MAX_TEAMS] = {0, ...} new g_izTeamRndStats[MAX_TEAMS][8] new g_izTeamGameStats[MAX_TEAMS][8] -new g_izUserUserID[MAX_PLAYERS] = { 0, ... } -new g_izUserAttackerDistance[MAX_PLAYERS] = { 0, ... } +new g_izUserUserID[MAX_PLAYERS] = {0, ...} +new g_izUserAttackerDistance[MAX_PLAYERS] = {0, ...} new g_izUserVictimDistance[MAX_PLAYERS][MAX_PLAYERS] new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH] new g_izUserRndStats[MAX_PLAYERS][8] new g_izUserGameStats[MAX_PLAYERS][8] // Common buffer to improve performance, as Small always zero-initializes all vars -new g_sBuffer[MAX_BUFFER_LENGTH+1] = "" -new g_sScore[MAX_TEXT_LENGTH+1] = "" -new g_sAwardAndScore[MAX_BUFFER_LENGTH+1] = "" +new g_sBuffer[MAX_BUFFER_LENGTH + 1] = "" +new g_sScore[MAX_TEXT_LENGTH + 1] = "" +new g_sAwardAndScore[MAX_BUFFER_LENGTH + 1] = "" -new t_sText[MAX_TEXT_LENGTH+1] = "" -new t_sName[MAX_NAME_LENGTH+1] = "" -new t_sWpn[MAX_WEAPON_LENGTH+1] = "" +new t_sText[MAX_TEXT_LENGTH + 1] = "" +new t_sName[MAX_NAME_LENGTH + 1] = "" +new t_sWpn[MAX_WEAPON_LENGTH + 1] = "" //-------------------------------- -// Initialize +// Initialize //-------------------------------- +public plugin_init() +{ + // Register plugin. + register_plugin("StatsX", AMXX_VERSION_STR, "AMXX Dev Team") + register_dictionary("statsx.txt") -public plugin_init() { - // Register plugin. - register_plugin( "StatsX", AMXX_VERSION_STR, "AMXX Dev Team") - register_dictionary("statsx.txt") + // Register events. + register_event("TextMsg", "eventStartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in") + register_event("ResetHUD", "eventResetHud", "be") + register_event("RoundTime", "eventStartRound", "bc") + register_event("SendAudio", "eventEndRound", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw") + register_event("TeamScore", "eventTeamScore", "a") + register_event("30", "eventIntermission", "a") + register_event("TextMsg", "eventSpecMode", "bd", "2&ec_Mod") + register_event("StatusValue", "eventShowRank", "bd", "1=2") - // Register events. - register_event( "TextMsg", "eventStartGame", "a", - "2=#Game_Commencing", "2=#Game_will_restart_in" ) - register_event( "ResetHUD", "eventResetHud", "be" ) - register_event( "RoundTime", "eventStartRound", "bc" ) + // Register commands. + register_clcmd("say /hp", "cmdHp", 0, "- display info. about your killer (chat)") + register_clcmd("say /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)") + register_clcmd("say /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)") + register_clcmd("say /me", "cmdMe", 0, "- display current round stats (chat)") + register_clcmd("say /score", "cmdScore", 0, "- display last score (chat)") + register_clcmd("say /rank", "cmdRank", 0, "- display your rank (chat)") + register_clcmd("say /report", "cmdReport", 0, "- display waepon status (say_team)") + register_clcmd("say /top15", "cmdTop15", 0, "- display top 15 players (MOTD)") + register_clcmd("say /stats", "cmdStats", 0, "- display players stats (menu/MOTD)") + register_clcmd("say /timeleft", "cmdTimeLeft", 0, "- display time left on map (say)") + register_clcmd("say /thetime", "cmdTheTime", 0, "- display the time (say)") + register_clcmd("say /currentmap", "cmdCurrentMap", 0, "- display current map (say)") + register_clcmd("say /ff", "cmdFf", 0, "- display friendly fire status (say)") + register_clcmd("say /switch", "cmdSwitch", 0, "- switch client's stats on or off") - register_event( "SendAudio", "eventEndRound", "a", - "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw" ) - register_event( "TeamScore", "eventTeamScore", "a" ) - register_event( "30", "eventIntermission", "a" ) + // Register menus. + register_menucmd(register_menuid("Server Stats"), 1023, "actionStatsMenu") - register_event( "TextMsg", "eventSpecMode", "bd", "2&ec_Mod" ) - register_event( "StatusValue", "eventShowRank", "bd", "1=2" ) + // Register special configuration setting and default value. + register_srvcmd("amx_statsx_mode", "cmdPluginMode", ADMIN_CFG, " - sets plugin options") - // Register commands. - register_clcmd( "say /hp", "cmdHp", 0, "- display info. about your killer (chat)" ) - register_clcmd( "say /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)" ) - register_clcmd( "say /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)" ) - register_clcmd( "say /me", "cmdMe", 0, "- display current round stats (chat)" ) - register_clcmd( "say /score", "cmdScore", 0, "- display last score (chat)" ) - register_clcmd( "say /rank", "cmdRank", 0, "- display your rank (chat)" ) - register_clcmd( "say /report", "cmdReport", 0, "- display waepon status (say_team)" ) +#if defined STATSX_DEBUG + register_clcmd("say /hudtest", "cmdHudTest") +#endif - register_clcmd( "say /top15", "cmdTop15", 0, "- display top 15 players (MOTD)" ) - register_clcmd( "say /stats", "cmdStats", 0, "- display players stats (menu/MOTD)" ) + register_cvar(HUD_DURATION_CVAR, HUD_DURATION) + register_cvar(HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT) - register_clcmd( "say /timeleft", "cmdTimeLeft", 0, "- display time left on map (say)" ) - register_clcmd( "say /thetime", "cmdTheTime", 0, "- display the time (say)" ) - register_clcmd( "say /currentmap", "cmdCurrentMap", 0, "- display current map (say)" ) - register_clcmd( "say /ff", "cmdFf", 0, "- display friendly fire status (say)" ) - - register_clcmd( "say /switch", "cmdSwitch", 0, "- switch client's stats on or off" ) - - // Register menus. - register_menucmd( register_menuid("Server Stats"), 1023, "actionStatsMenu" ) - - // Register special configuration setting and default value. - register_srvcmd( "amx_statsx_mode", "cmdPluginMode", ADMIN_CFG, " - sets plugin options" ) - - #if defined STATSX_DEBUG - register_clcmd( "say /hudtest", "cmdHudTest" ) - #endif - - register_cvar( HUD_DURATION_CVAR, HUD_DURATION ) - register_cvar( HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT ) - - // Init buffers and some global vars. - g_sBuffer[0] = 0 - save_team_chatscore() + // Init buffers and some global vars. + g_sBuffer[0] = 0 + save_team_chatscore() } -public plugin_cfg() { - new addStast[] = "amx_statscfg add ^"%s^" %s" +public plugin_cfg() +{ + new addStast[] = "amx_statscfg add ^"%s^" %s" - server_cmd( addStast, "Show killer hp&ap","KillerChat" ) + server_cmd(addStast, "Show killer hp&ap", "KillerChat") + server_cmd(addStast, "Show Attackers", "ShowAttackers") + server_cmd(addStast, "Show Victims", "ShowVictims") + server_cmd(addStast, "Show killer", "ShowKiller") + server_cmd(addStast, "Show Team Score", "ShowTeamScore") + server_cmd(addStast, "Show Total Stats", "ShowTotalStats") + server_cmd(addStast, "Show Best Score", "ShowBestScore") + server_cmd(addStast, "Show Most Disruptive", "ShowMostDisruptive") + server_cmd(addStast, "HUD-stats default", "ShowStats") + server_cmd(addStast, "Dist&HS in HUD lists", "ShowDistHS") + server_cmd(addStast, "Stats at the end of map", "EndPlayer") + server_cmd(addStast, "Top15 at the end of map", "EndTop15") + server_cmd(addStast, "Say /hp", "SayHP") + server_cmd(addStast, "Say /statsme", "SayStatsMe") + server_cmd(addStast, "Say /rankstats", "SayRankStats") + server_cmd(addStast, "Say /me", "SayMe") + server_cmd(addStast, "Say /rank", "SayRank") + server_cmd(addStast, "Say /report", "SayReport") + server_cmd(addStast, "Say /score", "SayScore") + server_cmd(addStast, "Say /top15", "SayTop15") + server_cmd(addStast, "Say /stats", "SayStatsAll") + server_cmd(addStast, "Misc say commands", "SayMiscFunc") + server_cmd(addStast, "Spec. Rank Info", "SpecRankInfo") - server_cmd( addStast, "Show Attackers", "ShowAttackers" ) - server_cmd( addStast, "Show Victims", "ShowVictims" ) - server_cmd( addStast, "Show killer", "ShowKiller" ) - server_cmd( addStast, "Show Team Score", "ShowTeamScore" ) - server_cmd( addStast, "Show Total Stats", "ShowTotalStats" ) - server_cmd( addStast, "Show Best Score", "ShowBestScore" ) - server_cmd( addStast, "Show Most Disruptive", "ShowMostDisruptive" ) - - server_cmd( addStast, "HUD-stats default", "ShowStats" ) - server_cmd( addStast, "Dist&HS in HUD lists", "ShowDistHS" ) - - server_cmd( addStast, "Stats at the end of map", "EndPlayer") - server_cmd( addStast, "Top15 at the end of map", "EndTop15" ) - - server_cmd( addStast, "Say /hp", "SayHP" ) - server_cmd( addStast, "Say /statsme", "SayStatsMe" ) - server_cmd( addStast, "Say /rankstats", "SayRankStats" ) - server_cmd( addStast, "Say /me", "SayMe" ) - server_cmd( addStast, "Say /rank", "SayRank" ) - server_cmd( addStast, "Say /report", "SayReport" ) - server_cmd( addStast, "Say /score", "SayScore" ) - server_cmd( addStast, "Say /top15", "SayTop15" ) - server_cmd( addStast, "Say /stats", "SayStatsAll" ) - server_cmd( addStast, "Misc say commands", "SayMiscFunc" ) - - server_cmd( addStast, "Spec. Rank Info", "SpecRankInfo" ) - - // Update local configuration vars with value in cvars. - get_config_cvars() + // Update local configuration vars with value in cvars. + get_config_cvars() } // Set hudmessage format. -set_hudtype_killer( Float:fDuration ) - set_hudmessage( 220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 2 ) -set_hudtype_endround( Float:fDuration ) - set_hudmessage( 100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 1 ) -set_hudtype_attacker( Float:fDuration ) - set_hudmessage( 220, 80, 0, 0.55, 0.35, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 3 ) -set_hudtype_victim( Float:fDuration ) - set_hudmessage( 0, 80, 220, 0.55, 0.60, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 4 ) -set_hudtype_specmode() { - set_hudmessage( 255, 255, 255, 0.02, 0.87, 2, 0.05, 0.1, 0.01, 3.0, 1) +set_hudtype_killer(Float:fDuration) + set_hudmessage(220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, 2) + +set_hudtype_endround(Float:fDuration) + set_hudmessage(100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, 1) + +set_hudtype_attacker(Float:fDuration) + set_hudmessage(220, 80, 0, 0.55, 0.35, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, 3) + +set_hudtype_victim(Float:fDuration) + set_hudmessage(0, 80, 220, 0.55, 0.60, 0, 6.0, fDuration, (fDuration >= g_fHUDDuration) ? 1.0 : 0.0, 1.0, 4) + +set_hudtype_specmode() +{ + set_hudmessage(255, 255, 255, 0.02, 0.87, 2, 0.05, 0.1, 0.01, 3.0, 1) } #if defined STATSX_DEBUG -public cmdHudTest( id ) { - new i, iLen - iLen = 0 - for ( i = 1; i < 20; i++ ) - iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n" ) - set_hudtype_killer( 50.0 ) - show_hudmessage( id, g_sBuffer ) +public cmdHudTest(id) +{ + new i, iLen + iLen = 0 + + for (i = 1; i < 20; i++) + iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n") + + set_hudtype_killer(50.0) + show_hudmessage(id, g_sBuffer) } #endif // Stats formulas -Float:accuracy( izStats[8] ) { - if ( !izStats[STATS_SHOTS] ) return ( 0.0 ) - return ( 100.0 * float( izStats[STATS_HITS] ) / float( izStats[STATS_SHOTS] ) ) +Float:accuracy(izStats[8]) +{ + if (!izStats[STATS_SHOTS]) + return (0.0) + + return (100.0 * float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS])) } -Float:effec( izStats[8] ) { - if ( !izStats[STATS_KILLS] ) return ( 0.0 ) - return ( 100.0 * float( izStats[STATS_KILLS] ) / float( izStats[STATS_KILLS] + izStats[STATS_DEATHS] ) ) +Float:effec(izStats[8]) +{ + if (!izStats[STATS_KILLS]) + return (0.0) + + return (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS])) } // Distance formula (metric) -Float:distance( iDistance ) { - return float( iDistance ) * 0.0254 +Float:distance(iDistance) +{ + return float(iDistance) * 0.0254 } // Get plugin config flags. -set_plugin_mode( id, sFlags[] ) { - if ( sFlags[0] ) - g_iPluginMode = read_flags( sFlags ) - get_flags( g_iPluginMode, t_sText, MAX_TEXT_LENGTH ) - console_print( id, "%L", id, "MODE_SET_TO", t_sText ) - return g_iPluginMode +set_plugin_mode(id, sFlags[]) +{ + if (sFlags[0]) + g_iPluginMode = read_flags(sFlags) + + get_flags(g_iPluginMode, t_sText, MAX_TEXT_LENGTH) + console_print(id, "%L", id, "MODE_SET_TO", t_sText) + + return g_iPluginMode } // Get config parameters. -get_config_cvars() { - g_fFreezeTime = get_cvar_float("mp_freezetime") - if ( g_fFreezeTime < 0.0 ) g_fFreezeTime = 0.0 +get_config_cvars() +{ + g_fFreezeTime = get_cvar_float("mp_freezetime") + + if (g_fFreezeTime < 0.0) + g_fFreezeTime = 0.0 - g_fHUDDuration = get_cvar_float( HUD_DURATION_CVAR ) - if ( g_fHUDDuration < 1.0 ) g_fHUDDuration = 1.0 + g_fHUDDuration = get_cvar_float(HUD_DURATION_CVAR) + + if (g_fHUDDuration < 1.0) + g_fHUDDuration = 1.0 - g_fFreezeLimitTime = get_cvar_float( HUD_FREEZE_LIMIT_CVAR ) + g_fFreezeLimitTime = get_cvar_float(HUD_FREEZE_LIMIT_CVAR) } // Get and format attackers header and list. -get_attackers( id, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new izStats[8],izBody[8] - new iAttacker - new iFound, iLen - new iMaxPlayer = get_maxplayers() +get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new izStats[8], izBody[8] + new iAttacker + new iFound, iLen + new iMaxPlayer = get_maxplayers() - iFound = 0 - sBuffer[0] = 0 - - // Get and format header. Add killing attacker statistics if user is dead. - // Make sure shots is greater than zero or division by zero will occur. - // To print a '%', 4 of them must done in a row. - izStats[STATS_SHOTS] = 0 - iAttacker = g_izKilled[id][KILLED_KILLER_ID] - if ( iAttacker ) - get_user_astats( id, iAttacker, izStats, izBody ) - if ( izStats[STATS_SHOTS] && ShowFullStats ) { - get_user_name( iAttacker, t_sName, MAX_NAME_LENGTH ) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%%%% %L:^n", - id, "ATTACKERS", t_sName, accuracy( izStats ), id, "ACC" ) - } - else - iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS" ) + iFound = 0 + sBuffer[0] = 0 - // Get and format attacker list. - for ( iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++ ) { - if ( get_user_astats( id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) ) { - iFound = 1 - get_user_name( iAttacker, t_sName, 32 ) - if ( izStats[STATS_KILLS] ) { - if ( !ShowDistHS ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn ) - else if ( izStats[STATS_HS] ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn, distance(g_izUserAttackerDistance[id]) ) - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s / %0.0f m^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn, distance(g_izUserAttackerDistance[id]) ) - } - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG" ) - } - } - if ( !iFound ) - sBuffer[0] = 0 - return iFound + // Get and format header. Add killing attacker statistics if user is dead. + // Make sure shots is greater than zero or division by zero will occur. + // To print a '%', 4 of them must done in a row. + izStats[STATS_SHOTS] = 0 + iAttacker = g_izKilled[id][KILLED_KILLER_ID] + + if (iAttacker) + get_user_astats(id, iAttacker, izStats, izBody) + + if (izStats[STATS_SHOTS] && ShowFullStats) + { + get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH) + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%%%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC") + } + else + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS") + + // Get and format attacker list. + for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++) + { + if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH)) + { + iFound = 1 + get_user_name(iAttacker, t_sName, 32) + + if (izStats[STATS_KILLS]) + { + if (!ShowDistHS) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn) + else if (izStats[STATS_HS]) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id])) + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id])) + } + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG") + } + } + + if (!iFound) + sBuffer[0] = 0 + + return iFound } - // Get and format victims header and list -get_victims( id, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new izStats[8], izBody[8] - new iVictim - new iFound, iLen - new iMaxPlayer = get_maxplayers() +get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new izStats[8], izBody[8] + new iVictim + new iFound, iLen + new iMaxPlayer = get_maxplayers() - iFound = 0 - sBuffer[0] = 0 - - // Get and format header. - // Make sure shots is greater than zero or division by zero will occur. - // To print a '%', 4 of them must done in a row. - izStats[STATS_SHOTS] = 0 - get_user_vstats( id, 0, izStats, izBody ) - if ( izStats[STATS_SHOTS] ) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%%%% %L:^n", - id, "VICTIMS", accuracy( izStats ), id, "ACC" ) - else - iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS" ) + iFound = 0 + sBuffer[0] = 0 - for ( iVictim = 1; iVictim <= iMaxPlayer; iVictim++ ) { - if( get_user_vstats( id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) ) { - iFound = 1 - get_user_name( iVictim, t_sName, MAX_NAME_LENGTH ) - if ( izStats[STATS_DEATHS] ) { - if ( !ShowDistHS ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn ) - else if ( izStats[STATS_HS] ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn, distance(g_izUserVictimDistance[id][iVictim]) ) - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L / %s / %0.0f m^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", - t_sWpn, distance(g_izUserVictimDistance[id][iVictim]) ) - } - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%s -- %d %L / %d %L^n", - t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG" ) - } - } - if ( !iFound ) - sBuffer[0] = 0 + // Get and format header. + // Make sure shots is greater than zero or division by zero will occur. + // To print a '%', 4 of them must done in a row. + izStats[STATS_SHOTS] = 0 + get_user_vstats(id, 0, izStats, izBody) + + if (izStats[STATS_SHOTS]) + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%%%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC") + else + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS") - return iFound + for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++) + { + if (get_user_vstats(id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH)) + { + iFound = 1 + get_user_name(iVictim, t_sName, MAX_NAME_LENGTH) + + if (izStats[STATS_DEATHS]) + { + if (!ShowDistHS) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn) + else if (izStats[STATS_HS]) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim])) + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S", + izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim])) + } + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG") + } + } + + if (!iFound) + sBuffer[0] = 0 + + return iFound } - // Get and format kill info. -get_kill_info( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new iFound, iLen +get_kill_info(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new iFound, iLen - iFound = 0 - sBuffer[0] = 0 + iFound = 0 + sBuffer[0] = 0 - if ( iKiller && iKiller != id ) { - new izAStats[8], izABody[8], izVStats[8], iaVBody[8] + if (iKiller && iKiller != id) + { + new izAStats[8], izABody[8], izVStats[8], iaVBody[8] - iFound = 1 - get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) + iFound = 1 + get_user_name(iKiller, t_sName, MAX_NAME_LENGTH) - izAStats[STATS_HITS] = 0 - izAStats[STATS_DAMAGE] = 0 - t_sWpn[0] = 0 - get_user_astats( id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH ) + izAStats[STATS_HITS] = 0 + izAStats[STATS_DAMAGE] = 0 + t_sWpn[0] = 0 + get_user_astats(id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH) - izVStats[STATS_HITS] = 0 - izVStats[STATS_DAMAGE] = 0 - get_user_vstats( id, iKiller, izVStats, iaVBody ) + izVStats[STATS_HITS] = 0 + izVStats[STATS_DAMAGE] = 0 + get_user_vstats(id, iKiller, izVStats, iaVBody) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, - "%L^n", id, "KILLED_YOU_DIST", - t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]) ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%L^n", id, "DID_DMG_HITS", - izAStats[STATS_DAMAGE], izAStats[STATS_HITS], - g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%L^n", id, "YOU_DID_DMG", - izVStats[STATS_DAMAGE], izVStats[STATS_HITS] ) - } - return iFound + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id])) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "DID_DMG_HITS", izAStats[STATS_DAMAGE], izAStats[STATS_HITS], g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR]) + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS]) + } + + return iFound } - // Get and format most disruptive. -add_most_disruptive( sBuffer[MAX_BUFFER_LENGTH+1] ) { - new id, iMaxDamageId, iMaxDamage, iMaxHeadShots - - iMaxDamageId = 0 - iMaxDamage = 0 - iMaxHeadShots = 0 +add_most_disruptive(sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new id, iMaxDamageId, iMaxDamage, iMaxHeadShots - // Find player. - for ( id = 1; id < MAX_PLAYERS; id++ ) { - if ( g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && - ( g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots ) ) { - iMaxDamageId = id - iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE] - iMaxHeadShots = g_izUserRndStats[id][STATS_HS] - } - } + iMaxDamageId = 0 + iMaxDamage = 0 + iMaxHeadShots = 0 - // Format statistics. - if ( iMaxDamageId ) { - id = iMaxDamageId - new Float:fGameEff = effec( g_izUserGameStats[id] ) - new Float:fRndAcc = accuracy( g_izUserRndStats[id] ) - format( t_sText, MAX_TEXT_LENGTH, - "%L: %s^n%d %L / %d %L -- %0.2f%%%% %L / %0.2f%%%% %L^n", - LANG_SERVER, "MOST_DMG", g_izUserRndName[id], g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", - iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC" ) - add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) - } - return iMaxDamageId + // Find player. + for (id = 1; id < MAX_PLAYERS; id++) + { + if (g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots)) + { + iMaxDamageId = id + iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE] + iMaxHeadShots = g_izUserRndStats[id][STATS_HS] + } + } + + // Format statistics. + if (iMaxDamageId) + { + id = iMaxDamageId + + new Float:fGameEff = effec(g_izUserGameStats[id]) + new Float:fRndAcc = accuracy(g_izUserRndStats[id]) + + format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d %L -- %0.2f%%%% %L / %0.2f%%%% %L^n", LANG_SERVER, "MOST_DMG", g_izUserRndName[id], + g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC") + add(sBuffer, MAX_BUFFER_LENGTH, t_sText) + } + + return iMaxDamageId } // Get and format best score. -add_best_score( sBuffer[MAX_BUFFER_LENGTH+1] ) { - new id, iMaxKillsId, iMaxKills, iMaxHeadShots +add_best_score(sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new id, iMaxKillsId, iMaxKills, iMaxHeadShots - iMaxKillsId = 0 - iMaxKills = 0 - iMaxHeadShots = 0 + iMaxKillsId = 0 + iMaxKills = 0 + iMaxHeadShots = 0 - // Find player - for ( id = 1; id < MAX_PLAYERS; id++ ) { - if ( g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && - ( g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots ) ) { - iMaxKillsId = id - iMaxKills = g_izUserRndStats[id][STATS_KILLS] - iMaxHeadShots = g_izUserRndStats[id][STATS_HS] - } - } + // Find player + for (id = 1; id < MAX_PLAYERS; id++) + { + if (g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots)) + { + iMaxKillsId = id + iMaxKills = g_izUserRndStats[id][STATS_KILLS] + iMaxHeadShots = g_izUserRndStats[id][STATS_HS] + } + } - // Format statistics. - if ( iMaxKillsId ) { - id = iMaxKillsId - new Float:fGameEff = effec( g_izUserGameStats[id] ) - new Float:fRndAcc = accuracy( g_izUserRndStats[id] ) - format( t_sText, MAX_TEXT_LENGTH, - "%L: %s^n%d %L / %d hs -- %0.2f%%%% %L / %0.2f%%%% %L^n", - LANG_SERVER, "BEST_SCORE", g_izUserRndName[id], iMaxKills, LANG_SERVER, "KILL_S", - iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC" ) - add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) - } - return iMaxKillsId + // Format statistics. + if (iMaxKillsId) + { + id = iMaxKillsId + + new Float:fGameEff = effec(g_izUserGameStats[id]) + new Float:fRndAcc = accuracy(g_izUserRndStats[id]) + + format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d hs -- %0.2f%%%% %L / %0.2f%%%% %L^n", LANG_SERVER, "BEST_SCORE", g_izUserRndName[id], + iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC") + add(sBuffer, MAX_BUFFER_LENGTH, t_sText) + } + + return iMaxKillsId } - // Get and format team score. -add_team_score( sBuffer[MAX_BUFFER_LENGTH+1] ) { - new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] +add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] - // Calculate team stats - for ( new iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) { - fzMapEff[iTeam] = effec( g_izTeamGameStats[iTeam] ) - fzMapAcc[iTeam] = accuracy( g_izTeamGameStats[iTeam] ) - fzRndAcc[iTeam] = accuracy( g_izTeamRndStats[iTeam] ) - } + // Calculate team stats + for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++) + { + fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam]) + fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam]) + fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam]) + } - // Format round team stats, MOTD - format( t_sText, MAX_TEXT_LENGTH, - "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L^nCT %d / %0.2f%%%% %L / %0.2f%%%% %L^n", - g_izTeamScore[0], fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", - g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC" ) - add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) + // Format round team stats, MOTD + format(t_sText, MAX_TEXT_LENGTH, "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L^nCT %d / %0.2f%%%% %L / %0.2f%%%% %L^n", g_izTeamScore[0], + fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC") + add(sBuffer, MAX_BUFFER_LENGTH, t_sText) } - // Get and format team stats, chat version -save_team_chatscore() { - new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] +save_team_chatscore() +{ + new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] - // Calculate team stats - for ( new iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) { - fzMapEff[iTeam] = effec( g_izTeamGameStats[iTeam] ) - fzMapAcc[iTeam] = accuracy( g_izTeamGameStats[iTeam] ) - fzRndAcc[iTeam] = accuracy( g_izTeamRndStats[iTeam] ) - } + // Calculate team stats + for (new iTeam = 0; iTeam < MAX_TEAMS; iTeam++) + { + fzMapEff[iTeam] = effec(g_izTeamGameStats[iTeam]) + fzMapAcc[iTeam] = accuracy(g_izTeamGameStats[iTeam]) + fzRndAcc[iTeam] = accuracy(g_izTeamRndStats[iTeam]) + } - // Format game team stats, chat - format( g_sScore, MAX_BUFFER_LENGTH, - "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L -- CT %d / %0.2f%%%% %L / %0.2f%%%% %L", - g_izTeamScore[0], fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", - g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC" ) + // Format game team stats, chat + format(g_sScore, MAX_BUFFER_LENGTH, "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L -- CT %d / %0.2f%%%% %L / %0.2f%%%% %L", g_izTeamScore[0], + fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC") } // Get and format total stats. -add_total_stats( sBuffer[MAX_BUFFER_LENGTH+1] ) { - format( t_sText, MAX_TEXT_LENGTH, - "%L: %d %L / %d hs -- %d %L / %d %L^n", - LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S", g_izUserRndStats[0][STATS_HS], - g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S" ) - add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) +add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + format(t_sText, MAX_TEXT_LENGTH, "%L: %d %L / %d hs -- %d %L / %d %L^n", LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S", + g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S") + add(sBuffer, MAX_BUFFER_LENGTH, t_sText) } - // Get and format a user's list of body hits from an attacker. -add_attacker_hits( id, iAttacker, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new iFound = 0 - if ( iAttacker && iAttacker != id ) { - new izStats[8], izBody[8], iLen +add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new iFound = 0 + + if (iAttacker && iAttacker != id) + { + new izStats[8], izBody[8], iLen - izStats[STATS_HITS] = 0 - get_user_astats( id, iAttacker, izStats, izBody ) + izStats[STATS_HITS] = 0 + get_user_astats(id, iAttacker, izStats, izBody) - if ( izStats[STATS_HITS] ) { - iFound = 1 - iLen = strlen( sBuffer ) - get_user_name( iAttacker, t_sName, MAX_NAME_LENGTH ) - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%L:^n", id, "HITS_YOU_IN", t_sName ) - for ( new i = 1; i < 8; i++ ) { - if ( !izBody[i] ) continue - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - "%L: %d^n", id, BODY_PART[i], izBody[i] ) - } - } - } - return iFound + if (izStats[STATS_HITS]) + { + iFound = 1 + iLen = strlen(sBuffer) + get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH) + + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName) + + for (new i = 1; i < 8; i++) + { + if (!izBody[i]) + continue + + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i]) + } + } + } + + return iFound } - // Get and format killed stats: killer hp, ap, hits. -format_kill_ainfo( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new iFound = 0 - if ( iKiller && iKiller != id ) { - new izStats[8], izBody[8] - new iLen - iFound = 1 - get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) +format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new iFound = 0 + + if (iKiller && iKiller != id) + { + new izStats[8], izBody[8] + new iLen + + iFound = 1 + get_user_name(iKiller, t_sName, MAX_NAME_LENGTH) + izStats[STATS_HITS] = 0 + get_user_astats(id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH) - izStats[STATS_HITS] = 0 - get_user_astats( id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]), + g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR]) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, - "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, - distance(g_izUserAttackerDistance[id]), - g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ) - - if ( izStats[STATS_HITS] ) { - for ( new i = 1; i < 8; i++ ) { - if ( !izBody[i] ) continue - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - " %L: %d", id, BODY_PART[i], izBody[i] ) - } - } - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - " %L", id, "NO_HITS" ) - } - else - format( sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER" ) - return iFound + if (izStats[STATS_HITS]) + { + for (new i = 1; i < 8; i++) + { + if (!izBody[i]) + continue + + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i]) + } + } + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS") + } + else + format(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER") + + return iFound } - // Get and format killed stats: hits, damage on killer. -format_kill_vinfo( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { - new iFound = 0 - new izStats[8] - new izBody[8] - new iLen +format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new iFound = 0 + new izStats[8] + new izBody[8] + new iLen - izStats[STATS_HITS] = 0 - izStats[STATS_DAMAGE] = 0 - get_user_vstats( id, iKiller, izStats, izBody ) + izStats[STATS_HITS] = 0 + izStats[STATS_DAMAGE] = 0 + get_user_vstats(id, iKiller, izStats, izBody) - if ( iKiller && iKiller != id ) { - iFound = 1 - get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, - "%L >>", id, "YOU_HIT", - t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE] ) - } - else - iLen = format( sBuffer, MAX_BUFFER_LENGTH, - "%L >>", id, "LAST_RES", - izStats[STATS_HITS], izStats[STATS_DAMAGE] ) + if (iKiller && iKiller != id) + { + iFound = 1 + get_user_name(iKiller, t_sName, MAX_NAME_LENGTH) + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE]) + } + else + iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE]) - if ( izStats[STATS_HITS] ) { - for ( new i = 1; i < 8; i++ ) { - if ( !izBody[i] ) continue - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - " %L: %d", id, BODY_PART[i], izBody[i] ) - } - } - else - iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, - " %L", id, "NO_HITS" ) - return iFound + if (izStats[STATS_HITS]) + { + for (new i = 1; i < 8; i++) + { + if (!izBody[i]) + continue + + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i]) + } + } + else + iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS") + + return iFound } - // Get and format top 15. -format_top15( sBuffer[MAX_BUFFER_LENGTH+1] ){ - new iMax = get_statsnum() - new izStats[8], izBody[8] - new iLen = 0 +format_top15(sBuffer[MAX_BUFFER_LENGTH + 1]) +{ + new iMax = get_statsnum() + new izStats[8], izBody[8] + new iLen = 0 - if ( iMax > 15 ) - iMax = 15 + if (iMax > 15) + iMax = 15 - new lKills[16],lDeaths[16],lHits[16],lShots[16],lEff[16],lAcc[16] - format(lKills,15,"%L",LANG_SERVER,"KILLS") - format(lDeaths,15,"%L",LANG_SERVER,"DEATHS") - format(lHits,15,"%L",LANG_SERVER,"HITS") - format(lShots,15,"%L",LANG_SERVER,"SHOTS") - format(lEff,15,"%L",LANG_SERVER,"EFF") - format(lAcc,15,"%L",LANG_SERVER,"ACC") - ucfirst(lEff) - ucfirst(lAcc) + new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16] + + format(lKills, 15, "%L", LANG_SERVER, "KILLS") + format(lDeaths, 15, "%L", LANG_SERVER, "DEATHS") + format(lHits, 15, "%L", LANG_SERVER, "HITS") + format(lShots, 15, "%L", LANG_SERVER, "SHOTS") + format(lEff, 15, "%L", LANG_SERVER, "EFF") + format(lAcc, 15, "%L", LANG_SERVER, "ACC") + + ucfirst(lEff) + ucfirst(lAcc) - iLen = format( sBuffer, MAX_BUFFER_LENGTH, - "
" )
-  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                  "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n",
-                  "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc )
-  for ( new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++ ) {
-    get_stats( i, izStats, izBody, t_sName, MAX_NAME_LENGTH )
-    iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                    "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i+1, t_sName,
-                    izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_HITS], 
-                    izStats[STATS_SHOTS], izStats[STATS_HS],
-                    effec( izStats ), accuracy( izStats ) )
-  }
+	iLen = format(sBuffer, MAX_BUFFER_LENGTH, "
")
+	iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n", "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc)
+	
+	for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
+	{
+		get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
+		iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i + 1, t_sName, izStats[STATS_KILLS], 
+						izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats))
+	}
 }
 
-
 // Get and format rank stats.
-format_rankstats( id, sBuffer[MAX_BUFFER_LENGTH+1], iMyId=0 ) {
-  new izStats[8] = { 0, ... }
-  new izBody[8]
-  new iRankPos, iLen
-  new lKills[16],lDeaths[16],lHits[16],lShots[16],lDamage[16],lEff[16],lAcc[16]
-  format(lKills,15,"%L",id,"KILLS")
-  format(lDeaths,15,"%L",id,"DEATHS")
-  format(lHits,15,"%L",id,"HITS")
-  format(lShots,15,"%L",id,"SHOTS")
-  format(lDamage,15,"%L",id,"DAMAGE")
-  format(lEff,15,"%L",id,"EFF")
-  format(lAcc,15,"%L",id,"ACC")
-  ucfirst(lEff)
-  ucfirst(lAcc)
-  iRankPos = get_user_stats( id, izStats, izBody )
-  iLen = format( sBuffer, MAX_BUFFER_LENGTH, 
-                  "
" )
-  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                  "%L %L^n^n", id, (!iMyId||iMyId==id)?"YOUR":"PLAYERS",
-                  id, "RANK_IS", iRankPos, get_statsnum() )
-  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                  "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
-                  lKills, izStats[STATS_KILLS], izStats[STATS_HS], 
-                  lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], 
-                  lShots, izStats[STATS_SHOTS], lDamage, izStats[STATS_DAMAGE], 
-                  lEff, effec( izStats ), lAcc, accuracy( izStats ) )
-  new L_BODY_PART[8][32]
-  for (new i=1; i<8; i++) {
-    format(L_BODY_PART[i],31,"%L",id,BODY_PART[i])
-  }
-  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                  "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d",
-                  "HITS", L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], 
-                  L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5], izBody[5], 
-                  L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
+format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
+{
+	new izStats[8] = {0, ...}
+	new izBody[8]
+	new iRankPos, iLen
+	new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16]
+	
+	format(lKills, 15, "%L", id, "KILLS")
+	format(lDeaths, 15, "%L", id, "DEATHS")
+	format(lHits, 15, "%L", id, "HITS")
+	format(lShots, 15, "%L", id, "SHOTS")
+	format(lDamage, 15, "%L", id, "DAMAGE")
+	format(lEff, 15, "%L", id, "EFF")
+	format(lAcc, 15, "%L", id, "ACC")
+	
+	ucfirst(lEff)
+	ucfirst(lAcc)
+	
+	iRankPos = get_user_stats(id, izStats, izBody)
+	iLen = format(sBuffer, MAX_BUFFER_LENGTH, "
")
+	iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L %L^n^n", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum())
+	iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n", 
+					lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS], 
+					lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
+	
+	new L_BODY_PART[8][32]
+	
+	for (new i = 1; i < 8; i++)
+	{
+		format(L_BODY_PART[i], 31, "%L", id, BODY_PART[i])
+	}
+	
+	iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d", "HITS", 
+					L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5], 
+					izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
 }
 
-
 // Get and format stats.
-format_stats( id, sBuffer[MAX_BUFFER_LENGTH+1] ) {
-  new izStats[8] = { 0, ... }
-  new izBody[8]
-  new iWeapon, iLen
-  new lKills[16],lDeaths[16],lHits[16],lShots[16],lDamage[16],lEff[16],lAcc[16],lWeapon[16]
-  format(lKills,15,"%L",id,"KILLS")
-  format(lDeaths,15,"%L",id,"DEATHS")
-  format(lHits,15,"%L",id,"HITS")
-  format(lShots,15,"%L",id,"SHOTS")
-  format(lDamage,15,"%L",id,"DAMAGE")
-  format(lEff,15,"%L",id,"EFF")
-  format(lAcc,15,"%L",id,"ACC")
-  format(lWeapon,15,"%L",id,"WEAPON")
-  ucfirst(lEff)
-  ucfirst(lAcc)
-  get_user_wstats( id, 0, izStats, izBody )
-  iLen = format( sBuffer, MAX_BUFFER_LENGTH, 
-                  "
" )
-  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
-                  "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
-                  lKills, izStats[STATS_KILLS], izStats[STATS_HS], 
-                  lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], 
-                  lShots, izStats[STATS_SHOTS], lDamage, izStats[STATS_DAMAGE], 
-                  lEff, effec( izStats ), lAcc, accuracy( izStats ) )
-  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 < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++ ) {
-    if ( get_user_wstats( id, iWeapon, izStats, izBody ) ) {
-      xmod_get_wpnname( 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, izStats[STATS_KILLS], izStats[STATS_DEATHS], 
-                      izStats[STATS_HITS], izStats[STATS_SHOTS], 
-                      izStats[STATS_DAMAGE], accuracy( izStats ) )
-    }
-  }
+format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
+{
+	new izStats[8] = {0, ...}
+	new izBody[8]
+	new iWeapon, iLen
+	new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16], lWeapon[16]
+	
+	format(lKills, 15, "%L", id, "KILLS")
+	format(lDeaths, 15, "%L", id, "DEATHS")
+	format(lHits, 15, "%L", id, "HITS")
+	format(lShots, 15, "%L", id, "SHOTS")
+	format(lDamage, 15, "%L", id, "DAMAGE")
+	format(lEff, 15, "%L", id, "EFF")
+	format(lAcc, 15, "%L", id, "ACC")
+	format(lWeapon, 15, "%L", id, "WEAPON")
+	
+	ucfirst(lEff)
+	ucfirst(lAcc)
+	
+	get_user_wstats(id, 0, izStats, izBody)
+	
+	iLen = format(sBuffer, MAX_BUFFER_LENGTH, "
")
+	iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n", 
+					lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS], 
+					lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
+	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 < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++)
+	{
+		if (get_user_wstats(id, iWeapon, izStats, izBody))
+		{
+			xmod_get_wpnname(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, izStats[STATS_KILLS], izStats[STATS_DEATHS], 
+							izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats))
+		}
+	}
 }
 
 // Show round end stats. If gametime is zero then use default duration time. 
-show_roundend_hudstats( id, Float:fGameTime ) {
-  
-  // Bail out if there no HUD stats should be shown
-  // for this player or end round stats not created.
-  if ( !g_izStatsSwitch[id] ) return
-  if ( !g_sAwardAndScore[0] ) return
+show_roundend_hudstats(id, Float:fGameTime)
+{
+	// Bail out if there no HUD stats should be shown
+	// for this player or end round stats not created.
+	if (!g_izStatsSwitch[id]) return
+	if (!g_sAwardAndScore[0]) return
 
-  // If round end timer is zero clear round end stats.
-  if ( g_fShowStatsTime == 0.0 ) {
-    set_hudtype_endround( 0.05 )
-    show_hudmessage( id, "" )
-    #if defined STATSX_DEBUG
-    log_amx( "Clear round end HUD stats for #%d", id )  
-    #endif
-  }
+	// If round end timer is zero clear round end stats.
+	if (g_fShowStatsTime == 0.0)
+	{
+		set_hudtype_endround(0.05)
+		show_hudmessage(id, "")
+#if defined STATSX_DEBUG
+		log_amx("Clear round end HUD stats for #%d", id)
+#endif
+	}
 
-  // Set HUD-duration to default or remaining time.
-  new Float:fDuration
-  if ( fGameTime == 0.0 )
-    fDuration = g_fHUDDuration
-  else {
-    fDuration = g_fShowStatsTime + g_fHUDDuration - fGameTime
-    if ( fDuration > g_fFreezeTime + g_fFreezeLimitTime )
-      fDuration = g_fFreezeTime + g_fFreezeLimitTime
-  }
-  // Show stats only if more time left than coded minimum.
-  if ( fDuration >= HUD_MIN_DURATION ) {
-    set_hudtype_endround( fDuration )
-    show_hudmessage( id, g_sAwardAndScore )
-    #if defined STATSX_DEBUG
-    log_amx( "Show %1.2fs round end HUD stats for #%d", fDuration, id )  
-    #endif
-  }
+	// Set HUD-duration to default or remaining time.
+	new Float:fDuration
+	
+	if (fGameTime == 0.0)
+		fDuration = g_fHUDDuration
+	else
+	{
+		fDuration = g_fShowStatsTime + g_fHUDDuration - fGameTime
+		
+		if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
+			fDuration = g_fFreezeTime + g_fFreezeLimitTime
+	}
+	
+	// Show stats only if more time left than coded minimum.
+	if (fDuration >= HUD_MIN_DURATION)
+	{
+		set_hudtype_endround(fDuration)
+		show_hudmessage(id, g_sAwardAndScore)
+#if defined STATSX_DEBUG
+		log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id)
+#endif
+	}
 }
 
-
 // Show round end stats.
-show_user_hudstats( id, Float:fGameTime ) {
-  
-  // Bail out if there no HUD stats should be shown
-  // for this player or user stats timer is zero.
-  if ( !g_izStatsSwitch[id] ) return
-  if ( g_fzShowUserStatsTime[id] == 0.0 ) return
+show_user_hudstats(id, Float:fGameTime)
+{
+	// Bail out if there no HUD stats should be shown
+	// for this player or user stats timer is zero.
+	if (!g_izStatsSwitch[id]) return
+	if (g_fzShowUserStatsTime[id] == 0.0) return
 
-  // Set HUD-duration to default or remaining time.
-  new Float:fDuration
-  if ( fGameTime == 0.0 )
-    fDuration = g_fHUDDuration
-  else {
-    fDuration = g_fzShowUserStatsTime[id] + g_fHUDDuration - fGameTime
-    if ( fDuration > g_fFreezeTime + g_fFreezeLimitTime )
-      fDuration = g_fFreezeTime + g_fFreezeLimitTime
-  }
-  // Show stats only if more time left than coded minimum.
-  if ( fDuration >= HUD_MIN_DURATION ) {
-    if ( ShowKiller ) {
-      new iKiller
-      iKiller = g_izKilled[id][KILLED_KILLER_ID]
-      get_kill_info( id, iKiller, g_sBuffer )
-      add_attacker_hits( id, iKiller, g_sBuffer )
-      set_hudtype_killer( fDuration )
-      show_hudmessage( id, g_sBuffer )
-      #if defined STATSX_DEBUG
-      log_amx( "Show %1.2fs %suser HUD k-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
-      #endif
-    }
-    if ( ShowVictims ) {
-      get_victims( id, g_sBuffer )
-      set_hudtype_victim( fDuration )
-      show_hudmessage( id, g_sBuffer )
-      #if defined STATSX_DEBUG
-      log_amx( "Show %1.2fs %suser HUD v-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
-      #endif
-    }
-    if ( ShowAttackers ) {
-      get_attackers( id, g_sBuffer )
-      set_hudtype_attacker( fDuration )
-      show_hudmessage( id, g_sBuffer )
-      #if defined STATSX_DEBUG
-      log_amx( "Show %1.2fs %suser HUD a-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
-      #endif
-    }
-  }
+	// Set HUD-duration to default or remaining time.
+	new Float:fDuration
+	
+	if (fGameTime == 0.0)
+		fDuration = g_fHUDDuration
+	else
+	{
+		fDuration = g_fzShowUserStatsTime[id] + g_fHUDDuration - fGameTime
+		
+		if (fDuration > g_fFreezeTime + g_fFreezeLimitTime)
+			fDuration = g_fFreezeTime + g_fFreezeLimitTime
+	}
+
+	// Show stats only if more time left than coded minimum.
+	if (fDuration >= HUD_MIN_DURATION)
+	{
+		if (ShowKiller)
+		{
+			new iKiller
+			
+			iKiller = g_izKilled[id][KILLED_KILLER_ID]
+			get_kill_info(id, iKiller, g_sBuffer)
+			add_attacker_hits(id, iKiller, g_sBuffer)
+			set_hudtype_killer(fDuration)
+			show_hudmessage(id, g_sBuffer)
+#if defined STATSX_DEBUG
+			log_amx("Show %1.2fs %suser HUD k-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
+#endif
+		}
+		
+		if (ShowVictims)
+		{
+			get_victims(id, g_sBuffer)
+			set_hudtype_victim(fDuration)
+			show_hudmessage(id, g_sBuffer)
+#if defined STATSX_DEBUG
+			log_amx("Show %1.2fs %suser HUD v-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
+#endif
+		}
+		
+		if (ShowAttackers)
+		{
+			get_attackers(id, g_sBuffer)
+			set_hudtype_attacker(fDuration)
+			show_hudmessage(id, g_sBuffer)
+#if defined STATSX_DEBUG
+			log_amx("Show %1.2fs %suser HUD a-stats for #%d", fDuration, g_sBuffer[0] ? "" : "no ", id)
+#endif
+		}
+	}
 }
 
-
 //------------------------------------------------------------
-//  Plugin commands
+// Plugin commands
 //------------------------------------------------------------
 
 // Set or get plugin config flags.
-public cmdPluginMode( id, level, cid ) {
-  if ( !cmd_access( id, level, cid, 1 ) ) 
-    return PLUGIN_HANDLED
-  if ( read_argc() > 1 )
-    read_argv( 1, g_sBuffer, MAX_BUFFER_LENGTH )
-  else
-    g_sBuffer[0] = 0
-  set_plugin_mode( id, g_sBuffer )
-  return PLUGIN_HANDLED
+public cmdPluginMode(id, level, cid)
+{
+	if (!cmd_access(id, level, cid, 1)) 
+		return PLUGIN_HANDLED
+	
+	if (read_argc() > 1)
+		read_argv(1, g_sBuffer, MAX_BUFFER_LENGTH)
+	else
+		g_sBuffer[0] = 0
+	
+	set_plugin_mode(id, g_sBuffer)
+	
+	return PLUGIN_HANDLED
 }
 
 // Display MOTD stats.
-public cmdStatsMe( id ) {
-  if ( !SayStatsMe ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  format_stats( id, g_sBuffer )
-  get_user_name( id, t_sName, MAX_NAME_LENGTH )
-  show_motd( id, g_sBuffer, t_sName )
-  return PLUGIN_CONTINUE
+public cmdStatsMe(id)
+{
+	if (!SayStatsMe)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+
+	format_stats(id, g_sBuffer)
+	get_user_name(id, t_sName, MAX_NAME_LENGTH)
+	show_motd(id, g_sBuffer, t_sName)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display MOTD rank.
-public cmdRankStats( id ) {
-  if ( !SayRankStats ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  format_rankstats( id, g_sBuffer )
-  get_user_name( id, t_sName, MAX_NAME_LENGTH )
-  show_motd( id, g_sBuffer, t_sName )
-  return PLUGIN_CONTINUE
+public cmdRankStats(id)
+{
+	if (!SayRankStats)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	format_rankstats(id, g_sBuffer)
+	get_user_name(id, t_sName, MAX_NAME_LENGTH)
+	show_motd(id, g_sBuffer, t_sName)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display MOTD top15 ranked.
-public cmdTop15( id ) {
-  if ( !SayTop15 ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  format_top15( g_sBuffer )
-  show_motd( id, g_sBuffer, "Top 15" )
-  return PLUGIN_CONTINUE
+public cmdTop15(id)
+{
+	if (!SayTop15)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	format_top15(g_sBuffer)
+	show_motd(id, g_sBuffer, "Top 15")
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display killer information.
-public cmdHp( id ) {
-  if ( !SayHP ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  new iKiller = g_izKilled[id][KILLED_KILLER_ID]
-  format_kill_ainfo( id, iKiller, g_sBuffer )
-  client_print( id, print_chat, "* %s", g_sBuffer )
-  return PLUGIN_CONTINUE
+public cmdHp(id)
+{
+	if (!SayHP)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	new iKiller = g_izKilled[id][KILLED_KILLER_ID]
+	
+	format_kill_ainfo(id, iKiller, g_sBuffer)
+	client_print(id, print_chat, "* %s", g_sBuffer)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display user stats.
-public cmdMe( id ) {
-  if ( !SayMe ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  format_kill_vinfo( id, 0, g_sBuffer )
-  client_print( id, print_chat, "* %s", g_sBuffer )
-  return PLUGIN_CONTINUE
+public cmdMe(id)
+{
+	if (!SayMe)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	format_kill_vinfo(id, 0, g_sBuffer)
+	client_print(id, print_chat, "* %s", g_sBuffer)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display user rank
-public cmdRank( id ) {
-  if ( !SayRank ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  new izStats[8], izBody[8]
-  new iRankPos, iRankMax
-  new Float:fEff, Float:fAcc
-  iRankPos = get_user_stats( id, izStats, izBody )
-  iRankMax = get_statsnum()
-  fEff = effec( izStats )
-  fAcc = accuracy( izStats )
-  client_print( id, print_chat,
-                "* %L", id, "YOUR_RANK_IS",
-                iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS],
-                fEff, fAcc )
-  return PLUGIN_CONTINUE
+public cmdRank(id)
+{
+	if (!SayRank)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+
+	new izStats[8], izBody[8]
+	new iRankPos, iRankMax
+	new Float:fEff, Float:fAcc
+	
+	iRankPos = get_user_stats(id, izStats, izBody)
+	iRankMax = get_statsnum()
+	
+	fEff = effec(izStats)
+	fAcc = accuracy(izStats)
+	
+	client_print(id, print_chat, "* %L", id, "YOUR_RANK_IS", iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS], fEff, fAcc)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Report user weapon status to team.
-public cmdReport( id ) { 
-  if ( !SayReport ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  new iWeapon, iClip, iAmmo, iHealth, iArmor
-  iWeapon = get_user_weapon( id, iClip, iAmmo ) 
-  xmod_get_wpnname( iWeapon, t_sWpn, MAX_WEAPON_LENGTH )
-  iHealth = get_user_health( id ) 
-  iArmor = get_user_armor( id )
-  new lWeapon[16]
-  format(lWeapon,15,"%L",id,"WEAPON")
-  strtolower(lWeapon)
-  if ( iClip >= 0 ) {
-    format( g_sBuffer, MAX_BUFFER_LENGTH,
-            "%s: %s, %L: %d/%d, %L: %d, %L: %d", 
-            lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo,
-            LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor ) 
-  }
-  else
-    format( g_sBuffer, MAX_BUFFER_LENGTH,
-            "%s: %s, %L: %d, %L: %d", 
-            lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor ) 
-  engclient_cmd( id, "say_team", g_sBuffer )
-  return PLUGIN_CONTINUE
+public cmdReport(id)
+{
+	if (!SayReport)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	new iWeapon, iClip, iAmmo, iHealth, iArmor
+	
+	iWeapon = get_user_weapon(id, iClip, iAmmo) 
+	xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
+	
+	iHealth = get_user_health(id) 
+	iArmor = get_user_armor(id)
+	
+	new lWeapon[16]
+	
+	format(lWeapon, 15, "%L", id, "WEAPON")
+	strtolower(lWeapon)
+	
+	if (iClip >= 0)
+	{
+		format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d/%d, %L: %d, %L: %d", lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor) 
+	}
+	else
+		format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d, %L: %d", lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor) 
+	
+	engclient_cmd(id, "say_team", g_sBuffer)
+	
+	return PLUGIN_CONTINUE
 } 
 
 // Display team map score
-public cmdScore( id ) {
-  if ( !SayScore ) {
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  client_print( id, print_chat, "%L: %s", id, "GAME_SCORE", g_sScore )
-  return PLUGIN_CONTINUE
+public cmdScore(id)
+{
+	if (!SayScore)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	client_print(id, print_chat, "%L: %s", id, "GAME_SCORE", g_sScore)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display time left on map
-public cmdTimeLeft( id ) {
-  if ( !SayMiscFunc )
-    return PLUGIN_CONTINUE
-  new iTimeLeft = get_timeleft()
-  if ( iTimeLeft )
-    client_print( 0, print_chat,
-                  "%L:  %02d:%02d", id, "TIME_REM", iTimeLeft / 60, iTimeLeft % 60 )
-  else
-    client_print( 0, print_chat, "* %L *", LANG_PLAYER, "NO_T_LIMIT" )
-  return PLUGIN_CONTINUE
+public cmdTimeLeft(id)
+{
+	if (!SayMiscFunc)
+		return PLUGIN_CONTINUE
+		
+	new iTimeLeft = get_timeleft()
+	
+	if (iTimeLeft)
+		client_print(0, print_chat, "%L:  %02d:%02d", id, "TIME_REM", iTimeLeft / 60, iTimeLeft % 60)
+	else
+		client_print(0, print_chat, "* %L *", LANG_PLAYER, "NO_T_LIMIT")
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display the time.
-public cmdTheTime( id ) {
-  if ( !SayMiscFunc )
-    return PLUGIN_CONTINUE
-  get_time( "%H:%M:%S", g_sBuffer, MAX_BUFFER_LENGTH )
-  client_print( 0, print_chat, "%L:  %s", LANG_PLAYER, "THE_TIME", g_sBuffer )
-  return PLUGIN_CONTINUE
+public cmdTheTime(id)
+{
+	if (!SayMiscFunc)
+		return PLUGIN_CONTINUE
+
+	get_time("%H:%M:%S", g_sBuffer, MAX_BUFFER_LENGTH)
+	client_print(0, print_chat, "%L:  %s", LANG_PLAYER, "THE_TIME", g_sBuffer)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display current map name.
-public cmdCurrentMap( id ) {
-  if ( !SayMiscFunc )
-    return PLUGIN_CONTINUE
-  get_mapname( g_sBuffer, MAX_BUFFER_LENGTH )
-  client_print( 0, print_chat, "%L:  %s", LANG_PLAYER, "PLAYED_MAP", g_sBuffer )
-  return PLUGIN_CONTINUE
+public cmdCurrentMap(id)
+{
+	if (!SayMiscFunc)
+		return PLUGIN_CONTINUE
+
+	get_mapname(g_sBuffer, MAX_BUFFER_LENGTH)
+	client_print(0, print_chat, "%L:  %s", LANG_PLAYER, "PLAYED_MAP", g_sBuffer)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Display friendly fire status.
-public cmdFf( id ) {
-  if ( !SayMiscFunc )
-    return PLUGIN_CONTINUE
-  client_print( 0, print_chat, "%L:  %L", LANG_PLAYER, "FRIEND_FIRE",
-                LANG_PLAYER, get_cvar_num( "mp_friendlyfire" ) ? "ON" : "OFF" )
-  return PLUGIN_CONTINUE
+public cmdFf(id)
+{
+	if (!SayMiscFunc)
+		return PLUGIN_CONTINUE
+	
+	client_print(0, print_chat, "%L:  %L", LANG_PLAYER, "FRIEND_FIRE", LANG_PLAYER, get_cvar_num("mp_friendlyfire") ? "ON" : "OFF")
+	
+	return PLUGIN_CONTINUE
 }
 
 // Client switch to enable or disable stats announcements.
-public cmdSwitch( id ) {
-  g_izStatsSwitch[id] = ( g_izStatsSwitch[id] ) ? 0 : -1 
-  num_to_str( g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH )
-  client_cmd( id, "setinfo _amxstatsx %s", t_sText )
-  new lEnDis[32]
-  format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
-  client_print( id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
-  return PLUGIN_CONTINUE
+public cmdSwitch(id)
+{
+	g_izStatsSwitch[id] = (g_izStatsSwitch[id]) ? 0 : -1 
+	num_to_str(g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH)
+	client_cmd(id, "setinfo _amxstatsx %s", t_sText)
+	
+	new lEnDis[32]
+	
+	format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
+	client_print(id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
+	
+	return PLUGIN_CONTINUE
 }
 
 // Player stats menu.
-public cmdStats( id ) {
-  if ( !SayStatsAll ){
-    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
-    return PLUGIN_HANDLED
-  }
-  showStatsMenu( id, g_izUserMenuPosition[id]=0 )
-  return PLUGIN_CONTINUE
+public cmdStats(id)
+{
+	if (!SayStatsAll)
+	{
+		client_print(id, print_chat, "%L", id, "DISABLED_MSG")
+		return PLUGIN_HANDLED
+	}
+	
+	showStatsMenu(id, g_izUserMenuPosition[id] = 0)
+	
+	return PLUGIN_CONTINUE
 }
 
-
 //--------------------------------
-//  Menu
+// Menu
 //--------------------------------
 
-public actionStatsMenu( id, key ) {
-  switch( key ) {
-    // Key '1' to '7', execute action on this option
-    case 0..6: {
-      new iOption, iIndex
-      iOption = ( g_izUserMenuPosition[id] * PPL_MENU_OPTIONS ) + key
-      if ( iOption >= 0 && iOption < 32 ) {
-        iIndex = g_izUserMenuPlayers[id][iOption]
-        if ( is_user_connected( iIndex ) ){
-          switch( g_izUserMenuAction[id] ) {
-            case 0:  format_stats( iIndex, g_sBuffer )
-            case 1:  format_rankstats( iIndex, g_sBuffer, id )
-            default: g_sBuffer[0] = 0
-          }
-          if ( g_sBuffer[0] ) {
-            get_user_name( iIndex, t_sName, MAX_NAME_LENGTH )
-            show_motd( id, g_sBuffer, t_sName )
-          }
-        }
-      }
-      showStatsMenu( id, g_izUserMenuPosition[id] )
-    }
-    // Key '8', change action
-    case 7: {
-      g_izUserMenuAction[id]++
-      if ( g_izUserMenuAction[id] >= MAX_PPL_MENU_ACTIONS )
-        g_izUserMenuAction[id] = 0
-      showStatsMenu( id, g_izUserMenuPosition[id] )
-    }
-    // Key '9', select next page of options
-    case 8:
-      showStatsMenu( id, ++g_izUserMenuPosition[id] )
-    // Key '10', cancel or go back to previous menu
-    case 9: {
-      if ( g_izUserMenuPosition[id] > 0 )
-        showStatsMenu( id, --g_izUserMenuPosition[id] )
-    }
-  }
-  return PLUGIN_HANDLED
+public actionStatsMenu(id, key)
+{
+	switch (key)
+	{
+		// Key '1' to '7', execute action on this option
+		case 0..6:
+		{
+			new iOption, iIndex
+			iOption = (g_izUserMenuPosition[id] * PPL_MENU_OPTIONS) + key
+			
+			if (iOption >= 0 && iOption < 32)
+			{
+				iIndex = g_izUserMenuPlayers[id][iOption]
+			
+				if (is_user_connected(iIndex))
+				{
+					switch (g_izUserMenuAction[id])
+					{
+						case 0: format_stats(iIndex, g_sBuffer)
+						case 1: format_rankstats(iIndex, g_sBuffer, id)
+						default: g_sBuffer[0] = 0
+					}
+					
+					if (g_sBuffer[0])
+					{
+						get_user_name(iIndex, t_sName, MAX_NAME_LENGTH)
+						show_motd(id, g_sBuffer, t_sName)
+					}
+				}
+			}
+			
+			showStatsMenu(id, g_izUserMenuPosition[id])
+		}
+		// Key '8', change action
+		case 7:
+		{
+			g_izUserMenuAction[id]++
+			
+			if (g_izUserMenuAction[id] >= MAX_PPL_MENU_ACTIONS)
+				g_izUserMenuAction[id] = 0
+			
+			showStatsMenu(id, g_izUserMenuPosition[id])
+		}
+		// Key '9', select next page of options
+		case 8: showStatsMenu(id, ++g_izUserMenuPosition[id])
+		// Key '10', cancel or go back to previous menu
+		case 9:
+		{
+			if (g_izUserMenuPosition[id] > 0)
+				showStatsMenu(id, --g_izUserMenuPosition[id])
+		}
+	}
+	
+	return PLUGIN_HANDLED
 }
 
-new g_izUserMenuActionText[MAX_PPL_MENU_ACTIONS][]  = { "Show stats", "Show rank stats" }
+new g_izUserMenuActionText[MAX_PPL_MENU_ACTIONS][] = {"Show stats", "Show rank stats"}
 
-showStatsMenu( id, iMenuPos ) {
-  new iLen, iKeyMask, iPlayers
-  new iUserIndex, iMenuPosMax, iMenuOption, iMenuOptionMax
-  get_players( g_izUserMenuPlayers[id], iPlayers )
-  iMenuPosMax = (( iPlayers - 1 ) / PPL_MENU_OPTIONS ) + 1
-  // If menu pos does not excist use last menu (if players has left)
-  if ( iMenuPos >= iMenuPosMax )
-    iMenuPos = iMenuPosMax - 1
-  iUserIndex = iMenuPos * PPL_MENU_OPTIONS
-  iLen = format( g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n",
-                 id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax )
-  iMenuOptionMax = iPlayers - iUserIndex
-  if ( iMenuOptionMax > PPL_MENU_OPTIONS ) 
-    iMenuOptionMax = PPL_MENU_OPTIONS
-  for ( iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++ ) {
-    get_user_name( g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH )
-    iKeyMask |= (1< iUserIndex ) {
-    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE" )
-    iKeyMask |= MENU_KEY_9
-  }
-  if ( iMenuPos > 0 )
-    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK" )
-  else
-    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT" )
-  show_menu( id, iKeyMask, g_sBuffer, -1, "Server Stats" )
-  return PLUGIN_HANDLED
+showStatsMenu(id, iMenuPos)
+{
+	new iLen, iKeyMask, iPlayers
+	new iUserIndex, iMenuPosMax, iMenuOption, iMenuOptionMax
+	
+	get_players(g_izUserMenuPlayers[id], iPlayers)
+	iMenuPosMax = ((iPlayers - 1) / PPL_MENU_OPTIONS) + 1
+	
+	// If menu pos does not excist use last menu (if players has left)
+	if (iMenuPos >= iMenuPosMax)
+		iMenuPos = iMenuPosMax - 1
+
+	iUserIndex = iMenuPos * PPL_MENU_OPTIONS
+	iLen = format(g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax)
+	iMenuOptionMax = iPlayers - iUserIndex
+	
+	if (iMenuOptionMax > PPL_MENU_OPTIONS) 
+		iMenuOptionMax = PPL_MENU_OPTIONS
+	
+	for (iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++)
+	{
+		get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH)
+		iKeyMask |= (1< iUserIndex)
+	{
+		iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE")
+		iKeyMask |= MENU_KEY_9
+	}
+	
+	if (iMenuPos > 0)
+		iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK")
+	else
+		iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT")
+	
+	show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats")
+	
+	return PLUGIN_HANDLED
 }
 
-
 //------------------------------------------------------------
-//  Plugin events
+// Plugin events
 //------------------------------------------------------------
 
 // Reset game stats on game start and restart.
-public eventStartGame() {
-  read_data( 2, t_sText, MAX_TEXT_LENGTH )
-  if ( t_sText[6] == 'w' ) {
-    read_data( 3, t_sText, MAX_TEXT_LENGTH )
-    g_fStartGame = get_gametime() + float( str_to_num( t_sText ) )
-  }
-  else
-    g_fStartGame = get_gametime()
-  return PLUGIN_CONTINUE
+public eventStartGame()
+{
+	read_data(2, t_sText, MAX_TEXT_LENGTH)
+	
+	if (t_sText[6] == 'w')
+	{
+		read_data(3, t_sText, MAX_TEXT_LENGTH)
+		g_fStartGame = get_gametime() + float(str_to_num(t_sText))
+	}
+	else
+		g_fStartGame = get_gametime()
+	
+	return PLUGIN_CONTINUE
 }
 
 // Round start
-public eventStartRound() {
-  new iTeam, id, i
-  new iRoundTime
+public eventStartRound()
+{
+	new iTeam, id, i
+	new iRoundTime
 
-  iRoundTime = read_data( 1 )
-  if ( iRoundTime >= get_cvar_float("mp_roundtime") * 60 ) {
-    #if defined STATSX_DEBUG
-    log_amx( "Reset round stats" )  
-    #endif
+	iRoundTime = read_data(1)
+	
+	if (iRoundTime >= get_cvar_float("mp_roundtime") * 60)
+	{
+#if defined STATSX_DEBUG
+		log_amx("Reset round stats")
+#endif
+		
+		// Reset game stats on game start and restart.
+		if (g_fStartGame > 0.0 && g_fStartGame <= get_gametime())
+		{
+#if defined STATSX_DEBUG
+			log_amx("Reset game stats")
+#endif
+			g_fStartGame = 0.0
 
-    // Reset game stats on game start and restart.
-    if ( g_fStartGame > 0.0 && g_fStartGame <= get_gametime() ) {
-      #if defined STATSX_DEBUG
-      log_amx( "Reset game stats" )  
-      #endif
+			// Clear team and game stats.
+			for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
+			{
+				g_izTeamEventScore[iTeam] = 0
+				
+				for (i = 0; i < 8; i++)
+					g_izTeamGameStats[iTeam][i] = 0
+			}
 
-      g_fStartGame = 0.0
+			// Clear game stats, incl '0' that is sum of all users.
+			for (id = 0; id < MAX_PLAYERS; id++)
+			{
+				for (i = 0; i < 8; i++)
+					g_izUserGameStats[id][i] = 0
+			}
+		}
 
-      // Clear team and game stats.
-      for ( iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) {
-        g_izTeamEventScore[iTeam] = 0
-        for ( i = 0; i < 8; i++ )
-          g_izTeamGameStats[iTeam][i] = 0
-      }
+		// Update team score with "TeamScore" event values and
+		// clear team round stats.
+		for (iTeam = 0; iTeam < MAX_TEAMS; iTeam++)
+		{
+			g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
+			
+			for (i = 0; i < 8; i++)
+				g_izTeamRndStats[iTeam][i] = 0
+		}
 
-      // Clear game stats, incl '0' that is sum of all users.
-      for ( id = 0; id < MAX_PLAYERS; id++ ) {
-        for ( i = 0; i < 8; i++ )
-          g_izUserGameStats[id][i] = 0
-      }
-    }
+		// Clear user round stats, incl '0' that is sum of all users.
+		for (id = 0; id < MAX_PLAYERS; id++)
+		{
+			g_izUserRndName[id][0] = 0
+			
+			for (i = 0; i < 8; i++)
+				g_izUserRndStats[id][i] = 0
+			
+			g_fzShowUserStatsTime[id] = 0.0
+		}
 
-    // Update team score with "TeamScore" event values and
-    // clear team round stats.
-    for ( iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) {
-      g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
-      for ( i = 0; i < 8; i++ )
-        g_izTeamRndStats[iTeam][i] = 0
-    }
+		// Allow end round stats and reset end round triggered indicator.
+		g_iRoundEndTriggered = 0
+		g_iRoundEndProcessed = 0
+		g_fShowStatsTime = 0.0
 
-    // Clear user round stats, incl '0' that is sum of all users.
-    for ( id = 0; id < MAX_PLAYERS; id++ ) {
-      g_izUserRndName[id][0] = 0
-      for ( i = 0; i < 8; i++ )
-        g_izUserRndStats[id][i] = 0
-      g_fzShowUserStatsTime[id] = 0.0
-    }
-    
-    // Allow end round stats and reset end round triggered indicator.
-    g_iRoundEndTriggered = 0
-    g_iRoundEndProcessed = 0
-    g_fShowStatsTime = 0.0
+		// Update local configuration vars with value in cvars.
+		get_config_cvars()
+	}
 
-    // Update local configuration vars with value in cvars.
-    get_config_cvars()
-  }
-
-  return PLUGIN_CONTINUE
+	return PLUGIN_CONTINUE
 }
 
 // Reset killer info on round restart.
-public eventResetHud( id ) {
-  new args[1]
-  args[0] = id
-  if ( g_iPluginMode & MODE_HUD_DELAY )
-    set_task( 0.01, "delay_resethud", 200 + id, args, 1 )
-  else
-    delay_resethud( args )
-  return PLUGIN_CONTINUE
+public eventResetHud(id)
+{
+	new args[1]
+	args[0] = id
+	
+	if (g_iPluginMode & MODE_HUD_DELAY)
+		set_task(0.01, "delay_resethud", 200 + id, args, 1)
+	else
+		delay_resethud(args)
+	
+	return PLUGIN_CONTINUE
 }
 
-public delay_resethud( args[] ) {
-  new id = args[0]
-  new Float:fGameTime
-  
-  // Show user and score round stats after HUD-reset
-  #if defined STATSX_DEBUG
-  log_amx( "Reset HUD for #%d", id )
-  #endif
-  fGameTime = get_gametime()
-  show_user_hudstats( id, fGameTime )
-  show_roundend_hudstats( id, fGameTime )
-  
-  // Reset round stats
-  g_izKilled[id][KILLED_KILLER_ID] = 0
-  g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
-  g_izShowStatsFlags[id] = -1  // Initialize flags
-  g_fzShowUserStatsTime[id] = 0.0
-  g_izUserAttackerDistance[id] = 0
-  for ( new i = 0; i < MAX_PLAYERS; i++ )
-    g_izUserVictimDistance[id][i] = 0
-  return PLUGIN_CONTINUE
+public delay_resethud(args[])
+{
+	new id = args[0]
+	new Float:fGameTime
+
+	// Show user and score round stats after HUD-reset
+#if defined STATSX_DEBUG
+	log_amx("Reset HUD for #%d", id)
+#endif
+	fGameTime = get_gametime()
+	show_user_hudstats(id, fGameTime)
+	show_roundend_hudstats(id, fGameTime)
+
+	// Reset round stats
+	g_izKilled[id][KILLED_KILLER_ID] = 0
+	g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
+	g_izShowStatsFlags[id] = -1		// Initialize flags
+	g_fzShowUserStatsTime[id] = 0.0
+	g_izUserAttackerDistance[id] = 0
+	
+	for (new i = 0; i < MAX_PLAYERS; i++)
+		g_izUserVictimDistance[id][i] = 0
+	
+	return PLUGIN_CONTINUE
 }
 
 // Save killer info on death.
-public client_death(killer,victim,wpnindex,hitplace,TK) {
+public client_death(killer, victim, wpnindex, hitplace, TK)
+{
+	// Bail out if no killer.
+	if (!killer)
+		return PLUGIN_CONTINUE
 
-  // Bail out if no killer.
-  if ( !killer ) return PLUGIN_CONTINUE
+	if (killer != victim)
+	{
+		new iaVOrigin[3], iaKOrigin[3]
+		new iDistance
+		
+		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
 
-  if ( killer != victim ) {
-    new iaVOrigin[3], iaKOrigin[3]
-    new iDistance
-    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[victim] = iDistance
-    g_izUserVictimDistance[killer][victim] = iDistance
-  }
-  g_izKilled[victim][KILLED_TEAM] = get_user_team( victim )
-  g_izKilled[victim][KILLED_KILLER_STATSFIX] = 1
+		iDistance = get_distance(iaVOrigin, iaKOrigin)
+		g_izUserAttackerDistance[victim] = iDistance
+		g_izUserVictimDistance[killer][victim] = iDistance
+	}
+	
+	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( victim )
+	// Display kill stats for the player if round
+	// end stats was not processed.
+	if (!g_iRoundEndProcessed)
+		kill_stats(victim)
 
-  return PLUGIN_CONTINUE
+	return PLUGIN_CONTINUE
 }
 
 // Display hudmessage stats on death.
 // This will also update all round and game stats.
 // Must be called at least once per round.
-kill_stats( id ) {
+kill_stats(id)
+{
+	// Bail out if user stats timer is non-zero, 
+	// ie function already called.
+	if (g_fzShowUserStatsTime[id] > 0.0)
+		return
 
-  // Bail out if user stats timer is non-zero, 
-  // ie function already called.
-  if ( g_fzShowUserStatsTime[id] > 0.0 ) return
+	// Flag kill stats displayed for this player.
+	g_fzShowUserStatsTime[id] = get_gametime()
 
-  // Flag kill stats displayed for this player.
-  g_fzShowUserStatsTime[id] = get_gametime()
+	// Add user death stats to user round stats
+	new izStats[8], izBody[8]
+	new iTeam, i
+	new iKiller
 
-  // Add user death stats to user round stats
-  new izStats[8], izBody[8]
-  new iTeam, i
-  new iKiller
+	iKiller = g_izKilled[id][KILLED_KILLER_ID]
 
-  iKiller = g_izKilled[id][KILLED_KILLER_ID]
+	// Get user's team (if dead use the saved team)
+	if (iKiller)
+		iTeam = g_izKilled[id][KILLED_TEAM] - 1
+	else
+		iTeam = get_user_team(id) - 1
 
-  // Get user's team (if dead use the saved team)
-  if ( iKiller )
-    iTeam = g_izKilled[id][KILLED_TEAM] - 1
-  else
-    iTeam = get_user_team( id ) - 1
-  
-  get_user_name( id, g_izUserRndName[id], MAX_NAME_LENGTH )
+	get_user_name(id, g_izUserRndName[id], MAX_NAME_LENGTH)
 
-  if ( get_user_rstats( id, izStats, izBody ) ) {
+	if (get_user_rstats(id, izStats, izBody))
+	{
+		// Update user's team round stats
+		if (iTeam >= 0 && iTeam < MAX_TEAMS)
+		{
+			for (i = 0; i < 8; i++)
+			{
+				g_izTeamRndStats[iTeam][i] += izStats[i]
+				g_izTeamGameStats[iTeam][i] += izStats[i]
+				g_izUserRndStats[0][i] += izStats[i]
+				g_izUserGameStats[0][i] += izStats[i]
+			}
+		}
 
-    // Update user's team round stats
-    if ( iTeam >= 0 && iTeam < MAX_TEAMS ) {
-      for ( i = 0; i < 8; i++ ) {
-        g_izTeamRndStats[iTeam][i]  += izStats[i]
-        g_izTeamGameStats[iTeam][i] += izStats[i]
-        g_izUserRndStats[0][i]      += izStats[i]
-        g_izUserGameStats[0][i]     += izStats[i]
-      }
-    }
+		// Update user's round stats
+		if (g_izUserUserID[id] == get_user_userid(id))
+		{
+			for (i = 0; i < 8; i++)
+			{
+				g_izUserRndStats[id][i] += izStats[i]
+				g_izUserGameStats[id][i] += izStats[i]
+			}
+		} else {
+			g_izUserUserID[id] = get_user_userid(id)
+			
+			for (i = 0; i < 8; i++)
+			{
+				g_izUserRndStats[id][i] = izStats[i]
+				g_izUserGameStats[id][i] = izStats[i]
+			}
+		}
 
-    // Update user's round stats
-    if ( g_izUserUserID[id] == get_user_userid( id ) ) {
-      for ( i = 0; i < 8; i++ ) {
-        g_izUserRndStats[id][i]  += izStats[i]
-        g_izUserGameStats[id][i] += izStats[i]
-      }
-    }
-    else {
-      g_izUserUserID[id] = get_user_userid( id )
-      for ( i = 0; i < 8; i++ ) {
-        g_izUserRndStats[id][i]  = izStats[i]
-        g_izUserGameStats[id][i] = izStats[i]
-      }
-    }
+	}	// endif (get_user_rstats())
 
-  }  // endif( get_user_rstats() )
-  
-  // Report stats in the chat section, if player is killed.
-  if ( KillerChat && iKiller && iKiller != id ) {
-    if ( format_kill_ainfo( id, iKiller, g_sBuffer ) ) {
-      client_print( id, print_chat, "* %s", g_sBuffer )
-      format_kill_vinfo( id, iKiller, g_sBuffer )
-    }
-    client_print( id, print_chat, "* %s", g_sBuffer )
-  }
-  
-  // Display player stats info.
-  #if defined STATSX_DEBUG
-  log_amx( "Kill stats for #%d", id )
-  #endif
-  show_user_hudstats( id,  0.0 )
+	// Report stats in the chat section, if player is killed.
+	if (KillerChat && iKiller && iKiller != id)
+	{
+		if (format_kill_ainfo(id, iKiller, g_sBuffer))
+		{
+			client_print(id, print_chat, "* %s", g_sBuffer)
+			format_kill_vinfo(id, iKiller, g_sBuffer)
+		}
+		
+		client_print(id, print_chat, "* %s", g_sBuffer)
+	}
+
+	// Display player stats info.
+#if defined STATSX_DEBUG
+	log_amx("Kill stats for #%d", id)
+#endif
+	show_user_hudstats(id, 0.0)
 }
 
-public eventEndRound() {
+public eventEndRound()
+{
+	// Update local configuration vars with value in cvars.
+	get_config_cvars()
 
-  // Update local configuration vars with value in cvars.
-  get_config_cvars()
+	// If first end round event in the round, calculate team score.
+	if (!g_iRoundEndTriggered)
+	{
+		read_data(2, t_sText, MAX_TEXT_LENGTH)
+		
+		if (t_sText[7] == 't')			// Terrorist wins
+			g_izTeamScore[0]++
+		else if (t_sText[7] == 'c')		// CT wins
+			g_izTeamScore[1]++
+	}
 
-  // If first end round event in the round, calculate team score.
-  if ( !g_iRoundEndTriggered ) {
-    read_data( 2, t_sText, MAX_TEXT_LENGTH )
-    if ( t_sText[7] == 't' )  // Terrorist wins
-      g_izTeamScore[0]++
-    else if ( t_sText[7] == 'c' )  // CT wins
-      g_izTeamScore[1]++
-  }
-  
-  set_task(0.3,"ERTask",997)
-  return PLUGIN_CONTINUE
+	set_task(0.3, "ERTask", 997)
+	
+	return PLUGIN_CONTINUE
 }
 
-public ERTask(){
-  // Flag round end triggered.
-  g_iRoundEndTriggered = 1
+public ERTask()
+{
+	// Flag round end triggered.
+	g_iRoundEndTriggered = 1
 
-  // Display round end stats to all players.
-  endround_stats()
+	// Display round end stats to all players.
+	endround_stats()
 }
 
-endround_stats() {
+endround_stats()
+{
+	// Bail out if end round stats has already been processed
+	// or round end not triggered.
+	if (g_iRoundEndProcessed || !g_iRoundEndTriggered)
+		return
 
-  // Bail out if end round stats has already been processed
-  // or round end not triggered.
-  if ( g_iRoundEndProcessed || !g_iRoundEndTriggered ) return
-  
-  new iaPlayers[32], iPlayer, iPlayers, id
+	new iaPlayers[32], iPlayer, iPlayers, id
 
-  get_players( iaPlayers, iPlayers )
+	get_players(iaPlayers, iPlayers)
 
-  // Display attacker & victim list for all living players.
-  // This will also update all round and game stats for all players
-  // not killed.
-  #if defined STATSX_DEBUG
-  log_amx( "End round stats" )
-  #endif
-  for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
-    id = iaPlayers[iPlayer]
-    if ( g_fzShowUserStatsTime[id] == 0.0 )
-      kill_stats( id )
-  }
-  
-  g_sAwardAndScore[0] = 0
+	// Display attacker & victim list for all living players.
+	// This will also update all round and game stats for all players
+	// not killed.
+#if defined STATSX_DEBUG
+	log_amx("End round stats")
+#endif
+	
+	for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
+	{
+		id = iaPlayers[iPlayer]
+		
+		if (g_fzShowUserStatsTime[id] == 0.0)
+			kill_stats(id)
+	}
 
-  // Create round awards.
-  if ( ShowMostDisruptive )
-    add_most_disruptive( g_sAwardAndScore )
-  if ( ShowBestScore )
-    add_best_score( g_sAwardAndScore )
+	g_sAwardAndScore[0] = 0
 
-  // Create round score. 
-  // Compensate HUD message if awards are disabled.
-  if ( ShowTeamScore || ShowTotalStats ) {
-    if ( ShowMostDisruptive && ShowBestScore )
-      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n" )
-    else if ( ShowMostDisruptive || ShowBestScore )
-      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n" )
-    else
-      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n" )
-    if ( ShowTeamScore )
-      add_team_score( g_sAwardAndScore )
-    if ( ShowTotalStats )
-      add_total_stats( g_sAwardAndScore )
-  }
+	// Create round awards.
+	if (ShowMostDisruptive)
+		add_most_disruptive(g_sAwardAndScore)
+	if (ShowBestScore)
+		add_best_score(g_sAwardAndScore)
 
-  save_team_chatscore()
-  
-  // Get and save round end stats time.
-  g_fShowStatsTime = get_gametime()
+	// Create round score. 
+	// Compensate HUD message if awards are disabled.
+	if (ShowTeamScore || ShowTotalStats)
+	{
+		if (ShowMostDisruptive && ShowBestScore)
+			add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n")
+		else if (ShowMostDisruptive || ShowBestScore)
+			add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n")
+		else
+			add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n")
 
-  // Display round end stats to all players.
-  for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
-    id = iaPlayers[iPlayer]
-    show_roundend_hudstats( id, 0.0 )
-  }
+		if (ShowTeamScore)
+			add_team_score(g_sAwardAndScore)
+		
+		if (ShowTotalStats)
+			add_total_stats(g_sAwardAndScore)
+	}
 
-  // Flag round end processed.
-  g_iRoundEndProcessed = 1
+	save_team_chatscore()
+
+	// Get and save round end stats time.
+	g_fShowStatsTime = get_gametime()
+
+	// Display round end stats to all players.
+	for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
+	{
+		id = iaPlayers[iPlayer]
+		show_roundend_hudstats(id, 0.0)
+	}
+
+	// Flag round end processed.
+	g_iRoundEndProcessed = 1
 }
 
-public eventTeamScore() {
-  new sTeamID[1+1], iTeamScore
-  read_data( 1, sTeamID, 1 )
-  iTeamScore = read_data(2)
-  g_izTeamEventScore[ (sTeamID[0]=='C') ? 1 : 0 ] = iTeamScore
-  return PLUGIN_CONTINUE
+public eventTeamScore()
+{
+	new sTeamID[1 + 1], iTeamScore
+	read_data(1, sTeamID, 1)
+	iTeamScore = read_data(2)
+	g_izTeamEventScore[(sTeamID[0] == 'C') ? 1 : 0] = iTeamScore
+	
+	return PLUGIN_CONTINUE
 }
 
-public eventIntermission() {
-  if ( EndPlayer || EndTop15 )
-    set_task( 1.0, "end_game_stats", 900 )
+public eventIntermission()
+{
+	if (EndPlayer || EndTop15)
+		set_task(1.0, "end_game_stats", 900)
 }
 
-public end_game_stats() {
-  new iaPlayers[32], iPlayer, iPlayers, id
+public end_game_stats()
+{
+	new iaPlayers[32], iPlayer, iPlayers, id
 
-  if ( EndPlayer ) {
-    get_players( iaPlayers, iPlayers )
-    for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
-      id = iaPlayers[iPlayer]
-      if ( !g_izStatsSwitch[id] ) continue  // Do not show any stats
-      cmdStatsMe( iaPlayers[iPlayer] )
-    }
-  }  
-  else if ( EndTop15 ) {
-    get_players( iaPlayers, iPlayers )
-    format_top15( g_sBuffer )
-    for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
-      id = iaPlayers[iPlayer]
-      if ( !g_izStatsSwitch[id] ) continue  // Do not show any stats
-      show_motd( iaPlayers[iPlayer], g_sBuffer, "Top 15" )
-    }
-  }
-  return PLUGIN_CONTINUE
+	if (EndPlayer)
+	{
+		get_players(iaPlayers, iPlayers)
+		
+		for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
+		{
+			id = iaPlayers[iPlayer]
+			
+			if (!g_izStatsSwitch[id])
+				continue	// Do not show any stats
+			
+			cmdStatsMe(iaPlayers[iPlayer])
+		}
+	}
+	else if (EndTop15)
+	{
+		get_players(iaPlayers, iPlayers)
+		format_top15(g_sBuffer)
+		
+		for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
+		{
+			id = iaPlayers[iPlayer]
+			
+			if (!g_izStatsSwitch[id])
+				continue	// Do not show any stats
+			
+			show_motd(iaPlayers[iPlayer], g_sBuffer, "Top 15")
+		}
+	}
+	
+	return PLUGIN_CONTINUE
 }
 
-public eventSpecMode( id ) { 
-  new sData[12]
-  read_data( 2, sData, 11 )
-  g_izSpecMode[id] = ( sData[10] == '2' )
-  return PLUGIN_CONTINUE
+public eventSpecMode(id)
+{
+	new sData[12]
+	read_data(2, sData, 11)
+	g_izSpecMode[id] = (sData[10] == '2')
+	
+	return PLUGIN_CONTINUE
 } 
 
-public eventShowRank( id ) {
-  if ( SpecRankInfo && g_izSpecMode[id] ) {
-    new iPlayer = read_data(2)
-    if ( is_user_connected( iPlayer ) ) {
-      new izStats[8], izBody[8]
-      new iRankPos, iRankMax
-      get_user_name( iPlayer, t_sName, MAX_NAME_LENGTH )
-      iRankPos = get_user_stats( iPlayer, izStats, izBody )
-      iRankMax = get_statsnum()
-      set_hudtype_specmode()
-      show_hudmessage( id, "%L", id, "X_RANK_IS", t_sName, iRankPos, iRankMax )
-    }
-  }
-  return PLUGIN_CONTINUE
+public eventShowRank(id)
+{
+	if (SpecRankInfo && g_izSpecMode[id])
+	{
+		new iPlayer = read_data(2)
+		
+		if (is_user_connected(iPlayer))
+		{
+			new izStats[8], izBody[8]
+			new iRankPos, iRankMax
+			
+			get_user_name(iPlayer, t_sName, MAX_NAME_LENGTH)
+			
+			iRankPos = get_user_stats(iPlayer, izStats, izBody)
+			iRankMax = get_statsnum()
+			
+			set_hudtype_specmode()
+			show_hudmessage(id, "%L", id, "X_RANK_IS", t_sName, iRankPos, iRankMax)
+		}
+	}
+	
+	return PLUGIN_CONTINUE
 }
 
-public client_connect( id ) {
-  if ( ShowStats ) {
-    get_user_info( id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH )
-    g_izStatsSwitch[id] = ( t_sText[0] ) ? str_to_num( t_sText ) : -1
-  }
-  else
-    g_izStatsSwitch[id] = 0
+public client_connect(id)
+{
+	if (ShowStats)
+	{
+		get_user_info(id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH)
+		g_izStatsSwitch[id] = (t_sText[0]) ? str_to_num(t_sText) : -1
+	}
+	else
+		g_izStatsSwitch[id] = 0
 
-  g_izKilled[id][KILLED_KILLER_ID] = 0
-  g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
-  g_izShowStatsFlags[id] = 0  // Clear all flags
-  g_fzShowUserStatsTime[id] = 0.0
+	g_izKilled[id][KILLED_KILLER_ID] = 0
+	g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
+	g_izShowStatsFlags[id] = 0		// Clear all flags
+	g_fzShowUserStatsTime[id] = 0.0
 
-  return PLUGIN_CONTINUE
+	return PLUGIN_CONTINUE
 }