From c1cf184d312e54b42e49d94af66ecb13b2b53129 Mon Sep 17 00:00:00 2001 From: dogan Date: Fri, 28 Aug 2020 13:21:33 +0200 Subject: [PATCH] FakeClients: testing new feature --- FakeClients/scripting/FakeClients.sp | 103 +++++++++++++++++++-------- 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/FakeClients/scripting/FakeClients.sp b/FakeClients/scripting/FakeClients.sp index c7f90e4a..c24fdb81 100644 --- a/FakeClients/scripting/FakeClients.sp +++ b/FakeClients/scripting/FakeClients.sp @@ -15,6 +15,7 @@ int g_iBaseLatency[MAXPLAYERS + 1]; int g_iLatency[MAXPLAYERS + 1]; int g_iAdminFakes; +int g_iPopulation; bool g_bCheckRequested; @@ -45,6 +46,12 @@ public void OnPluginStart() g_hNames = CreateArray(arraySize); g_iAdminFakes = -1; + g_iPopulation = GetClientCount(false); + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientConnected(i) && IsFakeClient(i)) + g_iPopulation--; + } g_bMapEnded = false; g_bBlockInstantFakeConnects = false; CreateTimer(5.0, BlockInstantFakeConnects, _, TIMER_REPEAT); @@ -113,6 +120,12 @@ public void OnMapEnd() { g_bMapEnded = true; g_iAdminFakes = -1; + g_iPopulation = GetClientCount(false); + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientConnected(i) && IsFakeClient(i)) + g_iPopulation--; + } } //---------------------------------------------------------------------------------------------------- @@ -324,6 +337,10 @@ public void CheckPopulation() iPlayers--; } + bool bServerDying; + if(iPlayers < (g_iPopulation - 10)) + bServerDying = true; + int iFakes = 0; int iFakesInTeam = 0; @@ -336,40 +353,66 @@ public void CheckPopulation() int iFakesNeeded = 0; int iFakesInTeamNeeded = 0; - if (iPlayers > 61) + if(bServerDying) { - 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 = 1; - } - else if (iPlayers > 20) - { - iFakesNeeded = 5; - iFakesInTeamNeeded = 2; - } - else if (iPlayers > 10) - { - iFakesNeeded = 5; - iFakesInTeamNeeded = 1; + if (iPlayers > 45) + { + iFakesNeeded = 6; + iFakesInTeamNeeded = 2; + } + else if (iPlayers > 20) + { + iFakesNeeded = 7; + iFakesInTeamNeeded = 3; + } + else if (iPlayers > 10) + { + iFakesNeeded = 6; + iFakesInTeamNeeded = 2; + } + else + { + iFakesNeeded = 5; + iFakesInTeamNeeded = 0; + } } else { - iFakesNeeded = 5; - iFakesInTeamNeeded = 0; + 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 = 1; + } + else if (iPlayers > 20) + { + iFakesNeeded = 5; + iFakesInTeamNeeded = 2; + } + else if (iPlayers > 10) + { + iFakesNeeded = 5; + iFakesInTeamNeeded = 1; + } + else + { + iFakesNeeded = 5; + iFakesInTeamNeeded = 0; + } } if(g_iAdminFakes != -1)