Fixed a million bugs in reserved slots plugin - should be perfect now (I hope)
Finalized KickClient native --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401004
This commit is contained in:
parent
58eedf6226
commit
db83c8e2d9
@ -933,9 +933,7 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (pPlayer->IsFakeClient())
|
||||
{
|
||||
char kickcmd[64];
|
||||
|
||||
/* :TODO: Define BotKickCmd in core.games.txt so that "bot_kick" can be used in CS:S */
|
||||
char kickcmd[40];
|
||||
UTIL_Format(kickcmd, sizeof(kickcmd), "kick %s\n", pPlayer->GetName());
|
||||
|
||||
engine->ServerCommand(kickcmd);
|
||||
|
@ -59,7 +59,7 @@ public OnConfigsExecuted()
|
||||
{
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetConVarInt(sv_visiblemaxplayers, g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,11 +73,11 @@ public OnClientAuthorized(client, const String:auth[])
|
||||
new limit = g_MaxClients - reserved;
|
||||
new flags = GetUserFlagBits(client);
|
||||
|
||||
if (flags & ADMFLAG_ROOT || flags & ADMFLAG_RESERVATION || clients <= limit)
|
||||
if (clients <= limit || IsFakeClient(client) || flags & ADMFLAG_ROOT || flags & ADMFLAG_RESERVATION)
|
||||
{
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetConVarInt(sv_visiblemaxplayers, (clients == g_MaxClients) ? g_MaxClients : ++limit);
|
||||
SetVisibleMaxSlots(clients, limit);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -88,13 +88,24 @@ public OnClientAuthorized(client, const String:auth[])
|
||||
}
|
||||
}
|
||||
|
||||
public OnClientDisconnect(client)
|
||||
public OnClientDisconnect_Post(client)
|
||||
{
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
new clients = GetClientCount(false);
|
||||
new limit = g_MaxClients - GetConVarInt(sm_reserved_slots);
|
||||
|
||||
SetConVarInt(sv_visiblemaxplayers, (clients == g_MaxClients) ? g_MaxClients : limit);
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
}
|
||||
|
||||
SetVisibleMaxSlots(clients, limit)
|
||||
{
|
||||
new num = clients + 1;
|
||||
|
||||
if (clients == g_MaxClients || clients > limit)
|
||||
{
|
||||
num = g_MaxClients;
|
||||
} else if (clients < limit) {
|
||||
num = limit;
|
||||
}
|
||||
|
||||
SetConVarInt(sv_visiblemaxplayers, num);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user