14.03.2011, 13:02
Use this:
Somewhere in your script:
pawn Код:
CMD:ban( playerid, params[ ] )
{
new ID, string[128], reason[66];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin.");
if(sscanf(params, "uS(No Reason Given)[65]", ID, reason)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /ban [PlayerID] [reason]");
if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID && ID != playerid)
{
format(string,sizeof(string), "You have been Banned by Administrator \"%s\" Reason: %s", pName(playerid),reason);
SendClientMessage(ID, 0x0259EAAA, string);
format(string, sizeof(string), "You have Banned \"%s\" Reason: %s", pName(ID), reason);
SendClientMessage(playerid, 0x0259EAAA , string);
format(string, sizeof(string), "Administrator \"%s\" has Banned \"%s\" Reason: %s",pName(playerid),pName(ID),reason);
SendClientMessageToAll( 0x0259EAAA , string );
TogglePlayerControllable(ID, false);
Ban(ID);
}
else return SendClientMessage(playerid, -1, "Player is not connected or is yourself");
return 1;
}
pawn Код:
stock pName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}