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; }