removed fakeclients, sourcetv, not yet connected clients, autismbots and nosteamers from counting towards player requirement for maps
This commit is contained in:
parent
de2dbcb9c5
commit
c8bcee4377
@ -49,6 +49,7 @@
|
|||||||
#include <nextmap>
|
#include <nextmap>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <multicolors>
|
#include <multicolors>
|
||||||
|
#include <PlayerManager>
|
||||||
|
|
||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
@ -140,6 +141,9 @@ int g_NominateCount = 0;
|
|||||||
int g_NominateReservedCount = 0;
|
int g_NominateReservedCount = 0;
|
||||||
MapChange g_ChangeTime;
|
MapChange g_ChangeTime;
|
||||||
|
|
||||||
|
//check if autismbot
|
||||||
|
bool is_bot_player[MAXPLAYERS + 1];
|
||||||
|
|
||||||
Handle g_NominationsResetForward = INVALID_HANDLE;
|
Handle g_NominationsResetForward = INVALID_HANDLE;
|
||||||
Handle g_MapVoteStartedForward = INVALID_HANDLE;
|
Handle g_MapVoteStartedForward = INVALID_HANDLE;
|
||||||
|
|
||||||
@ -605,6 +609,7 @@ public void OnClientDisconnect_Post(int client)
|
|||||||
|
|
||||||
public void OnClientDisconnect(int client)
|
public void OnClientDisconnect(int client)
|
||||||
{
|
{
|
||||||
|
is_bot_player[client] = false;
|
||||||
int index = FindValueInArray(g_NominateOwners, client);
|
int index = FindValueInArray(g_NominateOwners, client);
|
||||||
|
|
||||||
if(index == -1)
|
if(index == -1)
|
||||||
@ -2765,22 +2770,56 @@ stock int InternalGetMapTimeRestriction(const char[] map)
|
|||||||
return 0;
|
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 = Less than MinPlayers
|
||||||
// 0 = Okay
|
// 0 = Okay
|
||||||
// >0 = More than MaxPlayers
|
// >0 = More than MaxPlayers
|
||||||
stock int InternalGetMapPlayerRestriction(const char[] map)
|
stock int InternalGetMapPlayerRestriction(const char[] map)
|
||||||
{
|
{
|
||||||
int NumPlayers = GetClientCount(false);
|
//int NumPlayers = GetClientCount(false);
|
||||||
int MinPlayers = InternalGetMapMinPlayers(map);
|
int NumPlayers = 0;
|
||||||
int MaxPlayers = InternalGetMapMaxPlayers(map);
|
//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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(MinPlayers && NumPlayers < MinPlayers)
|
int MinPlayers = InternalGetMapMinPlayers(map);
|
||||||
return NumPlayers - MinPlayers;
|
int MaxPlayers = InternalGetMapMaxPlayers(map);
|
||||||
|
|
||||||
if(MaxPlayers && NumPlayers > MaxPlayers)
|
if(MinPlayers && NumPlayers < MinPlayers)
|
||||||
return NumPlayers - MaxPlayers;
|
return NumPlayers - MinPlayers;
|
||||||
|
|
||||||
return 0;
|
if(MaxPlayers && NumPlayers > MaxPlayers)
|
||||||
|
return NumPlayers - MaxPlayers;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock bool InternalAreRestrictionsActive()
|
stock bool InternalAreRestrictionsActive()
|
||||||
|
Loading…
Reference in New Issue
Block a user