FakeClients: testing new feature

This commit is contained in:
dogan 2020-08-28 13:21:33 +02:00
parent 8ab0e6776c
commit c1cf184d31

View File

@ -15,6 +15,7 @@ int g_iBaseLatency[MAXPLAYERS + 1];
int g_iLatency[MAXPLAYERS + 1]; int g_iLatency[MAXPLAYERS + 1];
int g_iAdminFakes; int g_iAdminFakes;
int g_iPopulation;
bool g_bCheckRequested; bool g_bCheckRequested;
@ -45,6 +46,12 @@ public void OnPluginStart()
g_hNames = CreateArray(arraySize); g_hNames = CreateArray(arraySize);
g_iAdminFakes = -1; 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_bMapEnded = false;
g_bBlockInstantFakeConnects = false; g_bBlockInstantFakeConnects = false;
CreateTimer(5.0, BlockInstantFakeConnects, _, TIMER_REPEAT); CreateTimer(5.0, BlockInstantFakeConnects, _, TIMER_REPEAT);
@ -113,6 +120,12 @@ public void OnMapEnd()
{ {
g_bMapEnded = true; g_bMapEnded = true;
g_iAdminFakes = -1; 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--; iPlayers--;
} }
bool bServerDying;
if(iPlayers < (g_iPopulation - 10))
bServerDying = true;
int iFakes = 0; int iFakes = 0;
int iFakesInTeam = 0; int iFakesInTeam = 0;
@ -336,40 +353,66 @@ public void CheckPopulation()
int iFakesNeeded = 0; int iFakesNeeded = 0;
int iFakesInTeamNeeded = 0; int iFakesInTeamNeeded = 0;
if (iPlayers > 61) if(bServerDying)
{ {
iFakesNeeded = 0; if (iPlayers > 45)
iFakesInTeamNeeded = 0; {
} iFakesNeeded = 6;
else if(iPlayers > 59) iFakesInTeamNeeded = 2;
{ }
iFakesNeeded = 1; else if (iPlayers > 20)
iFakesInTeamNeeded = 0; {
} iFakesNeeded = 7;
else if(iPlayers > 57) iFakesInTeamNeeded = 3;
{ }
iFakesNeeded = 2; else if (iPlayers > 10)
iFakesInTeamNeeded = 1; {
} iFakesNeeded = 6;
else if(iPlayers > 55) iFakesInTeamNeeded = 2;
{ }
iFakesNeeded = 3; else
iFakesInTeamNeeded = 1; {
} iFakesNeeded = 5;
else if (iPlayers > 20) iFakesInTeamNeeded = 0;
{ }
iFakesNeeded = 5;
iFakesInTeamNeeded = 2;
}
else if (iPlayers > 10)
{
iFakesNeeded = 5;
iFakesInTeamNeeded = 1;
} }
else else
{ {
iFakesNeeded = 5; if (iPlayers > 61)
iFakesInTeamNeeded = 0; {
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) if(g_iAdminFakes != -1)