FakePopulation: all latest changes

also use GetClientCount for Population Check to fix fake client on index 0 error
This commit is contained in:
Dogan 2019-10-08 20:12:36 +02:00
parent ff2f757c49
commit 9d06dd8efc

View File

@ -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)
{