17.09.2012, 07:29
pawn Код:
if(Bit1_Get(g_PlayerBanned, playerid) == 1) return Ban(playerid);
EDIT: Same code just optimized.
pawn Код:
CMD:ban(playerid, params[])
{
new targetid, reason[128], name[MAX_PLAYER_NAME];
if(Bit16_Get(g_AdminLevel, playerid) > 0) return SCM(playerid, COL_RED, "You need to be an admin to use this command!");
if(sscanf(params, "us[128]", targetid, reason)) return SCM(playerid, COL_RED, "Usage: /ban <Playerid/Part of name> <Message>");
if(!IsPlayerConnected(targetid)) return SCM(playerid, COL_RED, "Player is offline.");
new string[128];
format(string, sizeof(string), "%s has been banned from the server", GetPlayerName(targetid, name, sizeof(name)));
SendClientMessageToAll(COL_RED, string);
Bit1_Set(g_PlayerBanned, targetid, 1);
Ban(targetid);
return 1;
}