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