Jump to content
  • 0
Sign in to follow this  
almarket23

Creating an option box thats from SQL

Question

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

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

@@almarket23

 

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;}
Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.