29.12.2011, 05:43
pawn Код:
CMD:setadmin(playerid, params[])
{
new id, level, string[128];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 3)
{
if(!sscanf(params,"ui", id, level))
{
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID)
{
if(level >= 0 && level <= 5)
{
if(PlayerInfo[playerid][pAdmin] > PlayerInfo[id][pAdmin])
{
if(level != PlayerInfo[id][pAdmin])
{
format(string, sizeof(string),"Admin %s have set your admin rank to level %d.", GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string ,sizeof(string),"[Name: %s | Old Rank: %d | New Rank: %d]", GetName(id), PlayerInfo[id][pAdmin], level);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Rank "GREEN"Succesfully "LIGHTBLUE"updated(Changed).");
PlayerInfo[id][pAdmin] = level;
}
else SendClientMessage(playerid, ERROR,"The player is already that level administrator.");
}
else SendClientMessage(playerid, ERROR,"You cannot promote/demote a higher level admin than you.");
}
else SendClientMessage(playerid, ERROR,"Levels are only from 0 - 5");
}
else SendClientMessage(playerid, ERROR,"Invalid Player.");
}
else SendClientMessage(playerid, ERROR,"Usage: /setadmin [playerid] [level]");
}
else SendClientMessage(playerid, ERROR,"You are not authorized to use that command.");
return 1;
}
And i want to add this thing in this that if a player increases the level then it should say Promoted and if level < and then it says Demoted.