From 277da2945a1064d4ab0d709b16d9266434239016 Mon Sep 17 00:00:00 2001 From: neon <> Date: Wed, 21 Nov 2018 00:25:15 +0100 Subject: [PATCH] VIPMode: select new VIP when old one goes to spec --- VIPMode/scripting/VIPMode.sp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/VIPMode/scripting/VIPMode.sp b/VIPMode/scripting/VIPMode.sp index ed911da2..9c957943 100644 --- a/VIPMode/scripting/VIPMode.sp +++ b/VIPMode/scripting/VIPMode.sp @@ -3,6 +3,7 @@ #include #include #include +#include #include int g_iVIPClient = -1; @@ -119,7 +120,21 @@ public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast) if(client == g_iVIPClient) { - g_iVIPClient = -1; - PerformVIPSelection(true); + g_iVIPClient = -1; + RequestFrame(RequestFrame_Callback); } +} + +public void OnPlayerSwitchedToSpectateByCommand(int client) +{ + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + RequestFrame(RequestFrame_Callback); + } +} + +void RequestFrame_Callback(int iPacked) +{ + PerformVIPSelection(true); } \ No newline at end of file