SA-MP Forums Archive
/admins issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /admins issue (/showthread.php?tid=500862)



/admins issue - SyntaxQ - 15.03.2014

pawn Код:
CMD:admins ( playerid )
{
    new c = 0, str[128];
    if (PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage( playerid, -1, ""RED"ERROR: "GREY"You must be logged in!");
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (PlayerInfo[i][Admin] >= 1)
            {
                c++;
                format(str, sizeof(str), ""REDORANGE"There are "TELEPORTBLUE"%d "REDORANGE"staff member(s) online:\n{%06x}%s(%d)  "GREY"(Level: %d)\n", c, (GetPlayerColor(i) >>> 8), GetName(i), i, PlayerInfo[i][Admin]);
                ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, ""RED"Admins Online:", str, "OK", "");
            }
        }
    }
    return 1;
}
When there are 2 or more admins online, it shows only 1 in the list but the count is right (2 or more)..


Re : /admins issue - Golimad - 15.03.2014

It should be something similar to this
pawn Код:
CMD:admins ( playerid )
{
    new c = 0, str[128];
    if (PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage( playerid, -1, ""RED"ERROR: "GREY"You must be logged in!");
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (PlayerInfo[i][Admin] >= 1)
            {
                c++;
                            if(c==1) {
                format(str, sizeof(str), ""REDORANGE"There are "TELEPORTBLUE"%d "REDORANGE"staff member(s) online:\n{%06x}%s(%d)  "GREY"(Level: %d)\n", c, (GetPlayerColor(i) >>> 8), GetName(i), i, PlayerInfo[i][Admin]);
                            }
                            if(c >=2)
                            {
                             format(str, sizeof(str), "%s \n{%06x}%s(%d)  "GREY"(Level: %d)", str, ...)
                            }
               
            }
        }
    }
         ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, ""RED"Admins Online:", str, "OK", "");
    return 1;
}