How can i make executive promote to 99999 max
#1

I got 2 ranks who can /makeadmin - Community DIRECTOR and Executive admins
i wanted to make Executives (99999) only promote to people Head admin (1337) maximum and Community Directors can promote max to 100000 How?
pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 99999)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            level = strvalEx(tmp);
            if(level > 100000 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Don't go below number 0, or above number 100000 !"); return 1; }
            if(IsPlayerConnected(para1))
            {
                if(para1 != INVALID_PLAYER_ID)
                {
                    strmid(giveplayer, PlayerRPName(para1), 0, MAX_PLAYER_NAME);
                    strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
                    if(level < 2) PlayerInfo[para1][pTag] = NTAG_PLAYER;
                    else PlayerInfo[para1][pTag] = NTAG_ADMIN;

                    if(PlayerInfo[para1][pAdmin] > PlayerInfo[playerid][pAdmin])
                    {
                        SendClientMessage(playerid, COLOR_GREY,  "That admin has a higher rank than you.");
                        return 1;
                    }
                    if(para1 == playerid)
                    {

                        SendClientMessage(playerid, COLOR_GREY, "   You can't adjust your admin rank.");
                        return 1;
                    }
                    if(level > 0)
                    {
                        new rand = random(9999);
                        PlayerInfo[para1][pSecKey] = rand;
                        gAdminAuthorized[para1] = 1;
                    }

                    if(level > PlayerInfo[para1][pAdmin])
                    {
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                    else
                    {
                        format(string, sizeof(string), "   You have been demoted to a level %d admin by %s, your security key is %d.", level, sendername, PlayerInfo[para1][pSecKey]);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have demoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }

                    PlayerInfo[para1][pAdmin] = level;

                    if(level < 1)
                    {
                        PlayerInfo[para1][pAdmin] = 0;
                        PlayerInfo[para1][pSecKey] = 0;
                        gAdminAuthorized[para1] = 0;
                    }
                }
            }
        }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)