Show all admins online
#1

Hello, I want to make list of admins command, if you are an admin you are PlayerInfo[playerid][pGmL] >= 1. How can I list every single connected player in a dialog, I thought it will be easy but then I thought how am I going to format each online admin in to different line in the dialog, so I need help.

pawn Код:
if(strcmp(cmd, "/a", true) == 0)
    if(strcmp(cmd, "/a", true) == 0)
    {
        new text12[256];
        new option1[128];
        if(PlayerInfo[playerid][pGmL] >= 1)
        {
            format(option1,sizeof(option1),"%s",WHAT HERE);
            format(text12,sizeof(text12),"%s\n%s",option1,option2);
            ShowPlayerDialog(playerid, 0504, DIALOG_STYLE_LIST, "Admins:", text12, "", "Ok");
        }
    }
And the thing im struggling with is that it needs to be global, I cant use PlayerInfo[playerid], insted of palyerid it needs to check, so can someone help me do this..
Reply
#2

I'll give you the one in my script and study it . I use YCMD!

pawn Код:
YCMD:admins(playerid, params[])
{
    if(gPlayerLoggedIn[playerid] == 0) return 1;

    SendClientMessage(playerid, 0x1FFFFFF, "Administrators online:");
    foreach(Player, i)
    {
        new level[128], string[128];

        if(PlayerInfo[i][Admin] > 0)
        {
            switch(PlayerInfo[i][Admin])
            {
                case 1: level = ""adminlevel1" (1)";
                case 2: level = ""adminlevel2" (2)";
                case 3: level = ""adminlevel3" (3)";
                case 4: level = ""adminlevel4" (4)";
                case 5: level = ""adminlevel5" (5)";
            }
            format(string, sizeof(string), "%s %s", level, PlayerName(i));
            SendClientMessage(playerid, 0xFFF84FFFF, string);
        }
    }
    return 1;
}
pawn Код:
#define adminlevel1 "Trial Admin"
#define adminlevel2 "Junior Admin"
#define adminlevel3 "Major Admin"
#define adminlevel4 "Head Admin"
#define adminlevel5 "Owner"
*Using foreach include .
Reply
#3

I guess I could make one using text, but the one I want is using dialogs, And I don't know how to format it and how many formats to do as I dont know how many admins will be online.
Reply
#4

Thanks for that, & sorry for the bump :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)