/admins - command problem
#4

Problem is mate you've put the 'no admin' handler inside the loop - example, when the loop starts from player 0 if he isn't administrator it terminates because of the return. Always let the loop finish, unless you've found what you have looked for i guess?

pawn Код:
CMD:admins(playerid)
{
    new count, PlayerName[MAX_PLAYER_NAME], rankname[32], color[100];
    new list1[900];
    strcat(list1, "{FFFFFF}NO\t{FFFFFF}Name(ID)\t{FFFFFF}Level\n");
    foreach(Player, i)
    {
        if(playerData[i][playerLevel] > 0)
        {
            GetPlayerName(i, PlayerName, sizeof(PlayerName));
            switch(playerData[i][playerLevel])
            {
                case 1: { rankname = "{FFFFFF}LEVEL 1"; }
                case 2: { rankname = "{FFFFFF}LEVEL 2"; }
                case 3: { rankname = "{FFFFFF}LEVEL 3"; }
                case 4: { rankname = "{FFFFFF}LEVEL 4"; }
                case 5: { rankname = "{FFFFFF}LEVEL 5"; }
                case 6: { rankname = "{FFFFFF}LEVEL 6"; }
                case 7: { rankname = "{FFFFFF}LEVEL 7"; }
                case 8: { rankname = "{FFFFFF}LEVEL 8"; }
            }
            if(playerData[i][playerAdminDuty] == true)
            {
                color = "{FF0770}"; // pink
            }
            else color = "{C0C0C0}"; //grey
            format(list1, sizeof(list1), "%s\n%d\t%s%s(%d)\t%s\n", list1, count + 1,color, PlayerName, i, rankname);
            count++;
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, -1, "There are no administrators online.");
        return true;
    }
    ShowPlayerDialog(playerid, 555, DIALOG_STYLE_TABLIST_HEADERS, "Online Admins",list1, "Close", "");
    return 1;
}
Reply


Messages In This Thread
/admins - command problem - by Hammad123 - 16.02.2019, 09:19
Re: /admins - command problem - by Hammad123 - 16.02.2019, 17:43
Re: /admins - command problem - by DarkBr - 16.02.2019, 18:21
Re: /admins - command problem - by d3ll - 16.02.2019, 22:07
Re: /admins - command problem - by d3Pedro - 16.02.2019, 23:57
Re: /admins - command problem - by Hammad123 - 17.02.2019, 10:08
Re: /admins - command problem - by TheToretto - 17.02.2019, 10:57
Re: /admins - command problem - by Hammad123 - 18.02.2019, 13:27
Re: /admins - command problem - by Hammad123 - 19.02.2019, 13:15
Re: /admins - command problem - by Hammad123 - 20.02.2019, 13:22

Forum Jump:


Users browsing this thread: 2 Guest(s)