如题,修复服务器人满后仍然有玩家可以通过控制台连接的问题
public void OnClientConnected(int client)
{
int limit = GetMaxHumanPlayers();
int count = GetClientCount(false);
if (count > limit)
{
SafeKickClient(client, "服务器已满");
}
}
static void SafeKickClient(int client, const char[] message)
{
if (!IsClientInKickQueue(client))
{
KickClient(client, "%s", message);
}
}