From 9d06dd8efc80b052eef64ed104e57bf994ff3704 Mon Sep 17 00:00:00 2001 From: Dogan Date: Tue, 8 Oct 2019 20:12:36 +0200 Subject: [PATCH] FakePopulation: all latest changes also use GetClientCount for Population Check to fix fake client on index 0 error --- FakePopulation/scripting/FakePopulation.sp | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/FakePopulation/scripting/FakePopulation.sp b/FakePopulation/scripting/FakePopulation.sp index 4aecc00b..c5ef3415 100644 --- a/FakePopulation/scripting/FakePopulation.sp +++ b/FakePopulation/scripting/FakePopulation.sp @@ -14,7 +14,7 @@ int g_iBaseLatency[MAXPLAYERS + 1]; int g_iLatency[MAXPLAYERS + 1]; int g_iAdminFakes; bool g_bCheckRequested; -int g_iUserInfoStringTable; +//int g_iUserInfoStringTable; //---------------------------------------------------------------------------------------------------- // Purpose: @@ -43,7 +43,7 @@ public void OnPluginStart() RequestFrame(CheckPopulation); - g_iUserInfoStringTable = FindStringTable("userinfo"); + //g_iUserInfoStringTable = FindStringTable("userinfo"); } //---------------------------------------------------------------------------------------------------- @@ -232,11 +232,12 @@ public void CheckPopulation() if(g_bMapEnded) return; - int iPlayers = 0; + int iPlayers = GetClientCount(false); + for(int i = 1; i <= MaxClients; i++) { - if(IsClientConnected(i) && !IsFakeClient(i)) - iPlayers++; + if(IsClientConnected(i) && IsFakeClient(i)) + iPlayers--; } int iFakes = 0; @@ -255,25 +256,28 @@ public void CheckPopulation() { iFakesNeeded = 0; } - else if(iPlayers > 60) + else if(iPlayers > 59) { iFakesNeeded = 1; - iFakesInTeamNeeded = 0; + } + else if(iPlayers > 57) + { + iFakesNeeded = 2; } else if(iPlayers > 55) { - iFakesNeeded = 1; - iFakesInTeamNeeded = 1; + iFakesNeeded = 3; + iFakesInTeamNeeded = 0; } else if (iPlayers > 20) { iFakesNeeded = 4; - iFakesInTeamNeeded = 2; + iFakesInTeamNeeded = 0; } else if (iPlayers > 10) { iFakesNeeded = 3; - iFakesInTeamNeeded = 1; + iFakesInTeamNeeded = 0; } else if (iPlayers > 5) {