further clean up of unneeded stuff
This commit is contained in:
parent
06734d1b6e
commit
13f4727826
@ -11,17 +11,10 @@
|
||||
ArrayList g_hNames;
|
||||
ArrayList g_hClanNames;
|
||||
|
||||
bool g_bMapEnded;
|
||||
|
||||
int g_iBaseLatency[MAXPLAYERS + 1];
|
||||
int g_iLatency[MAXPLAYERS + 1];
|
||||
|
||||
int g_iAdminFakes;
|
||||
int g_iPopulation;
|
||||
|
||||
bool g_bCheckRequested;
|
||||
|
||||
bool g_bBlockInstantFakeConnects;
|
||||
|
||||
Database g_hDatabase;
|
||||
Database g_hDatabase_hlstats;
|
||||
@ -31,7 +24,7 @@ Database g_hDatabase_hlstats;
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "ImprovedHitboxes", //camouflage
|
||||
name = "fakes",
|
||||
author = "Neon + Dogan + Botox",
|
||||
description = "Handle Hitboxes via Plugin",
|
||||
version = "5.3.1",
|
||||
@ -52,22 +45,12 @@ public void OnPluginStart()
|
||||
g_hClanNames = CreateArray(arraySize);
|
||||
|
||||
g_iAdminFakes = -1;
|
||||
g_iPopulation = GetClientCount(false);
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientConnected(i) && IsFakeClient(i) && !IsClientSourceTV(i))
|
||||
g_iPopulation--;
|
||||
}
|
||||
g_bMapEnded = false;
|
||||
g_bBlockInstantFakeConnects = false;
|
||||
CreateTimer(10.0, BlockInstantFakeConnects, _, TIMER_REPEAT);
|
||||
CreateTimer(20.0, RunPopulationCheck, _, TIMER_REPEAT);
|
||||
CreateTimer(3.0, RandomizePing, _, TIMER_REPEAT);
|
||||
CreateTimer(150.0, RandomizeNames, _, TIMER_REPEAT);
|
||||
|
||||
HookUserMessage(GetUserMessageId("SayText2"), UserMessage_SayText2, true);
|
||||
|
||||
RequestFrame(CheckPopulation);
|
||||
|
||||
if (!g_hDatabase)
|
||||
{
|
||||
Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
|
||||
@ -197,36 +180,6 @@ public void OnMapStart()
|
||||
{
|
||||
randomize_clantags();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
char sFile[PLATFORM_MAX_PATH];
|
||||
char sLine[MAX_NAME_LENGTH];
|
||||
BuildPath(Path_SM, sFile, sizeof(sFile), "configs/fakeclients_names.txt");
|
||||
Handle hFile = OpenFile(sFile, "r");
|
||||
|
||||
if(hFile != INVALID_HANDLE)
|
||||
{
|
||||
int iLine = 0;
|
||||
g_hNames.Clear();
|
||||
while (!IsEndOfFile(hFile))
|
||||
{
|
||||
if (!ReadFileLine(hFile, sLine, sizeof(sLine)) || iLine >= MAXNAMES)
|
||||
break;
|
||||
|
||||
TrimString(sLine);
|
||||
g_hNames.PushString(sLine);
|
||||
iLine++;
|
||||
}
|
||||
delete hFile;
|
||||
}
|
||||
else
|
||||
SetFailState("Could not open file: configs/fakeclients_names.txt");
|
||||
*/
|
||||
|
||||
g_bMapEnded = false;
|
||||
|
||||
g_bBlockInstantFakeConnects = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -234,24 +187,15 @@ public void OnMapStart()
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
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) && !IsClientSourceTV(i))
|
||||
g_iPopulation--;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action BlockInstantFakeConnects(Handle timer)
|
||||
public Action RunPopulationCheck(Handle timer)
|
||||
{
|
||||
g_bBlockInstantFakeConnects = false;
|
||||
RequestFrame(CheckPopulation);
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
@ -364,15 +308,12 @@ public Action Command_DebugFakes(int client, int argc)
|
||||
iFakes++;
|
||||
iPlayers--;
|
||||
}
|
||||
if (IsFakeClient(i) && GetClientTeam(i) > 0)
|
||||
if (IsFakeClient(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
|
||||
iFakesInTeam++;
|
||||
|
||||
}
|
||||
|
||||
ReplyToCommand(client, "[SM] There are currently %d Fake-Clients, from which %d are in Spectate.", iFakes, iFakes - iFakesInTeam);
|
||||
ReplyToCommand(client, "[SM] Server Population at the end of the previous Map: %d.", g_iPopulation);
|
||||
ReplyToCommand(client, "[SM] Current Server Population: %d. Difference: %d.", iPlayers, iPlayers - g_iPopulation);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -397,7 +338,6 @@ public Action Command_SetFakes(int client, int argc)
|
||||
}
|
||||
|
||||
ReplyToCommand(client, "[SM] You set the amount of Fake-Clients to %d.", g_iAdminFakes);
|
||||
CheckPopulation();
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -433,18 +373,6 @@ public Action Command_Fakes(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientConnected(int client)
|
||||
{
|
||||
if (!g_bCheckRequested && !IsFakeClient(client) && !IsClientSourceTV(client))
|
||||
{
|
||||
RequestFrame(CheckPopulation);
|
||||
g_bCheckRequested = true;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -456,19 +384,7 @@ public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_iLatency[client] = 0;
|
||||
}
|
||||
|
||||
if (!g_bCheckRequested && !IsFakeClient(client) && !IsClientSourceTV(client))
|
||||
{
|
||||
RequestFrame(CheckPopulation);
|
||||
g_bCheckRequested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Action repeatCheckPopulation(Handle timer)
|
||||
{
|
||||
CheckPopulation();
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -476,42 +392,36 @@ public Action repeatCheckPopulation(Handle timer)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void CheckPopulation()
|
||||
{
|
||||
if (g_hNames.Length == 0 || g_hClanNames.Length == 0)
|
||||
{
|
||||
CreateTimer(5.0, repeatCheckPopulation);
|
||||
return;
|
||||
}
|
||||
g_bCheckRequested = false;
|
||||
|
||||
if(g_bMapEnded)
|
||||
return;
|
||||
|
||||
int iPlayers = GetClientCount(false);
|
||||
|
||||
int iPlayers = 0;
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && (IsFakeClient(i) || IsClientAutismBot(i) || IsClientSourceTV(i) || GetClientTeam(i) <= CS_TEAM_SPECTATOR))
|
||||
iPlayers--;
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientAutismBot(i) && !IsClientSourceTV(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
|
||||
iPlayers++;
|
||||
}
|
||||
|
||||
int iFakes = 0;
|
||||
int iFakesInTeam = 0;
|
||||
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientConnected(i) && IsFakeClient(i) && !IsClientSourceTV(i))
|
||||
iFakes++;
|
||||
}
|
||||
|
||||
bool okay_to_change_count = true;
|
||||
if (iPlayers > 16)
|
||||
{
|
||||
iPlayers = 16;
|
||||
}
|
||||
int iFakesInTeamNeeded = iPlayers;
|
||||
int iFakesInTeamNeeded = iPlayers / 5;
|
||||
int iFakesNeeded = iPlayers;
|
||||
|
||||
iPlayers = GetClientCount(false);
|
||||
iPlayers = 0;
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientConnected(i) && IsClientInGame(i) && IsClientAuthorized(i) && !IsFakeClient(i) && !IsClientAutismBot(i) && !IsClientSourceTV(i) && GetClientTeam(i) > CS_TEAM_SPECTATOR)
|
||||
iPlayers++;
|
||||
}
|
||||
|
||||
int iFakes = 0;
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientConnected(i) && IsFakeClient(i) && !IsClientSourceTV(i))
|
||||
iFakes++;
|
||||
}
|
||||
|
||||
if (iPlayers > 53)
|
||||
{
|
||||
@ -520,7 +430,7 @@ public void CheckPopulation()
|
||||
}
|
||||
else if (iPlayers > 48 && iFakes > 10)
|
||||
{
|
||||
iFakesInTeamNeeded = 5;
|
||||
iFakesInTeamNeeded = 3;
|
||||
iFakesNeeded = 10;
|
||||
}
|
||||
else if (iPlayers >= 42)
|
||||
@ -538,13 +448,13 @@ public void CheckPopulation()
|
||||
}
|
||||
|
||||
//LogMessage("specs: %i", specs);
|
||||
if (specs >= 13)
|
||||
if (specs >= 13 && iFakesNeeded > 0)
|
||||
{
|
||||
if (iFakesNeeded > 5)
|
||||
iFakesInTeamNeeded = iFakes;
|
||||
if (iFakes >= 5)
|
||||
{
|
||||
iFakesNeeded = 5;
|
||||
iFakesNeeded = iFakesInTeamNeeded = 5;
|
||||
}
|
||||
iFakesInTeamNeeded = iFakesNeeded;
|
||||
okay_to_change_count = true;
|
||||
//LogMessage("iFakesInTeamNeeded: %i", iFakesInTeamNeeded);
|
||||
}
|
||||
@ -561,7 +471,7 @@ public void CheckPopulation()
|
||||
|
||||
if (iFakes != iFakesNeeded && okay_to_change_count)
|
||||
{
|
||||
while (iFakes < iFakesNeeded && !g_bBlockInstantFakeConnects)
|
||||
if (iFakes < iFakesNeeded)
|
||||
{
|
||||
ArrayList hNames = g_hNames.Clone();
|
||||
char sName[MAX_NAME_LENGTH];
|
||||
@ -610,7 +520,6 @@ public void CheckPopulation()
|
||||
}
|
||||
iFakes++;
|
||||
|
||||
g_bBlockInstantFakeConnects = true;
|
||||
}
|
||||
|
||||
if (iFakes > iFakesNeeded)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user