Merge pull request #458 from stickz/patch-5
Move repeated code in reserved slots plugin to a helper function
This commit is contained in:
commit
b239430247
@ -85,18 +85,12 @@ public OnPluginEnd()
|
|||||||
|
|
||||||
public OnMapStart()
|
public OnMapStart()
|
||||||
{
|
{
|
||||||
if (sm_hide_slots.BoolValue)
|
CheckHiddenSlots();
|
||||||
{
|
|
||||||
SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnConfigsExecuted()
|
public OnConfigsExecuted()
|
||||||
{
|
{
|
||||||
if (sm_hide_slots.BoolValue)
|
CheckHiddenSlots();
|
||||||
{
|
|
||||||
SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action:OnTimedKick(Handle:timer, any:client)
|
public Action:OnTimedKick(Handle:timer, any:client)
|
||||||
@ -108,10 +102,7 @@ public Action:OnTimedKick(Handle:timer, any:client)
|
|||||||
|
|
||||||
KickClient(client, "%T", "Slot reserved", client);
|
KickClient(client, "%T", "Slot reserved", client);
|
||||||
|
|
||||||
if (sm_hide_slots.BoolValue)
|
CheckHiddenSlots();
|
||||||
{
|
|
||||||
SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -198,10 +189,7 @@ public OnClientPostAdminCheck(client)
|
|||||||
|
|
||||||
public OnClientDisconnect_Post(client)
|
public OnClientDisconnect_Post(client)
|
||||||
{
|
{
|
||||||
if (sm_hide_slots.BoolValue)
|
CheckHiddenSlots();
|
||||||
{
|
|
||||||
SetVisibleMaxSlots(GetClientCount(false), GetMaxHumanPlayers() - sm_reserved_slots.IntValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_isAdmin[client])
|
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)
|
SetVisibleMaxSlots(clients, limit)
|
||||||
{
|
{
|
||||||
new num = clients;
|
new num = clients;
|
||||||
|
Loading…
Reference in New Issue
Block a user