Creating an option box thats from SQL

almarket23

New member
Messages
90
Points
0
Github
nexus
Emulator
Hi guys, does anyone knows how to make an option box that is taken from the SQL. Example under the char table of SQL. When I click an npc dialog will be "Please choose the player that you want." then an option box will appear that has all the player in it, this is in order for me to choose a player.

In the dialog box:

Zeus

Poseidon

Hades

Then the option or menu box should be same as in the dialog box

Zeus

Poseidon

Hades

Now if theres a new player named Hermes. This should be added in the dialog box and in the menu bix automatically.

Note all players that will appear in the dialog box and menu box should be online players only. If they are offline. There name will be removed automatically and once that player went online there name should appear again automatically.

I hope someone understand what I am trying to say. Please help with this. Thanks

 
@@almarket23

Code:
prontera,214,77,6	script	Test	4_M_SEAMAN,{	.@resCount = query_sql( "SELECT `name` FROM `char` WHERE online = 1", .@names$ );	mes "[Demo]";	mes "Online Players:";	for( .@i = 0; .@i < .@resCount; .@i++ ) {		mes .@names$[ .@i ];		sleep2( 100 );	}	mes "Choose one.";	next;	.@option = select( implode( .@names$, ":" ) ) - 1;	mes "[Demo]";	mes "You selected player: " + .@names$[ .@option ];	close;}
 
Last edited by a moderator:
Exactly what Winterfox said. Only problem I can think of is if a player disconnects while showing the text or another player connects on that while, but it's as easy as cancelling the operation via the NPC itself on the first case (making an online check) and manually on the second one.

If I recall correctly, it's currently not possible to refresh menu options on the fly without making the menu again, and same for the dialog box (you can just add lines - not remove them).

 
Back
Top