11.07.2010, 02:46
Sure,
/ban using dcmd and sscanff
just made it my self :/
/ban using dcmd and sscanff
pawn Код:
dcmd_ban(playerid,params[])
{
new Reason[256], pID;
if(PlayerInfo[playerid][pAdminLevel] < 3)
{
return SendClientMessage(playerid,COLOR_RED,"You need to be at least over Admin level 3 to use this command.");
}
if(sscanf(params,"us",pID,Reason))
{
return SendClientMessage(playerid,COLOR_RED,"USAGE: /ban [playerid] [reason]");
}
if(!IsPlayerConnected(pID))
{
return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
}
if(PlayerInfo[playerid][pAdminLevel] < PlayerInfo[pID][pAdminLevel])
{
return SendClientMessage(playerid,COLOR_RED,"You can't use this command on a high ranked admin");
}
if(pID == playerid)
{
SendClientMessage(playerid,COLOR_RED,"You cannot ban yourself.");
return 1;
}
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(pID,name,sizeof(name));
new Aname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Aname,sizeof(Aname));
format(string,sizeof(string)," %s has banned %s with the reason: %s",Aname,name,Reason[0] ? Reason : "<No Reason>");
SendClientMessageToAll(COLOR_GREEN,string);
Ban(pID);
return 1;
}