how do i list all players in a dialog. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how do i list all players in a dialog. (
/showthread.php?tid=223654)
how do i list all players in a dialog. -
THE_KNOWN - 10.02.2011
ok heres what i want todo. i have an org script so when a player enters hisorgs checkpoint it should display the names of members in his org. i use mysql so how do i do it so that the names come as a list (dialog_style_list)
heres my try which failed =( :
Код:
if(dialogid == 28)
{
new p[256];
p=LoadMem(playerid);
ShowPlayerDialog(playerid, 29,DIALOG_STYLE_LIST,"Members",p,"Ok","Cancel");
}
Код:
LoadMem(playerid)
{
new q[128],mem[256];
format(q,128,"SELECT * FROM ostats WHERE org=%d",org[playerid]);
mysql_query(q);
mysql_store_result();
for(new i=0;i<mysql_num_rows();mysql_retrieve_row())
{
new tmp[32],s[128],field[3][32];
mysql_fetch_row_format(q, "|");
explode(q, field, "|");
format(tmp,32,"%s",field[1]);
format(s,128,"%s\n%s",s,tmp);
format(mem,256,"s",s);
}
return mem;
}
pls help me
Re: how do i list all players in a dialog. -
(SF)Noobanatior - 10.02.2011
this is how i get em from the server and send lines of 3 names
pawn Код:
new str[128];
new x;
for(new i=0; i < MAX_PLAYERS; i++) {
format(str, sizeof(str), "%s%s", str,ReturnPlayerName(i));
x++;
if(x > 3) {
SendClientMessage(playerid, COLOUR_YELLOW, str);
x = 0;
format(str, sizeof(str), "");
}
else {
format(str, sizeof(str), "%s, ", str);
}
}
}
stock ReturnPlayerName(playerid) {
new tmpname[MAX_PLAYER_NAME] = " ";
if(!IsPlayerConnected(playerid)) return tmpname;
GetPlayerName(playerid,tmpname,MAX_PLAYER_NAME);
return tmpname;
}
you will have to change it around a bit but im sure you get the idea
Re: how do i list all players in a dialog. -
THE_KNOWN - 10.02.2011
hmm... ill see if i can get through this thanks for your help
Re: how do i list all players in a dialog. -
Mean - 10.02.2011
This is how to show it in chat, you can just convert it to dialog:
ALSO USING ZCMD
pawn Код:
CMD:onlineplayers( playerid, params[ ] )
{
new count = 0;
for( new i; i < MAX_PLAYERS; 1++ )
{
if( IsPlayerConnected( i ) )
{
count++;
new string[ 128 ];
new pName[ 24 ];
GetPlayerName( i, pName, 24 );
format( string, sizeof string, "[%d.] %s", count, pName );
SendClientMessage( playerid, 0xAAAAAA, string );
}
}
return 1;
}
Too lazy to write a code for dialog now...