how do i list all players in a dialog.
#1

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
Reply
#2

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
Reply
#3

hmm... ill see if i can get through this thanks for your help
Reply
#4

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)