02.07.2009, 17:22
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new Count[2], i, string[128];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(dUserINT(PlayerName(i)).("Adminlvl") == 0) Count[0]++;
}
if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && dUserINT(PlayerName(i)).("Adminlvl") == 0) ) return SendClientMessage(playerid, COLOR_BLUE, "Admins Online: None");
if(Count[0] == 1)
{
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && dUserINT(PlayerName(i)).("Adminlvl") > 0)
{
format(string, sizeof(string), "Admins Online: %s (%d)",PlayerName2(i), PlayerData[i][Adminlvl] ); SendClientMessage(playerid, COLOR_BLUE, string);
}
}
if(Count[0] > 1)
{
new x; format(string, sizeof(string), "Admins Online: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && dUserINT(PlayerName(i)).("Adminlvl") > 0)
{
format(string,sizeof(string),"%s%s (%d)",string,PlayerName2(i),PlayerData[i][Adminlvl]);
x++;
if(x >= 5)
{
SendClientMessage(playerid, COLOR_BLUE, string); format(string, sizeof(string), "Admins Online: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0)
{
string[strlen(string)-3] = '.';
SendClientMessage(playerid, COLOR_BLUE, string);
}
}
return 1;
}