23.12.2012, 19:21
This should work if you are RCON Admin.
pawn Код:
CMD:ban(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR] Only admins can use this command. Use /help.");
new PID; //define the playerid we wanna ban
new reason[64]; //the reason, put into a string
if(sscanf(params, "us[64]", PID, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /ban [playerid] [reason]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR] The player is not connected!");
new str[128]; //a new message string max 128
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
format(str, sizeof(str), "[BAN] '%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SendClientMessageToAll(COLOR_ACHIEVEMENT, str);
Ban(PID);
return 1;
}