CMD problem
#2

Foreach still opens like a normal for loop.

pawn Код:
CMD:admins(playerid, params[])
{
    new aMsg[MAX_PLAYER_NAME];
    SendClientMessage(playerid, COLOR_RED, "Administrators Online");
    foreach(Player, i)
    {
        if(pInfo[i][Adminlevel] == 1 && 2)
        {
            format(aMsg, 127, "Moderator: %s", GetName(i));
            SendClientMessage(playerid, COLOR_PINK, aMsg);
        }
        if(pInfo[i][Adminlevel] == 3)
        {
            format(aMsg, 127, "Adminisator: %s", GetName(i));
            SendClientMessage(playerid, COLOR_PINK, aMsg);
            continue;
        }
        if(pInfo[i][Adminlevel] == 4)
        {
            format(aMsg, 127, "Manager: %s", GetName(i));
            SendClientMessage(playerid, COLOR_PINK, aMsg);
            continue;
        }
        if(pInfo[i][Adminlevel] == 5)
        {
            format(aMsg, 127, "Owner: %s", GetName(i));
            SendClientMessage(playerid, COLOR_PINK, aMsg);
            continue;
        }
    }
    return 1;
   
}
I also added continue to the statements, because they can only be one and there's no reason checking if they're three different admin levels when you've already found their admin level and sent what you've needed to, to the client.
Reply


Messages In This Thread
CMD problem - by DarkLored - 06.02.2014, 02:27
Re: CMD problem - by Hoborific - 06.02.2014, 02:32
Re: CMD problem - by Threshold - 06.02.2014, 03:17
Re: CMD problem - by PowerPC603 - 06.02.2014, 07:39
Re: CMD problem - by Vanter - 06.02.2014, 08:48
Re: CMD problem - by Threshold - 06.02.2014, 09:06

Forum Jump:


Users browsing this thread: 1 Guest(s)