25.07.2013, 10:08
pawn Код:
CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 9999) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
new iAdminValue, iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
if(!IsPlayerConnected(iTargetID) || iTargetID == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
if(PlayerInfo[iTargetID][pHelper] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make a Community Helper an Administrator!");
new szMessage[100];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
//Save Player's Stats here if necessary.
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}