/admins in Dialog -
Youtube12 - 24.11.2012
Hi guys, who can help me with this cmd?
When I type /admins, its shows me a dialog with all admins
I already have the script but its shows only 1 Admin, if there are 2 Admins in the server, its shows only 1 Admin.
Код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0;
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]);
ShowPlayerDialog(playerid,2563,DIALOG_STYLE_LIST,"Admins Online:",string,"OK","");
count++;
}
}
}
if (count == 0) SendClientMessage(playerid,LILA,"Server: No Admins online yet.");
return true;
}
Regards *******12
Re: /admins in Dialog -
park4bmx - 24.11.2012
show some code !!
AW: /admins in Dialog -
Youtube12 - 24.11.2012
Код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0;
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]);
ShowPlayerDialog(playerid,2563,DIALOG_STYLE_LIST,"Admins Online:",string,"OK","");
count++;
}
}
}
if (count == 0) SendClientMessage(playerid,LILA,"Server: No Admins online yet.");
return true;
}
AW: /admins in Dialog -
Skimmer - 24.11.2012
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.
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;
}
AW: /admins in Dialog -
Youtube12 - 24.11.2012
If I type /admins now, Its Unknown the command "SERVER: Unknown command."
Re: /admins in Dialog -
Maikkk - 24.11.2012
PHP код:
if (strcmp(cmd, "/admins", true) == 0)
{
new count = 0,text[256];
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, 64, "%s | Level: %d\n",playername, AccountInfo[i[AdminLevel]);
strcat(text,string);
count++;
}
}
}
if (count == 0) SendClientMessage(playerid,LILA,"Server: No Admins online yet.");
ShowPlayerDialog(playerid,2563,DIALOG_STYLE_LIST,"Admins Online:"text,"OK","");
return true;
}
AW: /admins in Dialog -
Youtube12 - 24.11.2012
Код:
16419 if (strcmp(cmd, "/admins", true) == 0)
16420 {
16421 new count = 0,text[256];
16422 for(new i = 0; i < MAX_PLAYERS; i++)
16423 {
16424 if (IsPlayerConnected(i))
16425 {
16426 if(AccountInfo[i][AdminLevel] >= 1 && AccountInfo[i][AdminLevel] <= 5 && Hide[i] == 0)
16427 {
16428 new playername[MAX_PLAYER_NAME];
16429 GetPlayerName(i, playername, sizeof(playername));
16430 format(string, 64, "%s | Level: %d\n",playername, AccountInfo[i][AdminLevel]);
16431 strcat(text,string);
16432 count++;
16433 }
16434 }
16435 }
16436 if (count == 0) SendClientMessage(playerid,LILA,"Server: No Admins online yet.");
16437 ShowPlayerDialog(playerid,2563,DIALOG_STYLE_LIST,"Admins Online:"text,"OK","");
16438 return true;
16439 }
Errors:
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : warning 215: expression has no effect
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : warning 215: expression has no effect
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : warning 215: expression has no effect
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : error 001: expected token: ";", but found ")"
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : error 029: invalid expression, assumed zero
C:\Users\Billy\Desktop\Server 0.3e-R2\gamemodes\Server.pwn(16437) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: /admins in Dialog -
Maikkk - 27.11.2012
deleted