FakePopulation: hopefully last fixes

- KickClientEx --> KickClient
- check return value of CreateFakeClient
- add fakes in teams back
This commit is contained in:
Dogan 2019-10-09 22:13:06 +02:00
parent 9b4fac0ffa
commit 346cd19635

View File

@ -57,7 +57,7 @@ public void OnPluginEnd()
{ {
g_bFakePopulation[i] = false; g_bFakePopulation[i] = false;
g_iLatency[i] = 0; g_iLatency[i] = 0;
KickClientEx(i); KickClient(i);
} }
} }
} }
@ -255,33 +255,37 @@ public void CheckPopulation()
if (iPlayers > 61) if (iPlayers > 61)
{ {
iFakesNeeded = 0; iFakesNeeded = 0;
iFakesInTeamNeeded = 0;
} }
else if(iPlayers > 59) else if(iPlayers > 59)
{ {
iFakesNeeded = 1; iFakesNeeded = 1;
iFakesInTeamNeeded = 0;
} }
else if(iPlayers > 57) else if(iPlayers > 57)
{ {
iFakesNeeded = 2; iFakesNeeded = 2;
iFakesInTeamNeeded = 1;
} }
else if(iPlayers > 55) else if(iPlayers > 55)
{ {
iFakesNeeded = 3; iFakesNeeded = 3;
iFakesInTeamNeeded = 0; iFakesInTeamNeeded = 1;
} }
else if (iPlayers > 20) else if (iPlayers > 20)
{ {
iFakesNeeded = 4; iFakesNeeded = 4;
iFakesInTeamNeeded = 0; iFakesInTeamNeeded = 2;
} }
else if (iPlayers > 10) else if (iPlayers > 10)
{ {
iFakesNeeded = 3; iFakesNeeded = 3;
iFakesInTeamNeeded = 0; iFakesInTeamNeeded = 1;
} }
else if (iPlayers > 5) else if (iPlayers > 5)
{ {
iFakesNeeded = 2; iFakesNeeded = 2;
iFakesInTeamNeeded = 0;
} }
else else
{ {
@ -299,6 +303,9 @@ public void CheckPopulation()
int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1); int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1);
int iIndex = CreateFakeClient(g_cName[RandomName]); int iIndex = CreateFakeClient(g_cName[RandomName]);
if(iIndex < 1 || iIndex > MaxClients)
return;
SetEntityFlags(iIndex, FL_CLIENT); SetEntityFlags(iIndex, FL_CLIENT);
DispatchKeyValue(iIndex, "classname", "player"); DispatchKeyValue(iIndex, "classname", "player");
DispatchSpawn(iIndex); DispatchSpawn(iIndex);
@ -322,7 +329,7 @@ public void CheckPopulation()
{ {
g_bFakePopulation[i] = false; g_bFakePopulation[i] = false;
g_iLatency[i] = 0; g_iLatency[i] = 0;
KickClientEx(i); KickClient(i);
iFakes--; iFakes--;
break; break;
} }