made it its own cvar

This commit is contained in:
jenz 2026-07-25 14:32:29 +02:00
parent 2b9224f11a
commit fd32ddc101

View File

@ -3,6 +3,8 @@
#include <cstrike>
#include <AFKManager>
int g_iPlayer_move_spec_count;
public Plugin myinfo =
{
name = "spectator_handler",
@ -15,11 +17,20 @@ public Plugin myinfo =
public void OnPluginStart()
{
CreateTimer(60.0, CheckAfks, _, TIMER_REPEAT);
ConVar cvar;
HookConVarChange((cvar = CreateConVar("sm_move_spec_to_team_count", "30", "Move real players from spec to teams until this many real players are connected")), Cvar_move_spec_team);
g_iPlayer_move_spec_count = cvar.IntValue;
delete cvar;
}
public void Cvar_move_spec_team(ConVar convar, const char[] oldValue, const char[] newValue)
{
g_iPlayer_move_spec_count = convar.IntValue;
}
public Action CheckAfks(Handle timer)
{
int real_players_cap = FindConVar("mce_enable_map_cooldowns_player_count").IntValue;
int real_players = 0;
for (int i = 0; i < MaxClients; i++)
{
@ -28,7 +39,7 @@ public Action CheckAfks(Handle timer)
real_players++;
}
}
if (real_players < real_players_cap)
if (real_players < g_iPlayer_move_spec_count)
{
for (int i = 0; i < MaxClients; i++)
{