24.11.2012, 19:33
The problem is you call the function ShowPlayerDialog 500 times (500 = MAX_PLAYERS),
because there is a for-loop. And when the server finds an admin it will show you the dialog only with one admin on the list.
Try this.
EDIT: There was en error, it's fixed now.
because there is a for-loop. And when the server finds an admin it will show you the dialog only with one admin on the list.
Try this.
EDIT: There was en error, it's fixed now.
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0, text[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(AccountInfo[i][AdminLevel] >= 1 && AccountInfo[i][AdminLevel] <= 5 && Hide[i] == 0)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(i, playername, sizeof(playername));
format(string, 128, "%s Level: %d\n",playername,AccountInfo[i][AdminLevel]);
strins(text, string, strlen(string), sizeof(string));
count++;
}
}
}
if (count == 0) return SendClientMessage(playerid,LILA,"Server: No Admins online yet.");
ShowPlayerDialog(playerid,2563,DIALOG_STYLE_LIST,"Admins Online:",text,"OK","");
strdel(text, 0, strlen(text));
return 1;
}