Admin Rank code! Error
#3

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;
}
Reply


Messages In This Thread
Admin Rank code! Error - by CallumDaBest - 06.02.2014, 20:23
Re: Admin Rank code! Error - by ross8839 - 06.02.2014, 20:32
Re: Admin Rank code! Error - by Ari - 06.02.2014, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)