06.02.2014, 21:01
Using Hungarian Notation, code hasn't been tested because I don't have a copy of the NG-RP rip.
pawn Код:
CMD:makeadmin(playerid, params[])
{
new iTargetID, aLevel, szTargetName[MAX_PLAYER_NAME], szName[MAX_PLAYER_NAME], string[128];
if(sscanf(params, "ii", iTargetID, aLevel)) SendClientMessage(playerid, COL_GREY, "USAGE: /makeadmin [playerid] [level]");
GetPlayerName(playerid, szTargetName, sizeof(szTargetName));
GetPlayerName(iTargetID, szName, sizeof(szName));
if(PlayerInfo[playerid][pAdmin] < 99999) return SendClientMessage(playerid, -1, " You're not authorised to use this command!");
if(iTargetID = INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, " That player isn't connected!");
if(aLevel < 0 || > 99999) return SendClientMessage(playerid, -1, " You must specify an admin level between 0 and 99999.");
PlayerInfo[iTargetID][pAdmin] = aLevel;
printf("%s was promoted to %d level admin by %s", szName, aLevel, szTargetName);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", aLevel, szName);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", szTargetName, aLevel);
SendClientMessage(playerid, -1, string);
return 1;
}