need a little help. -
Iuri - 02.08.2012
Hello. I got a small problem wich i also had it in past, but in past i knew how to fix it,and now , after 1 year of pause from scripting, i forgot how to fix it. Okay, so here it is. When a player types /players, a list dialog should pop up saying the connected players names. ( names should be like name undes name as it's a list dialog .) but for me it always shows the name of the player with the highest id. So do you guys know how to solve this?
Код:
new name[] = "\n"; for(new i;i<MAX_PLAYERS;i++); { if(IsPlayerConnected(i)) { format(string,sizeof(string),"%s%s",name,PlayerName(i); ShowPlayerDialog(playerid,1000,"test",string,"ok"); continue; } //and then the loop ends
Re: need a little help. -
Iuri - 02.08.2012
Bump..
Re: need a little help. -
CrnaStrela - 02.08.2012
Why too you need this command when u can only press TAB ^^
Re: need a little help. -
Iuri - 02.08.2012
i have my own reasons..
Re: need a little help. -
Devilxz97 - 02.08.2012
pawn Код:
new name[] = "\n";
for(new i;i<MAX_PLAYERS;i++);
{
if(IsPlayerConnected(i))
{
format(string,sizeof(string),"%s%s",name,PlayerName(i);
ShowPlayerDialog(playerid,1000,"test",string,"ok", "");
}
}
return 1;
}
pawn Код:
new name[MAX_PLAYER_NAME];
Getplayername(playerid, name,sizeof(name));
need to go . . i can help u after im back from school , seeya
Re: need a little help. -
Iuri - 03.08.2012
That didn't worked..
Re: need a little help. -
SEnergy - 03.08.2012
pawn Код:
if(strcmp(cmdtext, "/players", true) == 0)
{
new plrs[2048];
plrs = "";
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new plrname[MAX_PLAYER_NAME];
GetPlayerName(i, plrname, sizeof(plrname));
if(i == 0)
format(plrs, sizeof(plrs), "%s", plrname);
else
format(plrs, sizeof(plrs), "%s, %s", plrs, plrname);
}
}
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Players", plrs, "Close", "");
return 1;
}
anyway you should modify this a little bit since with a lot of players on the server it will create huge dialog and you won't be able to see it full
Re: need a little help. -
Iuri - 03.08.2012
Quote:
Originally Posted by SEnergy
pawn Код:
if(strcmp(cmdtext, "/players", true) == 0) { new plrs[2048]; plrs = ""; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new plrname[MAX_PLAYER_NAME]; GetPlayerName(i, plrname, sizeof(plrname)); if(i == 0) format(plrs, sizeof(plrs), "%s", plrname); else format(plrs, sizeof(plrs), "%s, %s", plrs, plrname); } } ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Players", plrs, "Close", ""); return 1; }
anyway you should modify this a little bit since with a lot of players on the server it will create huge dialog and you won't be able to see it full
|
Thanks for the help but i want it in DIALOG_STYLE_LIST, not DIALOG_STYLE_MSGBOX.
Re: need a little help. -
SEnergy - 03.08.2012
Quote:
Originally Posted by Iuri
Thanks for the help but i want it in DIALOG_STYLE_LIST, not DIALOG_STYLE_MSGBOX.
|
pawn Код:
if(strcmp(cmdtext, "/test", true) == 0)
{
new plrs[2048];
plrs = "";
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new plrname[MAX_PLAYER_NAME];
GetPlayerName(i, plrname, sizeof(plrname));
format(plrs, sizeof(plrs), "%s\n%s", plrs, plrname);
}
}
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Players", plrs, "Close", "");
return 1;
}
tell me if it works with more players since I have only local server
Re: need a little help. -
Iuri - 03.08.2012
EDIT: Nevermind, i found it and managed to fix it. Thanks for the help, i rep'd. you.