[FakeClients] Remove bot motherzm exclusion & fix indents.

This commit is contained in:
zaCade 2024-06-22 10:59:06 +02:00
parent ac7de82c6c
commit 87bb74837f

View File

@ -12,9 +12,6 @@ ArrayList g_hNames;
bool g_bFakePopulation[MAXPLAYERS + 1];
bool g_bMapEnded;
//check if autismbot
bool is_bot_player[MAXPLAYERS + 1];
int g_iBaseLatency[MAXPLAYERS + 1];
int g_iLatency[MAXPLAYERS + 1];
@ -315,21 +312,20 @@ public void OnClientConnected(int client)
//----------------------------------------------------------------------------------------------------
public void OnClientDisconnect(int client)
{
if (client > 0)
{
if(g_bFakePopulation[client])
{
g_bFakePopulation[client] = false;
g_iLatency[client] = 0;
}
if (client > 0)
{
if(g_bFakePopulation[client])
{
g_bFakePopulation[client] = false;
g_iLatency[client] = 0;
}
if (!g_bCheckRequested && !IsFakeClient(client))
{
RequestFrame(CheckPopulation);
g_bCheckRequested = true;
}
is_bot_player[client] = false;
}
if (!g_bCheckRequested && !IsFakeClient(client))
{
RequestFrame(CheckPopulation);
g_bCheckRequested = true;
}
}
}
//----------------------------------------------------------------------------------------------------
@ -337,140 +333,140 @@ public void OnClientDisconnect(int client)
//----------------------------------------------------------------------------------------------------
public void CheckPopulation()
{
g_bCheckRequested = false;
g_bCheckRequested = false;
if(g_bMapEnded)
return;
if(g_bMapEnded)
return;
int iPlayers = GetClientCount(false);
int iPlayers = GetClientCount(false);
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsFakeClient(i))
iPlayers--;
}
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && IsFakeClient(i))
iPlayers--;
}
int iFakes = 0;
int iFakesInTeam = 0;
int iFakes = 0;
int iFakesInTeam = 0;
for(int i = 1; i <= MaxClients; i++)
{
if (g_bFakePopulation[i])
iFakes++;
}
for(int i = 1; i <= MaxClients; i++)
{
if (g_bFakePopulation[i])
iFakes++;
}
int iFakesNeeded = 0;
int iFakesInTeamNeeded = 0;
//24 to account for 4 autismbots.
iFakesNeeded = 24 - RoundToFloor(iPlayers / 1.5);
if (iFakesNeeded < 0)
{
iFakesNeeded = 0;
iFakesInTeamNeeded = 0;
}
else
{
iFakesInTeamNeeded = iFakesNeeded / 3;
}
int iFakesNeeded = 0;
int iFakesInTeamNeeded = 0;
if(g_iAdminFakes != -1)
iFakesNeeded = g_iAdminFakes;
//24 to account for 4 autismbots.
iFakesNeeded = 24 - RoundToFloor(iPlayers / 1.5);
if (iFakesNeeded < 0)
{
iFakesNeeded = 0;
iFakesInTeamNeeded = 0;
}
else
{
iFakesInTeamNeeded = iFakesNeeded / 3;
}
if (iFakes != iFakesNeeded)
{
while (iFakes < iFakesNeeded && !g_bBlockInstantFakeConnects)
{
ArrayList hNames = g_hNames.Clone();
char sName[MAX_NAME_LENGTH];
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
GetClientName(i, sName, sizeof(sName));
int iPos = hNames.FindString(sName);
if (iPos > -1)
hNames.Erase(iPos);
}
}
if(g_iAdminFakes != -1)
iFakesNeeded = g_iAdminFakes;
int iRand = GetRandomInt(0, hNames.Length - 1);
hNames.GetString(iRand, sName, sizeof(sName));
delete hNames;
if (iFakes != iFakesNeeded)
{
while (iFakes < iFakesNeeded && !g_bBlockInstantFakeConnects)
{
ArrayList hNames = g_hNames.Clone();
char sName[MAX_NAME_LENGTH];
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
GetClientName(i, sName, sizeof(sName));
int iPos = hNames.FindString(sName);
if (iPos > -1)
hNames.Erase(iPos);
}
}
int iIndex = CreateFakeClient(sName);
int iRand = GetRandomInt(0, hNames.Length - 1);
hNames.GetString(iRand, sName, sizeof(sName));
delete hNames;
if(iIndex < 1 || iIndex > MaxClients)
return;
int iIndex = CreateFakeClient(sName);
SetEntityFlags(iIndex, FL_CLIENT);
DispatchKeyValue(iIndex, "classname", "player");
DispatchSpawn(iIndex);
if(iIndex < 1 || iIndex > MaxClients)
return;
g_bFakePopulation[iIndex] = true;
g_iBaseLatency[iIndex] = GetRandomInt(20, 110);
g_iLatency[iIndex] = g_iBaseLatency[iIndex];
SetEntityFlags(iIndex, FL_CLIENT);
DispatchKeyValue(iIndex, "classname", "player");
DispatchSpawn(iIndex);
AdminId FakeAdmin = CreateAdmin();
SetAdminFlag(FakeAdmin, Admin_Custom6, true);
SetUserAdmin(iIndex, FakeAdmin, true);
//CS_SetClientClanTag(iIndex, "UNLOZE");
iFakes++;
g_bFakePopulation[iIndex] = true;
g_iBaseLatency[iIndex] = GetRandomInt(20, 110);
g_iLatency[iIndex] = g_iBaseLatency[iIndex];
g_bBlockInstantFakeConnects = true;
}
AdminId FakeAdmin = CreateAdmin();
SetAdminFlag(FakeAdmin, Admin_Custom6, true);
SetUserAdmin(iIndex, FakeAdmin, true);
//CS_SetClientClanTag(iIndex, "UNLOZE");
iFakes++;
while (iFakes > iFakesNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
g_bFakePopulation[i] = false;
g_iLatency[i] = 0;
KickClient(i, "Disconnect by user.");
iFakes--;
break;
}
}
}
}
g_bBlockInstantFakeConnects = true;
}
for(int i = 1; i <= MaxClients; i++)
{
if (g_bFakePopulation[i] && GetClientTeam(i) >= CS_TEAM_T)
iFakesInTeam++;
}
while (iFakes > iFakesNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i])
{
g_bFakePopulation[i] = false;
g_iLatency[i] = 0;
KickClient(i, "Disconnect by user.");
iFakes--;
break;
}
}
}
}
if (iFakes == iFakesNeeded && iFakesInTeam != iFakesInTeamNeeded && g_iAdminFakes == -1)
{
while (iFakesInTeam < iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) <= CS_TEAM_SPECTATOR)
{
ChangeClientTeam(i, CS_TEAM_CT);
FakeClientCommandEx(i, "joinclass");
iFakesInTeam++;
break;
}
}
}
for(int i = 1; i <= MaxClients; i++)
{
if (g_bFakePopulation[i] && GetClientTeam(i) >= CS_TEAM_T)
iFakesInTeam++;
}
while (iFakesInTeam > iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) >= CS_TEAM_T)
{
ChangeClientTeam(i, CS_TEAM_SPECTATOR);
iFakesInTeam--;
break;
}
}
}
}
if (iFakes == iFakesNeeded && iFakesInTeam != iFakesInTeamNeeded && g_iAdminFakes == -1)
{
while (iFakesInTeam < iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) <= CS_TEAM_SPECTATOR)
{
ChangeClientTeam(i, CS_TEAM_CT);
FakeClientCommandEx(i, "joinclass");
iFakesInTeam++;
break;
}
}
}
while (iFakesInTeam > iFakesInTeamNeeded)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bFakePopulation[i] && GetClientTeam(i) >= CS_TEAM_T)
{
ChangeClientTeam(i, CS_TEAM_SPECTATOR);
iFakesInTeam--;
break;
}
}
}
}
}
//----------------------------------------------------------------------------------------------------
@ -494,31 +490,8 @@ public void OnGameFrame()
public Action ZR_OnClientMotherZombieEligible(int client)
{
if (g_bFakePopulation[client] || is_bot_player[client])
return Plugin_Handled;
if (g_bFakePopulation[client])
return Plugin_Handled;
return Plugin_Continue;
}
public void OnClientPostAdminCheck(int client)
{
is_bot_player[client] = false;
char auth[50];
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
if (StrEqual("[U:1:1221121532]", auth, false) || StrEqual("STEAM_0:0:610560766", auth, false))
{
is_bot_player[client] = true;
}
if (StrEqual("[U:1:408797742]", auth, false) || StrEqual("STEAM_0:0:204398871", auth, false))
{
is_bot_player[client] = true;
}
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
{
is_bot_player[client] = true;
}
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
{
is_bot_player[client] = true;
}
return Plugin_Continue;
}