Admins list dialog
#6

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
The above code should work, but there's no need to show the dialog inside the for loop (because the string isn't totally formatted yet), it should be right after the for loop. Here's your command and next time use [ pawn ] pawn code here [ /pawn ], please:

pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new count = 0;
    new string[128];
    new ChangeColor;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
            {
                if(AccInfo[i][Level] > 5)
                {
                    AdmRank = "Professional Admin";
                    ChangeColor = Color_Professional_Admin;
                }
                if(IsPlayerAdmin(i))
                {
                    AdmRank = "RCON Administrator";
                    ChangeColor = Color_RCON_Administrator;
                }
                else
                {
                    switch(AccInfo[i][Level])
                    {
                        case 1: {
                            AdmRank = "Basic Moderator";
                            ChangeColor = Color_Basic_Moderator;
                        }
                        case 2: {
                            AdmRank = "Moderator";
                            ChangeColor = Color_Moderator;
                        }
                        case 3: {
                            AdmRank = "Master Moderator";
                            ChangeColor = Color_Master_Moderator;
                        }
                        case 4: {
                            AdmRank = "Administrator";
                            ChangeColor = Color_Administrator;
                        }
                        case 5: {
                            AdmRank = "Master Administrator";
                            ChangeColor = Color_Master_Administrator;
                        }
                    }
                }
                switch(AccInfo[i][OnDuty])
                {
                    case 0: AdmDuty = "Playing!";
                    case 1: AdmDuty = "On Duty!";
                }
                format(string, sizeof(string), "%sLevel: %d - %s (Id:%i) | %s | %s\n", string, AccInfo[i][Level], PlayerName2(i),i,AdmRank,AdmDuty);
                count++;
            }
        }
    }
    if (count == 0)
        format(string, sizeof(string), "No Admins online!");
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Online Admins", str, "Ok", ""); // consider changing the dialog id
    return 1;
}
Oh yea, my bad.
It was suppose to go outside the loop.
Reply


Messages In This Thread
Admins list dialog - by [LoS]YoUnG_KiD - 23.08.2012, 14:02
Re: Admins list dialog - by ReVo_ - 23.08.2012, 14:54
Re: Admins list dialog - by [LoS]YoUnG_KiD - 24.08.2012, 04:07
Re: Admins list dialog - by Shetch - 24.08.2012, 04:15
Re: Admins list dialog - by [KHK]Khalid - 24.08.2012, 04:55
Re: Admins list dialog - by Shetch - 24.08.2012, 04:56

Forum Jump:


Users browsing this thread: 2 Guest(s)