28.11.2013, 22:32
pawn Код:
CMD:setlevel(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new pID,level;
if(sscanf(params,"dd",pID,level)) SendClientMessage(playerid,COLOR_WHITE,"USAGE: /setlevel [playerid] [level]");
else if(!IsPlayerConnected(pID)) SendClientMessage(playerid,COLOR_GREY,"Player is not connected.");
else if(pInfo[pID][AdminLevel] > pInfo[playerid][AdminLevel]) SendClientMessage(playerid,COLOR_WHITE,"You can't use this command on your colleauge");
else if(!(0 < level < 6)) SendClientMessage(playerid,COLOR_WHITE,"invalid level 1-5");
else{
new rank[35];
switch(level)
{
case 1: rank = "{FF8800}Server Moderator {FFFFFF}";
case 2: rank = "{0000FF}Global Moderator {FFFFFF}";
case 3: rank = "{FF0000}Admin {40FF00}";
case 4: rank = "{40FF00}Super Admin {FFFFFF}";
default: rank = "{40FF00}Head Admin {FFFFFF}";
}
if(pInfo[pID][AdminLevel] > level)
format(string,sizeof(string),"%s has been demoted to %s by "SERVER_NAME" management.",pID,rank);
else
format(string,sizeof(string),"%s has been promoted to %s by "SERVER_NAME" management.",pID,rank);
SendClientMessageToAll(COLOR_WHITE,string);
pInfo[pID][AdminLevel] = level;
}
return 1;
}