From 1f04ba166a5bfe91351093478071501dd6648693 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 18 Aug 2007 22:51:25 +0000 Subject: [PATCH] fixed bug amb795 - reservedslots could crash --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401357 --- plugins/reservedslots.sp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/reservedslots.sp b/plugins/reservedslots.sp index b2ecc0d1..4f207659 100644 --- a/plugins/reservedslots.sp +++ b/plugins/reservedslots.sp @@ -74,6 +74,20 @@ public OnConfigsExecuted() } } +public Action:OnTimedKick(Handle:timer, any:value) +{ + new client = GetClientOfUserId(value); + + if (!client || !IsClientInGame(client)) + { + return Plugin_Handled; + } + + KickClient(client, "%T", "Slot reserved", client); + + return Plugin_Handled; +} + public OnClientPostAdminCheck(client) { new reserved = GetConVarInt(sm_reserved_slots); @@ -95,7 +109,7 @@ public OnClientPostAdminCheck(client) } /* Kick player because there are no public slots left */ - KickClient(client, "%T", "Slot reserved", client); + CreateTimer(0.1, OnTimedKick, GetClientUserId(client)); } }