From 3db6438022916f8e9a6023ab3070530fd9d311c9 Mon Sep 17 00:00:00 2001 From: DoganGFL Date: Wed, 21 Nov 2018 00:03:26 +0100 Subject: [PATCH] small update --- VIPMode/scripting/VIPMode.sp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/VIPMode/scripting/VIPMode.sp b/VIPMode/scripting/VIPMode.sp index 4a552bca..ed911da2 100644 --- a/VIPMode/scripting/VIPMode.sp +++ b/VIPMode/scripting/VIPMode.sp @@ -21,6 +21,7 @@ public void OnPluginStart() HookEvent("player_death", OnPlayerDeath); HookEvent("round_start", OnRoundStart); HookEvent("round_end", OnRoundEnd); + HookEvent("player_team", OnPlayerTeam); RegConsoleCmd("sm_currentvip", WhoIsVIP); } @@ -42,7 +43,7 @@ public Action WhoIsVIP(int client, int args) public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) { g_iVIPClient = -1; - CreateTimer(30.5, SelectVIP, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); + CreateTimer(15.0, SelectVIP, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); } public Action OnRoundEnd(Event event, const char[] name, bool dontBroadcast) @@ -110,4 +111,15 @@ public void OnClientDisconnect(int client) g_iVIPClient = -1; PerformVIPSelection(true); } +} + +public Action OnPlayerTeam(Event event, const char[] name, bool dontBroadcast) +{ + int client = GetClientOfUserId(GetEventInt(event, "userid")); + + if(client == g_iVIPClient) + { + g_iVIPClient = -1; + PerformVIPSelection(true); + } } \ No newline at end of file