Only shows your name on /admins.
#1

Basically when you do this command IG, it only shows one admin online (yourself) and there is always more then that.. I need it to show ALL of the administrators.
pawn Код:
CMD:admins(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        foreach(Player, i)
        {
            if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] <= PlayerInfo[playerid][pAdmin])
            {
                new string[128];
                if(PlayerInfo[i][pAdminDuty] == 1) { format(string, sizeof(string), "%s: {00FF00}%s", GetPlayerAdminLevel(i), GetPlayerNameEx(i)); }
                if(PlayerInfo[i][pAdminDuty] == 0) { format(string, sizeof(string), "%s: {FF0000}%s", GetPlayerAdminLevel(i), GetPlayerNameEx(i)); }
                ShowPlayerDialog(playerid, 4458, DIALOG_STYLE_MSGBOX, "Online Admins", string, "Okay", "");
                return 1;
            }
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "Have questions? Ask on /n chat.");
        SendClientMessageEx(playerid, COLOR_GRAD1, "If you need to report about something, type /report [id] [reason].");
    }
    return 1;
}
Reply
#2

Have you tried to change the string value? try 1024 instead of 128.
Reply
#3

Код:
%s: {00FF00}%s
%s: {FF0000}%s
The first %s should be changed to %d or %i |

Код:
%d: {00FF00}%s
%d: {FF0000}%s
Reply
#4

Post GetPlayerAdminLevel function
Reply
#5

What's with this line?

if(PlayerInfo[playerid][pAdmin] >= 1)

That's checking if the person who executed the command is >= 1.
Reply
#6

pawn Код:
CMD:admins(playerid, params[])
{
        foreach(Player, i)
        {
            if(PlayerInfo[i][pAdmin] > 0)
            {
                new string[128];
                if(PlayerInfo[i][pAdminDuty] == 1) { format(string, sizeof(string), "%d: {00FF00}%s", GetPlayerAdminLevel(i), GetPlayerNameEx(i)); }
                if(PlayerInfo[i][pAdminDuty] == 0) { format(string, sizeof(string), "%d: {FF0000}%s", GetPlayerAdminLevel(i), GetPlayerNameEx(i)); }
                ShowPlayerDialog(playerid, 4458, DIALOG_STYLE_MSGBOX, "Online Admins", string, "Okay", "");
            }
        }
        SendClientMessageEx(playerid, COLOR_GRAD1, "Have questions? Ask on /n chat.");
        SendClientMessageEx(playerid, COLOR_GRAD1, "If you need to report about something, type /report [id] [reason].");
    return 1;
}
Gonna have to sort out the indents though, typed it on my phone.
Reply
#7

pawn Код:
%d - Use this when numeric comes. (Eg: Date, time, Level etc)
pawn Код:
%s - Use this whe  text comes. (Eg: Text, Names, Parameters like getting ip)
Beaware of small small mistakes too .
Reply
#8

Kinda removed few things but can add them back, you also put "return 1" in the loop so that's why it shows one admin.
Reply
#9

I know the differences between %d and %s, the ranks are in letters, not a numerical value.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)