Just a small question
#1

If it is possible, how can i make this from lowest admin level to highest
pawn Код:
CMD:admins(playerid, params[])
    {
        new OnAdmins = 0;
        SCM(playerid,-1,"-----------------------------------Admins Online-----------------------------------");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerData[i][AdminLevel] != 0 && hide[i] == 0)
                {
                    GetPlayerName(i,Nam,MAX_PLAYER_NAME);
                    if(PlayerData[i][AdminLevel] == 1)
                    {
                        format(str, sizeof(str), "%s level 1 (Server Moderator)",Nam);
                        SCM(playerid,COLOR_YELLOW,str);
                    }
                    if(PlayerData[i][AdminLevel] == 2)
                    {
                        format(str, sizeof(str), "%s level 2 (Global Moderator)",Nam);
                        SCM(playerid,COLOR_BLUE,str);
                    }
                    if(PlayerData[i][AdminLevel] == 3)
                    {
                        format(str, sizeof(str), "%s level 3 (Administrator)",Nam);
                        SCM(playerid,red,str);
                    }
                    if(PlayerData[i][AdminLevel] == 4)
                    {
                        format(str, sizeof(str), "%s level 4 (Lead Admin)",Nam);
                        SCM(playerid,COLOR_LIMEGREEN,str);
                    }
                    if(PlayerData[i][AdminLevel] == 5)
                    {
                        format(str, sizeof(str), "%s level 4 (Head Admin)",Nam);
                        SCM(playerid,COLOR_LIMEGREEN,str);
                    }
                    OnAdmins ++;
                }
            }
        }
        if(OnAdmins == 0)
        {
            SCM(playerid,0xFF0000FF,"No Admins are connected in the server.");
        }
        if(OnAdmins == 1)
        {
            format(str,sizeof(str),"There is only %d admin connected right now!",OnAdmins);
            SCM(playerid,orange,str);
        }
        if(OnAdmins > 1)
        {
            format(str,sizeof(str),"There are %d admins connected right now!",OnAdmins);
            SCM(playerid,orange,str);
        }
        return 1;
    }
Reply
#2

Not sure.
pawn Код:
CMD:admins(playerid, params[])
{
    new OnAdmins = 0;
    SCM(playerid,-1,"-----------------------------------Admins Online-----------------------------------");
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            if(PlayerData[i][AdminLevel] != 0 && hide[i] == 0) {
                GetPlayerName(i,Nam,MAX_PLAYER_NAME);
                if(PlayerData[i][AdminLevel] == 5) {
                    format(str, sizeof(str), "%s level 5 (Head Admin)",Nam);
                    SCM(playerid,COLOR_YELLOW,str);
                }
                if(PlayerData[i][AdminLevel] == 4) {
                    format(str, sizeof(str), "%s level 4 (Lead Admin)",Nam);
                    SCM(playerid,COLOR_BLUE,str);
                }
                if(PlayerData[i][AdminLevel] == 3) {
                    format(str, sizeof(str), "%s level 3 (Administrator)",Nam);
                    SCM(playerid,red,str);
                }
                if(PlayerData[i][AdminLevel] == 2) {
                    format(str, sizeof(str), "%s level 2 (Global Moderator)",Nam);
                    SCM(playerid,COLOR_LIMEGREEN,str);
                }
                if(PlayerData[i][AdminLevel] == 1) {
                    format(str, sizeof(str), "%s level 1 (Server Moderator)",Nam);
                    SCM(playerid,COLOR_LIMEGREEN,str);
                }
                OnAdmins ++;
            }
        }
    }
    if(OnAdmins == 0) {
        SCM(playerid,0xFF0000FF,"No Admins are connected in the server.");
    }
    if(OnAdmins == 1) {
        format(str,sizeof(str),"There is only %d admin connected right now!",OnAdmins);
        SCM(playerid,orange,str);
    }
    if(OnAdmins > 1) {
        format(str,sizeof(str),"There are %d admins connected right now!",OnAdmins);
        SCM(playerid,orange,str);
    }
    return 1;
}
Reply
#3

that doesnt order
Reply
#4

You'll need to loop through all the players a few times.

This will take alot longer than a singular loop, keep that in mind.

pawn Код:
for(new one=0; one<MAX_PLAYERS; one++)
{
    if(PlayerData[one][AdminLevel] == 1)
    {
        GetPlayerName(one,Nam,MAX_PLAYER_NAME);
        format(str, sizeof(str), "| %s >  Moderator (Level 1)",Nam);
        SCM(playerid,COLOR_YELLOW,str);
    }
}
for(new two=0; two<MAX_PLAYERS; two++)
{
    if(PlayerData[two][AdminLevel] == 2)
    {
        GetPlayerName(two,Nam,MAX_PLAYER_NAME);
        format(str, sizeof(str), "| %s >  Basic Admin (Level 2)",Nam);
        SCM(playerid,COLOR_YELLOW,str);
    }
}
for(new three=0; three<MAX_PLAYERS; three++)
{
    if(PlayerData[three][AdminLevel] == 3)
    {
        GetPlayerName(three,Nam,MAX_PLAYER_NAME);
        format(str, sizeof(str), "| %s >  Standard Admin (Level 3)",Nam);
        SCM(playerid,COLOR_YELLOW,str);
    }
}
for(new four=0; four<MAX_PLAYERS; four++)
{
    if(PlayerData[four][AdminLevel] == 4)
    {
        GetPlayerName(four,Nam,MAX_PLAYER_NAME);
        format(str, sizeof(str), "| %s >  Full Admin (Level 4)",Nam);
        SCM(playerid,COLOR_YELLOW,str);
    }
}
for(new five=0; five<MAX_PLAYERS; five++)
{
    if(PlayerData[five][AdminLevel] == 5)
    {
        GetPlayerName(five,Nam,MAX_PLAYER_NAME);
        format(str, sizeof(str), "| %s >  Head Admin (Level 5)",Nam);
        SCM(playerid,COLOR_YELLOW,str);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)