From b4b79d21597a876f9ff5956f090f4960b7f2a1f6 Mon Sep 17 00:00:00 2001 From: rtldg <55846624+rtldg@users.noreply.github.com> Date: Tue, 11 Jan 2022 10:01:47 +0000 Subject: [PATCH] update topleft on when changing spectatee --- addons/sourcemod/scripting/shavit-hud.sp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/sourcemod/scripting/shavit-hud.sp b/addons/sourcemod/scripting/shavit-hud.sp index d28ea9ad..b1c0939b 100644 --- a/addons/sourcemod/scripting/shavit-hud.sp +++ b/addons/sourcemod/scripting/shavit-hud.sp @@ -244,6 +244,10 @@ public void OnPluginStart() RegConsoleCmd("sm_truvel", Command_TrueVel, "Toggles 2D ('true') velocity. (alias for sm_truevel)"); RegConsoleCmd("sm_2dvel", Command_TrueVel, "Toggles 2D ('true') velocity. (alias for sm_truevel)"); + AddCommandListener(Command_SpecNextPrev, "spec_player"); + AddCommandListener(Command_SpecNextPrev, "spec_next"); + AddCommandListener(Command_SpecNextPrev, "spec_prev"); + // cookies gH_HUDCookie = RegClientCookie("shavit_hud_setting", "HUD settings", CookieAccess_Protected); gH_HUDCookieMain = RegClientCookie("shavit_hud_settingmain", "HUD settings for hint text.", CookieAccess_Protected); @@ -559,6 +563,22 @@ void ToggleHUD(int client, int hud, bool chat) } } +void Frame_UpdateTopLeftHUD(int serial) +{ + int client = GetClientFromSerial(serial); + + if (client) + { + UpdateTopLeftHUD(client, false); + } +} + +public Action Command_SpecNextPrev(int client, const char[] command, int args) +{ + RequestFrame(Frame_UpdateTopLeftHUD, GetClientSerial(client)); + return Plugin_Continue; +} + public Action Command_Master(int client, int args) { ToggleHUD(client, HUD_MASTER, true);