From fd32ddc1015cf369b9e29e117279977eb4bb7d65 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 25 Jul 2026 14:32:29 +0200 Subject: [PATCH] made it its own cvar --- AFKManager/scripting/spectate_handler.sp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/AFKManager/scripting/spectate_handler.sp b/AFKManager/scripting/spectate_handler.sp index 04211cf..4a1d96a 100644 --- a/AFKManager/scripting/spectate_handler.sp +++ b/AFKManager/scripting/spectate_handler.sp @@ -3,6 +3,8 @@ #include #include +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++) {