01.11.2015, 07:40
you can try
I'm using foreach for the loop, if you don't want it use
I don't know your maximum admin level so change the <= 3 to match it.
PHP код:
COMMAND:admins(playerid, params[])
{
new staffcount, string[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
foreach(new i : Player)
{
if(!(1 <= PlayerStat[i][AdminLevel] <= 3)) continue;
format(string, sizeof(string), "%s%i) %s (Level %i)", string, ++staffcount, GetOOCName(i), PlayerStat[i][AdminLevel]);
}
if(!staffcount)
{
SendClientMessage(playerid, RED, "No admins online");
return 1;
}
else { SendClientMessage(playerid, RED, string); }
SendClientMessage(playerid, WHITE, "-------------------------");
return true;
}
PHP код:
COMMAND:admins(playerid, params[])
{
new staffcount, string[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!(1 <= PlayerStat[i][AdminLevel] <= 3)) continue;
format(string, sizeof(string), "%s%i) %s (Level %i)", string, ++staffcount, GetOOCName(i), PlayerStat[i][AdminLevel]);
}
}
if(!staffcount)
{
SendClientMessage(playerid, RED, "No admins online");
return 1;
}
else { SendClientMessage(playerid, RED, string); }
SendClientMessage(playerid, WHITE, "-------------------------");
return true;
}