27.09.2012, 17:39
Thanks for trying to help me here is a kick command
pawn Код:
COMMAND:kick(playerid,params[])
{
if(PlayerInfo[playerid][AdminLevel] >= LEVEL_kick)
{
new player, reason[128];
if(sscanf(params, "rs[128]", player, reason))
{
SendClientMessage(playerid, WHITE,"{FFFF00}Usage: /kick [PlayerID/PartOfName] [Reason]");
return 1;
}
if(PlayerInfo[player][AdminLevel] == MAX_ADMIN_LEVEL)
{
SendClientMessage(playerid, WHITE,"{FF0000}>> You cannot use this command on this admin");
return 1;
}
if(player == playerid)
{
SendClientMessage(playerid, WHITE, "{FF0000}>> You cannot kick yourself");
return 1;
}
if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID && player != playerid && PlayerInfo[player][AdminLevel] != MAX_ADMIN_LEVEL)
{
new string[128];
format(string,sizeof(string),"** %s has been kicked from the server [Reason: %s]",GetName(player),reason);
SendClientMessageToAll(GREY,string);
print(string);
PlayerInfo[player][KickCount]++;
#if PRINT_BYKICK == true
printf("[KICK]: %s has been kicked", GetName(playerid));
#endif
Kick(player);
}
else
{
SendClientMessage(playerid, WHITE, "{FF0000}>> Player is not connected or is yourself or is the highest level admin");
}
}
else
{
SendClientMessage(playerid, WHITE, NO_PERM);
}
return 1;
}