From 8684bac296fef61d2524114afb6426d983590d25 Mon Sep 17 00:00:00 2001 From: dogan Date: Sat, 26 Sep 2020 15:24:17 +0200 Subject: [PATCH] VIPMode: smaller adjustements --- _VIPMode/scripting/VIPMode.sp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/_VIPMode/scripting/VIPMode.sp b/_VIPMode/scripting/VIPMode.sp index 9bba9318..17d88096 100644 --- a/_VIPMode/scripting/VIPMode.sp +++ b/_VIPMode/scripting/VIPMode.sp @@ -84,12 +84,18 @@ public void PerformVIPSelection(bool reselect) { if(IsFakeClient(client)) continue; - + PotentialVIPClient[PotentialVIPCount] = client; PotentialVIPCount++; } } + if(PotentialVIPCount < 1) + { + CPrintToChatAll("{purple}VIP Mode:{red} Couldn't find a valid client to set as VIP. Aborting on this round.", g_iVIPClient); + return; + } + g_iVIPClient = PotentialVIPClient[GetRandomInt(0, PotentialVIPCount - 1)]; CPrintToChatAll("{purple}VIP Mode:{red} {white}%N{red} is the current VIP! Protect him.", g_iVIPClient); @@ -120,19 +126,22 @@ public Action PerformAdminVIPSelection(int client, int args) { if (IsClientInGame(player) && IsPlayerAlive(player) && ZR_IsClientHuman(player)) { - if(IsFakeClient(client)) + if(IsFakeClient(player)) continue; - + PotentialVIPClient[PotentialVIPCount] = player; PotentialVIPCount++; } } + g_iVIPClient = PotentialVIPClient[GetRandomInt(0, PotentialVIPCount - 1)]; - CPrintToChatAll("{purple}VIP Mode:{red} {white}%N{red} is the current VIP! Protect him.", g_iVIPClient); + ReplyToCommand(client, "[SM] You have randomly chosen another VIP."); + PrintToChatAll("[SM] %N randomly chose another VIP!", client); - CReplyToCommand(client, "{purple}VIP Mode:{red} You have randomly chosen another VIP."); + CPrintToChatAll("{purple}VIP Mode:{red} {white}%N{red} is the current VIP! Protect him.", g_iVIPClient); } + return Plugin_Handled; }