From fec17e2bf5c4ea6d07a6cb9dc9474277b12a7635 Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 20:33:07 +0600 Subject: [PATCH 1/9] Update statsx.sma Fix MAX_PLAYERS -> MaxClients --- plugins/cstrike/statsx.sma | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index a2961c55..22ac7c1f 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -513,7 +513,7 @@ add_most_disruptive(id, sBuffer[MAX_BUFFER_LENGTH + 1]) iMaxHeadShots = 0 // Find player. - for (iPlayer = 1; iPlayer < MAX_PLAYERS; iPlayer++) + for (iPlayer = 1; iPlayer < MaxClients; iPlayer++) { if (g_izUserRndStats[iPlayer][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[iPlayer][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots)) { @@ -549,7 +549,7 @@ add_best_score(id, sBuffer[MAX_BUFFER_LENGTH + 1]) iMaxHeadShots = 0 // Find player - for (iPlayer = 1; iPlayer < MAX_PLAYERS; iPlayer++) + for (iPlayer = 1; iPlayer < MaxClients; iPlayer++) { if (g_izUserRndStats[iPlayer][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[iPlayer][STATS_KILLS] > iMaxKills || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots)) { @@ -1330,7 +1330,7 @@ public eventStartRound() } // Clear game stats, incl '0' that is sum of all users. - for (id = 0; id < MAX_PLAYERS; id++) + for (id = 0; id < MaxClients; id++) { for (i = 0; i < 8; i++) g_izUserGameStats[id][i] = 0 @@ -1348,7 +1348,7 @@ public eventStartRound() } // Clear user round stats, incl '0' that is sum of all users. - for (id = 0; id < MAX_PLAYERS; id++) + for (id = 0; id < MaxClients; id++) { g_izUserRndName[id][0] = 0 @@ -1412,7 +1412,7 @@ public delay_spawn(args[]) g_fzShowUserStatsTime[id] = 0.0 g_izUserAttackerDistance[id] = 0 - for (new i = 0; i < MAX_PLAYERS; i++) + for (new i = 0; i < MaxClients; i++) g_izUserVictimDistance[id][i] = 0 return PLUGIN_CONTINUE From 6ae11ed755e1deac4405f964c5492f9120ad9d8d Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 20:56:42 +0600 Subject: [PATCH 2/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 22ac7c1f..bc0cdde6 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -513,7 +513,7 @@ add_most_disruptive(id, sBuffer[MAX_BUFFER_LENGTH + 1]) iMaxHeadShots = 0 // Find player. - for (iPlayer = 1; iPlayer < MaxClients; iPlayer++) + for (iPlayer = 1; iPlayer <= MaxClients; iPlayer++) { if (g_izUserRndStats[iPlayer][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[iPlayer][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots)) { @@ -549,7 +549,7 @@ add_best_score(id, sBuffer[MAX_BUFFER_LENGTH + 1]) iMaxHeadShots = 0 // Find player - for (iPlayer = 1; iPlayer < MaxClients; iPlayer++) + for (iPlayer = 1; iPlayer <= MaxClients; iPlayer++) { if (g_izUserRndStats[iPlayer][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[iPlayer][STATS_KILLS] > iMaxKills || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots)) { From dae467032baef273518f735fa625f2d467bde428 Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 20:57:23 +0600 Subject: [PATCH 3/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index bc0cdde6..ce0fb003 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -1330,7 +1330,7 @@ public eventStartRound() } // Clear game stats, incl '0' that is sum of all users. - for (id = 0; id < MaxClients; id++) + for (id = 1; id <= MaxClients; id++) { for (i = 0; i < 8; i++) g_izUserGameStats[id][i] = 0 @@ -1348,7 +1348,7 @@ public eventStartRound() } // Clear user round stats, incl '0' that is sum of all users. - for (id = 0; id < MaxClients; id++) + for (id = 1; id <= MaxClients; id++) { g_izUserRndName[id][0] = 0 From cfaf862249783fb7bb99f816fbb777276f75ac28 Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 20:58:30 +0600 Subject: [PATCH 4/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index ce0fb003..fa0ae612 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -1412,7 +1412,7 @@ public delay_spawn(args[]) g_fzShowUserStatsTime[id] = 0.0 g_izUserAttackerDistance[id] = 0 - for (new i = 0; i < MaxClients; i++) + for (new i = 1; i <= MaxClients; i++) g_izUserVictimDistance[id][i] = 0 return PLUGIN_CONTINUE From 279a053dbee69dcf898330a5212b139a9bb219cf Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 21:01:07 +0600 Subject: [PATCH 5/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index fa0ae612..00eb3fab 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -165,7 +165,7 @@ 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_izUserVictimDistance[MAX_PLAYERS][32] +new g_izUserVictimDistance[MAX_PLAYERS][MAX_PLAYERS] new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH + 1] new g_izUserRndStats[MAX_PLAYERS][8] new g_izUserGameStats[MAX_PLAYERS][8] From 6fbf08869cb9d8183c162df8481ccf693db131b4 Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 21:03:05 +0600 Subject: [PATCH 6/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 00eb3fab..a48159f5 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -166,7 +166,7 @@ new g_izTeamGameStats[MAX_TEAMS][8] 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 + 1] +new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH] new g_izUserRndStats[MAX_PLAYERS][8] new g_izUserGameStats[MAX_PLAYERS][8] From d4cdec6f118ce27cc821c4f86a05bc6ef7c7c364 Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 21:13:49 +0600 Subject: [PATCH 7/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index a48159f5..0873b3d7 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -314,18 +314,12 @@ public cmdHudTest(id) // Stats formulas Float:accuracy(izStats[8]) { - if (!izStats[STATS_SHOTS]) - return (0.0) - - return (100.0 * float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS])) + return izStats[STATS_SHOTS] ? (100.0 * float(izStats[STATS_HITS]) / float(izStats[STATS_SHOTS])) : (0.0); } 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])) + return izStats[STATS_KILLS] ? (100.0 * float(izStats[STATS_KILLS]) / float(izStats[STATS_KILLS] + izStats[STATS_DEATHS])) : (0.0); } // Distance formula (metric) @@ -349,15 +343,9 @@ set_plugin_mode(id, sFlags[]) // Get config parameters. get_config_cvars() { - g_fFreezeTime = get_pcvar_float(g_pFreezeTime) + g_fFreezeTime = max(get_pcvar_float(g_pFreezeTime), 0.0); - if (g_fFreezeTime < 0.0) - g_fFreezeTime = 0.0 - - g_fHUDDuration = get_pcvar_float(g_pHudDuration) - - if (g_fHUDDuration < 1.0) - g_fHUDDuration = 1.0 + g_fHUDDuration = max(get_pcvar_float(g_pHudDuration), 1.0); g_fFreezeLimitTime = get_pcvar_float(g_pHudFreezeLimit) } From 795131cd9fb504ca44010834093fa71660ae8fcc Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 21:18:40 +0600 Subject: [PATCH 8/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index 0873b3d7..d3c31047 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -343,9 +343,9 @@ set_plugin_mode(id, sFlags[]) // Get config parameters. get_config_cvars() { - g_fFreezeTime = max(get_pcvar_float(g_pFreezeTime), 0.0); + g_fFreezeTime = floatmax(get_pcvar_float(g_pFreezeTime), 0.0); - g_fHUDDuration = max(get_pcvar_float(g_pHudDuration), 1.0); + g_fHUDDuration = floatmax(get_pcvar_float(g_pHudDuration), 1.0); g_fFreezeLimitTime = get_pcvar_float(g_pHudFreezeLimit) } From aa37e7f4e8bf8b4c45d1fe497b7da24b16b981bf Mon Sep 17 00:00:00 2001 From: 9iky6 Date: Sat, 26 Jul 2014 21:30:45 +0600 Subject: [PATCH 9/9] Update statsx.sma --- plugins/cstrike/statsx.sma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cstrike/statsx.sma b/plugins/cstrike/statsx.sma index d3c31047..30c0a209 100755 --- a/plugins/cstrike/statsx.sma +++ b/plugins/cstrike/statsx.sma @@ -1318,7 +1318,7 @@ public eventStartRound() } // Clear game stats, incl '0' that is sum of all users. - for (id = 1; id <= MaxClients; id++) + for (id = 0; id <= MaxClients; id++) { for (i = 0; i < 8; i++) g_izUserGameStats[id][i] = 0 @@ -1336,7 +1336,7 @@ public eventStartRound() } // Clear user round stats, incl '0' that is sum of all users. - for (id = 1; id <= MaxClients; id++) + for (id = 0; id <= MaxClients; id++) { g_izUserRndName[id][0] = 0