removed fakeclients, sourcetv, not yet connected clients, autismbots and nosteamers from counting towards player requirement for maps

This commit is contained in:
jenz 2023-03-13 20:00:35 +01:00
parent de2dbcb9c5
commit c8bcee4377

View File

@ -49,6 +49,7 @@
#include <nextmap>
#include <sdktools>
#include <multicolors>
#include <PlayerManager>
#pragma semicolon 1
#pragma newdecls required
@ -140,6 +141,9 @@ int g_NominateCount = 0;
int g_NominateReservedCount = 0;
MapChange g_ChangeTime;
//check if autismbot
bool is_bot_player[MAXPLAYERS + 1];
Handle g_NominationsResetForward = INVALID_HANDLE;
Handle g_MapVoteStartedForward = INVALID_HANDLE;
@ -605,6 +609,7 @@ public void OnClientDisconnect_Post(int client)
public void OnClientDisconnect(int client)
{
is_bot_player[client] = false;
int index = FindValueInArray(g_NominateOwners, client);
if(index == -1)
@ -2765,12 +2770,46 @@ stock int InternalGetMapTimeRestriction(const char[] map)
return 0;
}
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;
}
}
// <0 = Less than MinPlayers
// 0 = Okay
// >0 = More than MaxPlayers
stock int InternalGetMapPlayerRestriction(const char[] map)
{
int NumPlayers = GetClientCount(false);
//int NumPlayers = GetClientCount(false);
int NumPlayers = 0;
//excluding non connected players, fakeclients, sourceTV, autism bots and nosteamers from player count restriction
for (int client = 1; client <= MaxClients; client++)
{
if (IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client) && !IsClientSourceTV(client) && !is_bot_player[client]
&& PM_IsPlayerSteam(client))
{
NumPlayers++;
}
}
int MinPlayers = InternalGetMapMinPlayers(map);
int MaxPlayers = InternalGetMapMaxPlayers(map);