From aed0d2777a3fdb89febcc9c91fd846b119cc6a23 Mon Sep 17 00:00:00 2001 From: 7mochi Date: Wed, 18 Sep 2024 22:39:36 -0500 Subject: [PATCH] fix: remove the player from spectator if it has to play the match --- src/scripts/llhl.sma | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/scripts/llhl.sma b/src/scripts/llhl.sma index a7b8c44..1964f43 100644 --- a/src/scripts/llhl.sma +++ b/src/scripts/llhl.sma @@ -123,7 +123,8 @@ enum (+=103) { TASK_CVARCHECKER = 72958, TASK_SHOWVENGINE, - TASK_CHEATCHECKER + TASK_CHEATCHECKER, + TASK_MM_START_MATCH }; enum _:LLHLFile { @@ -1195,6 +1196,9 @@ public MatchManagerStartMatch(id) { if ((target = find_player("k", str_to_num(key)))) { TrieIterGetString(iterator, value, charsmax(value), valueLength); if (!equali(value, MM_NO_TEAM)) { + if (hl_get_user_spectator(target)) { + client_cmd(target, "spectate"); + } strtolower(value); server_cmd("agforceteamup #%d %s", get_user_userid(target), value); } else { @@ -1205,9 +1209,9 @@ public MatchManagerStartMatch(id) { } } CleanMenuData(); - server_cmd("agstart"); client_print(id, print_chat, "%l", "LLHL_MM_MATCH_IS_STARTING"); TrieIterDestroy(iterator); + set_task(0.1, "TaskMatchManagerAgstart", TASK_MM_START_MATCH); } else { client_print(id, print_chat, "%l", "LLHL_MM_INVALID_PLAYER_COUNT"); DisplayMatchManagerMenu(id); @@ -1215,6 +1219,10 @@ public MatchManagerStartMatch(id) { } } +public TaskMatchManagerAgstart() { + server_cmd("agstart"); +} + public MatchManagerAbortMatch(id) { if (gGameState == GAME_IDLE) { client_print(id, print_chat, "%l", "LLHL_MM_MATCH_IS_IDLE");