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
This commit is contained in:
Resxt 2023-01-28 21:38:00 +01:00
parent 241dd8458c
commit 0b23b5780a

View File

@ -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_maprotationcurrent", "gametype " + modeName + " map " + mapName);
SetDvar("sv_maprotation", "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 else // custom games
{ {