06.02.2014, 02:32
Foreach still opens like a normal for loop.
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.
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;
}