Commands problem
#1

hey guys , i have problem here
/admins cmd not show an other admin online
example;
if there is 5 admin online , do /admins , it will just show 1 admins online lol its weird :\

pawn Код:
CMD:admins(playerid, params[])
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            new str[1000];
            new Admin[MAX_PLAYER_NAME];
            GetPlayerName(i, Admin, sizeof(Admin));
            SendClientMessage(playerid, lightgreen, "----[{B4B5B7}0NLINE ADMIN{9ACD32}]----");
            format(str, sizeof(str), "[Admin]'%s - level %d", Admin, PlayerInfo[i][pAdmin]);
            SendClientMessage(playerid, grey, str);
            Count++;
        }
    }
    if(Count == 0)
    {
        SendClientMessage(playerid, lightred, "[System]: No Admin Online!");
    }
    return 1;
}
Reply
#2

Where's your definition of "Count"?
pawn Код:
new Count;
Reply
#3

i have it already , i put it at the top of script .
Reply
#4

Here's another way to get to it:
pawn Код:
CMD:admins(playerid, params[])
{
    new string[128], count;
    foreach(Player, i)
    {
        if(PlayerInfo[i][pAdmin] > 0)
        {
            SendClientMessage(playerid, lightgreen, "----[{B4B5B7}0NLINE ADMIN{9ACD32}]----");
            new adminname[MAX_PLAYER_NAME];
            GetPlayerName(i, adminname, MAX_PLAYER_NAME);
            format(string, sizeof(string), "[Admin]'%s - level %d", adminname, PlayerInfo[i][pAdmin]);
            SendClientMessage(playerid, grey, string);
            count++;
        }
    }
    if(!count)
    {
        return SendClientMessage(playerid, lightred, "[System]: No Admin Online!");
    }
    else
    {
        return SendClientMessage(playerid, lightgreen, "--------------------------------------");
       
    }
}
Using foreach include.
Reply
#5

k let me try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)