Code:
#include <PTaH>
#include <multicolors>
public Plugin myinfo =
{
name = "Test version",
author = "Nano",
description = "Test version.",
version = "2.0",
url = "Discord: nano#7638"
}
public void OnPluginStart()
{
PTaH(PTaH_ClientConnectPre, Hook, Hook_OnClientConnect);
}
Action Hook_OnClientConnect(int iAccountID, const char[] sIP, const char[] sName, char sPassword[128], char sRejectReason[255])
{
if(GetClientCount(false) < (GetMaxHumanPlayers() - 1))
{
return Plugin_Continue;
}
char sSteamID[64];
FormatEx(sSteamID, sizeof sSteamID, "STEAM_1:%u:%u", iAccountID & 1, iAccountID >>> 1);
if(FindAdminByIdentity(AUTHMETHOD_STEAM, sSteamID) != INVALID_ADMIN_ID)
{
int g_KickList[MAXPLAYERS + 1], iKickCount = 0;
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i) && !GetUserFlagBits(i))
{
char sClient[32];
GetClientName(i, sClient, 31);
KickClient(i, "You were kicked because a VIP joined.\nIf you want to be immune to this, buy VIP.");
CPrintToChatAll("{green}[ReservedSlot]{lightblue} %s{default} were kicked because a VIP {green}joined.", sClient);
return Plugin_Continue;
}
g_KickList[iKickCount++] = i;
}
}
else
{
sRejectReason = "Server is full!\nPlease, try to join later\nor buy VIP to be immune.";
return Plugin_Handled;
}
return Plugin_Continue;
}