13.12.2013, 15:24
How to get the online admins number to make something like "There are 2 admins online." ?
new str[32], online;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin]) // just change the variable name to your admin system variable name.
{
online ++;
}
}
format(str, sizeof(str), "Administrators online: %d", online);
SendClientMessage(playerid, -1, str);
CMD:admins(playerid, params[]) {
new count = 0;
new string[128];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
count++;
format(string, sizeof(string), "* There are currently %d admins online.", count);
SendClientMessage(playerid, COLOR_GREEN, string);
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_RED,"* There are currently 0 admins online.");
}
return 1;
}