From 0b23b5780ac20ebd6e99bf3379bc6e34c39f3bb3 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:38:00 +0100 Subject: [PATCH] mapvote 1.0.3 Destroy HUDs once the timer runs out The mapvote HUDs used to stay until the map rotated which as a result would display the mapvote HUDs even when the timer had run out and the game was trying to only display the scoreboard to have a clean post game screen. It would also unnecessarily allow players to still use the menu although the vote was already ended --- mapvote/mapvote.gsc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/mapvote/mapvote.gsc b/mapvote/mapvote.gsc index 2be9101..ce51d4f 100644 --- a/mapvote/mapvote.gsc +++ b/mapvote/mapvote.gsc @@ -406,7 +406,7 @@ CreateVoteMenu() } } - player CreateHudText(buttonsHelpMessage, level.mapvote_hud_font, level.mapvote_hud_fontscale, "CENTER", "CENTER", 0, 210); + player.mapvote["help_message_hud"] = player CreateHudText(buttonsHelpMessage, level.mapvote_hud_font, level.mapvote_hud_fontscale, "CENTER", "CENTER", 0, 210); } } @@ -686,6 +686,29 @@ DoRotation(modeName, mapName) { SetDvar("sv_maprotationcurrent", "gametype " + modeName + " map " + mapName); SetDvar("sv_maprotation", "gametype " + modeName + " map " + mapName); + + types = ["map", "mode"]; + + foreach (type in types) + { + foreach (index in GetArrayKeys(level.mapvote["hud"][type + "s"])) + { + level.mapvote["hud"][type + "s"][index] destroy(); + } + } + + foreach (player in GetHumanPlayers()) + { + foreach (type in types) + { + foreach (index in GetArrayKeys(player.mapvote[type])) + { + player.mapvote[type][index]["hud"] destroy(); + } + } + + player.mapvote["help_message_hud"] destroy(); + } } else // custom games {