summaryrefslogtreecommitdiff
path: root/source/sourcemod/scripting/gokz-hud/menu.sp
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
committeraura <nw@moneybot.cc>2026-02-17 23:42:09 +0100
commit5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch)
tree054acff1113270a9cd07933df760f3768c1b6853 /source/sourcemod/scripting/gokz-hud/menu.sp
parent341db13a008dc12bb22ceb50452d93d01476308c (diff)
move source stuff to its own folder
Diffstat (limited to 'source/sourcemod/scripting/gokz-hud/menu.sp')
-rw-r--r--source/sourcemod/scripting/gokz-hud/menu.sp96
1 files changed, 96 insertions, 0 deletions
diff --git a/source/sourcemod/scripting/gokz-hud/menu.sp b/source/sourcemod/scripting/gokz-hud/menu.sp
new file mode 100644
index 0000000..4b7259e
--- /dev/null
+++ b/source/sourcemod/scripting/gokz-hud/menu.sp
@@ -0,0 +1,96 @@
+/*
+ Tracks whether a GOKZ HUD menu or panel element is being shown to the client.
+*/
+
+
+
+// Update the TP menu i.e. item text, item disabled/enabled
+void CancelGOKZHUDMenu(int client)
+{
+ // Only cancel the menu if we know it's the TP menu
+ if (gB_MenuShowing[client])
+ {
+ CancelClientMenu(client);
+ }
+}
+
+
+
+// =====[ EVENTS ]=====
+
+void OnPlayerSpawn_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnOptionChanged_Menu(int client, HUDOption option)
+{
+ if (option == HUDOption_TPMenu || option == HUDOption_TimerText)
+ {
+ CancelGOKZHUDMenu(client);
+ }
+}
+
+void OnTimerStart_Menu(int client)
+{
+ // Prevent the menu from getting cancelled every tick if player use start timer button zone.
+ if (GOKZ_GetTime(client) > 0.0)
+ {
+ CancelGOKZHUDMenu(client);
+ }
+}
+
+void OnTimerEnd_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnTimerStopped_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnPause_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnResume_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnMakeCheckpoint_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnCountedTeleport_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnJoinTeam_Menu(int client)
+{
+ CancelGOKZHUDMenu(client);
+}
+
+void OnStartPositionSet_Menu(int client)
+{
+ // Prevent the menu from getting cancelled every tick if player use start timer button zone.
+ if (GOKZ_GetTime(client) > 0.0)
+ {
+ CancelGOKZHUDMenu(client);
+ }
+}
+
+void OnPluginEnd_Menu()
+{
+ for (int client = 1; client <= MaxClients; client++)
+ {
+ if (IsValidClient(client))
+ {
+ CancelGOKZHUDMenu(client);
+ }
+ }
+} \ No newline at end of file