excluding autismbots from rtv count

This commit is contained in:
jenz 2023-03-15 19:00:57 +01:00
parent c8bcee4377
commit 709a07a62b

View File

@ -64,9 +64,11 @@ ConVar g_Cvar_RTVAutoDisable;
ConVar g_Cvar_AFKTime;
ConVar g_Cvar_RTVRevoteDelay;
//check if autismbot
bool is_bot_player[MAXPLAYERS + 1];
bool g_CanRTV = false; // True if RTV loaded maps and is active.
bool g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes.
int g_Voters = 0; // Total voters connected. Doesn't include fake clients.
int g_Voters = 0; // Total voters connected. Doesnt include fake clients.
int g_Votes = 0; // Total number of "say rtv" votes
int g_VotesNeeded = 0; // Necessary votes before map vote begins. (voters * percent_needed)
bool g_Voted[MAXPLAYERS+1] = {false, ...};
@ -86,7 +88,7 @@ public void OnPluginStart()
g_Cvar_InitialDelay = CreateConVar("sm_rtv_initialdelay", "30.0", "Time (in seconds) before first RTV can be held", 0, true, 0.00);
g_Cvar_Interval = CreateConVar("sm_rtv_interval", "240.0", "Time (in seconds) after a failed RTV before another can be held", 0, true, 0.00);
g_Cvar_ChangeTime = CreateConVar("sm_rtv_changetime", "0", "When to change the map after a succesful RTV: 0 - Instant, 1 - RoundEnd, 2 - MapEnd", _, true, 0.0, true, 2.0);
g_Cvar_RTVPostVoteAction = CreateConVar("sm_rtv_postvoteaction", "0", "What to do with RTV's after a mapvote has completed. 0 - Allow, success = instant change, 1 - Deny", _, true, 0.0, true, 1.0);
g_Cvar_RTVPostVoteAction = CreateConVar("sm_rtv_postvoteaction", "0", "What to do with RTVs after a mapvote has completed. 0 - Allow, success = instant change, 1 - Deny", _, true, 0.0, true, 1.0);
g_Cvar_RTVAutoDisable = CreateConVar("sm_rtv_autodisable", "0", "Automatically disable RTV when map time is over.", _, true, 0.0, true, 1.0);
g_Cvar_AFKTime = CreateConVar("sm_rtv_afk_time", "180", "AFK Time in seconds after which a player is not counted in the rtv ratio");
g_Cvar_RTVRevoteDelay = CreateConVar("sm_rtv_revote_delay", "5", "Delay in seconds before a player can vote for RTV after undoing");
@ -142,6 +144,7 @@ public void OnClientPutInServer(int client)
public void OnClientDisconnect(int client)
{
is_bot_player[client] = false;
if (g_Voted[client])
{
g_Voted[client] = false;
@ -152,6 +155,29 @@ public void OnClientDisconnect(int client)
UpdateRTV();
}
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;
}
}
public void OnPlayerChangedTeam(Handle event, const char[] name, bool dontBroadcast)
{
UpdateRTV();
@ -165,7 +191,7 @@ void UpdateRTV()
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
if (IsClientInGame(i) && !IsFakeClient(i) && !is_bot_player[i])
{
if (GetClientIdleTime(i) >= g_Cvar_AFKTime.IntValue)
continue;
@ -426,7 +452,7 @@ public Action Command_DebugRTV(int client, int args)
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
if (IsClientInGame(i) && !IsFakeClient(i) && !is_bot_player[i])
{
if (GetClientIdleTime(i) >= g_Cvar_AFKTime.IntValue)
continue;