From 75484c02a096ae3284c7ffb6937248ae381ae26f Mon Sep 17 00:00:00 2001 From: stickz Date: Fri, 27 Nov 2015 12:51:38 -0500 Subject: [PATCH] Add CheckHiddenSlots() Function --- plugins/reservedslots.sp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/plugins/reservedslots.sp b/plugins/reservedslots.sp index 5b296e04..71d100e3 100644 --- a/plugins/reservedslots.sp +++ b/plugins/reservedslots.sp @@ -85,18 +85,12 @@ public OnPluginEnd() public OnMapStart() { - if (sm_hide_slots.BoolValue) - { - SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue); - } + CheckHiddenSlots(); } public OnConfigsExecuted() { - if (sm_hide_slots.BoolValue) - { - SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue); - } + CheckHiddenSlots(); } public Action:OnTimedKick(Handle:timer, any:client) @@ -108,10 +102,7 @@ public Action:OnTimedKick(Handle:timer, any:client) KickClient(client, "%T", "Slot reserved", client); - if (sm_hide_slots.BoolValue) - { - SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue); - } + CheckHiddenSlots(); return Plugin_Handled; } @@ -198,10 +189,7 @@ public OnClientPostAdminCheck(client) public OnClientDisconnect_Post(client) { - if (sm_hide_slots.BoolValue) - { - SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue); - } + CheckHiddenSlots(); if (g_isAdmin[client]) { @@ -237,6 +225,14 @@ public SlotHideChanged(ConVar convar, const String:oldValue[], const String:newV } } +CheckHiddenSlots() +{ + if (sm_hide_slots.BoolValue) + { + SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue); + } +} + SetVisibleMaxSlots(clients, limit) { new num = clients;