diff --git a/FakeClients/scripting/FakeClients.sp b/FakeClients/scripting/FakeClients.sp index f61b9cd..3f7a99d 100755 --- a/FakeClients/scripting/FakeClients.sp +++ b/FakeClients/scripting/FakeClients.sp @@ -490,7 +490,7 @@ public void CheckPopulation() for(int i = 1; i <= MaxClients; i++) { - if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && (IsFakeClient(i) || IsClientAutismBot(i) || IsClientSourceTV(i) || GetClientTeam(i) == CS_TEAM_SPECTATOR)) + if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && (IsFakeClient(i) || IsClientAutismBot(i) || IsClientSourceTV(i) || GetClientTeam(i) <= CS_TEAM_SPECTATOR)) iPlayers--; } @@ -503,31 +503,52 @@ public void CheckPopulation() iFakes++; } + bool okay_to_change_count = true; + if (iPlayers > 16) + { + iPlayers = 16; + } int iFakesInTeamNeeded = iPlayers; int iFakesNeeded = iPlayers; - int full_client_count = GetClientCount(false); + iPlayers = GetClientCount(false); - if (full_client_count > 50 && iFakes > 15) - { - iFakesInTeamNeeded = 3; - iFakesNeeded = 15; - } - else if (full_client_count > 54 && iFakes > 8) - { - iFakesInTeamNeeded = 2; - iFakesNeeded = 5; - } - else if (full_client_count > 59 && iFakes > 0) //counting all clients in total. - { + if (iPlayers > 53) + { iFakesInTeamNeeded = 0; iFakesNeeded = 0; - } - else if (full_client_count >= 42) - { - return; } - else + else if (iPlayers > 48 && iFakes > 10) + { + iFakesInTeamNeeded = 5; + iFakesNeeded = 10; + } + else if (iPlayers >= 42) + { + okay_to_change_count = false; + } + + int specs = 0; + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientConnected(i) && GetClientTeam(i) <= CS_TEAM_SPECTATOR) + { + specs++; + } + } + + //LogMessage("specs: %i", specs); + if (specs >= 13) + { + if (iFakesNeeded > 5) + { + iFakesNeeded = 5; + } + iFakesInTeamNeeded = iFakesNeeded; + okay_to_change_count = true; + //LogMessage("iFakesInTeamNeeded: %i", iFakesInTeamNeeded); + } + else if (specs <= 10) { iFakesInTeamNeeded = (iFakesNeeded / 5); } @@ -538,7 +559,7 @@ public void CheckPopulation() } - if (iFakes != iFakesNeeded) + if (iFakes != iFakesNeeded && okay_to_change_count) { while (iFakes < iFakesNeeded && !g_bBlockInstantFakeConnects) { @@ -613,6 +634,7 @@ public void CheckPopulation() iFakesInTeam++; } + //LogMessage("iFakesInTeam: %i. iFakesInTeamNeeded: %i", iFakesInTeam, iFakesInTeamNeeded); if (iFakesInTeam != iFakesInTeamNeeded && g_iAdminFakes == -1) { if (iFakesInTeam < iFakesInTeamNeeded)