29.04.2012, 10:29
pawn Код:
CMD:setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0;
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-1338]");//it will show this if you dont use the format properly
if(levels > 1338) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-1338!");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");
if(PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playerid,COLOR_RED, "ERROR: That person is already this admin level!");
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
GetPlayerName(ID,pname,MAX_PLAYER_NAME);
if(levels == 0)
{
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,COLOR_GREEN,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,COLOR_GREEN,str);
PlayerInfo[ID][pAdmin] = levels;
return 1;
}
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,COLOR_GREEN,str);
PlayerInfo[ID][pAdmin] = levels;
return 1;
}