From ca66dfa053efff135089babc33edac4736a86a8d Mon Sep 17 00:00:00 2001 From: Dogan Date: Wed, 9 Oct 2019 22:13:06 +0200 Subject: [PATCH] FakePopulation: hopefully last fixes - KickClientEx --> KickClient - check return value of CreateFakeClient - add fakes in teams back --- FakePopulation/scripting/FakePopulation.sp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/FakePopulation/scripting/FakePopulation.sp b/FakePopulation/scripting/FakePopulation.sp index c5ef3415..57c9f11c 100644 --- a/FakePopulation/scripting/FakePopulation.sp +++ b/FakePopulation/scripting/FakePopulation.sp @@ -57,7 +57,7 @@ public void OnPluginEnd() { g_bFakePopulation[i] = false; g_iLatency[i] = 0; - KickClientEx(i); + KickClient(i); } } } @@ -255,33 +255,37 @@ public void CheckPopulation() if (iPlayers > 61) { iFakesNeeded = 0; + iFakesInTeamNeeded = 0; } else if(iPlayers > 59) { iFakesNeeded = 1; + iFakesInTeamNeeded = 0; } else if(iPlayers > 57) { iFakesNeeded = 2; + iFakesInTeamNeeded = 1; } else if(iPlayers > 55) { iFakesNeeded = 3; - iFakesInTeamNeeded = 0; + iFakesInTeamNeeded = 1; } else if (iPlayers > 20) { iFakesNeeded = 4; - iFakesInTeamNeeded = 0; + iFakesInTeamNeeded = 2; } else if (iPlayers > 10) { iFakesNeeded = 3; - iFakesInTeamNeeded = 0; + iFakesInTeamNeeded = 1; } else if (iPlayers > 5) { iFakesNeeded = 2; + iFakesInTeamNeeded = 0; } else { @@ -299,6 +303,9 @@ public void CheckPopulation() int RandomName = GetRandomInt(0, NUMBEROFNAMES - 1); int iIndex = CreateFakeClient(g_cName[RandomName]); + if(iIndex < 1 || iIndex > MaxClients) + return; + SetEntityFlags(iIndex, FL_CLIENT); DispatchKeyValue(iIndex, "classname", "player"); DispatchSpawn(iIndex); @@ -322,7 +329,7 @@ public void CheckPopulation() { g_bFakePopulation[i] = false; g_iLatency[i] = 0; - KickClientEx(i); + KickClient(i); iFakes--; break; }