From cf1299454a2f7b71b2a6a109ba5466477f3eafad Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Sun, 27 Dec 2020 21:56:23 +0100 Subject: [PATCH] ReservedSlots: give non-donators a chance to join a team before getting kicked --- ReservedSlot/scripting/ReservedSlot.sp | 30 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ReservedSlot/scripting/ReservedSlot.sp b/ReservedSlot/scripting/ReservedSlot.sp index 7370b716..32fc6036 100644 --- a/ReservedSlot/scripting/ReservedSlot.sp +++ b/ReservedSlot/scripting/ReservedSlot.sp @@ -156,8 +156,8 @@ public void AsyncHasSteamIDReservedSlotCallback(const char[] sSteam32ID, int Res stock bool KickValidClient(const char[] sName, const char[] sSteam32ID, AdminId admin, int Immunity) { - int HighestValue[3] = {-1, ...}; - int HighestValueClient[3] = {0, ...}; + int HighestValue[4] = {-1, ...}; + int HighestValueClient[4] = {0, ...}; for(int client = 1; client <= MaxClients; client++) { @@ -180,11 +180,11 @@ stock bool KickValidClient(const char[] sName, const char[] sSteam32ID, AdminId #endif /* Spectators - * Sort by idle time and also kick donators if IdleTime > 30 + * Sort by idle time and kick non-donators if IdleTime > 10 */ if(GetClientTeam(client) <= CS_TEAM_SPECTATOR) { - if(!Donator || IdleTime > 30) + if(!Donator && IdleTime > 10) { if(IdleTime > HighestValue[0]) { @@ -193,6 +193,20 @@ stock bool KickValidClient(const char[] sName, const char[] sSteam32ID, AdminId } } } + /* Spectators + * Sort by idle time and also kick donators if IdleTime > 30 + */ + if(GetClientTeam(client) <= CS_TEAM_SPECTATOR) + { + if(Donator && IdleTime > 30) + { + if(IdleTime > HighestValue[0]) + { + HighestValue[1] = IdleTime; + HighestValueClient[1] = client; + } + } + } /* Spectators */ /* Dead non-donator with IdleTime > 30 @@ -202,8 +216,8 @@ stock bool KickValidClient(const char[] sName, const char[] sSteam32ID, AdminId { if(IdleTime > 30 && IdleTime > HighestValue[1]) { - HighestValue[1] = IdleTime; - HighestValueClient[1] = client; + HighestValue[2] = IdleTime; + HighestValueClient[2] = client; } } /* Dead non-donator with IdleTime > 30 */ @@ -215,8 +229,8 @@ stock bool KickValidClient(const char[] sName, const char[] sSteam32ID, AdminId { if(IdleTime > 30 && IdleTime > HighestValue[2]) { - HighestValue[2] = IdleTime; - HighestValueClient[2] = client; + HighestValue[3] = IdleTime; + HighestValueClient[3] = client; } } /* Alive non-donator with IdleTime > 30 */