#1

Hello.I'm trying to make a dialog that shows the drinks you have and now I am stuck at the part where the player uses an item because for example water is ID 0 and juice ID 1 if I have no water then Juice will become ID 0 which makes it hard for me to know which drink did the player select.I hope you understood what I am trying to say.Anyway I thought maybe this code will help :

Код:
if(dialogid == DInvDrinks)
	{
	    if(response == 1)
	    {
	        for(new d = 0; d < 18; d++)
		 	{
		 	    new slot = d;
		        if(listitem == d)
		    	{
					if(PlayerVar[playerid][Drinks][slot] != 0) /*That means if a player has that drink and I got it to work.The name of the item will only appear if the listitem = the ID of the drink*/
					{
					    format(string,sizeof(string),"%s",DrinkNames[d]);
					    SendInfo(playerid,string);
					    slot++;
					}
					else //But what if he doesn't?
					{
                                          /*Here I want to make a loop that will go through all the 18 drinks on the list and it will display the first drink that is not equal to 0*/
					}
		        }
		  	}
	    }
	    return 1;
	}
I'm sorry for my bad english.I tryed to be as clear as possible.
Reply
#2

What I understood is, you want the script to automatically detect which drink was selected and apply the code you want to apply but, you cannot detect what item is what since listitem is unclear. You can use strcmp to compare between drink names, by inputtext.
Reply
#3

But the dialog is a list how can I get the name of the element I clicked?
Reply
#4

Quote:
Originally Posted by mirou123
Посмотреть сообщение
But the dialog is a list how can I get the name of the element I clicked?
As I said, "inputtext" gives you the string of what player has clicked. For example;

pawn Код:
ShowPlayerDialog(playerid, 1212, DIALOG_STYLE_LIST, "Drinks", "Wine\nSoda", "OK", "");
Clicking on "Wine" will return you the string "Wine" on inputtext.
Reply
#5

Oh I didn't know that.Now things will be easier.Thanks for helping +rep'ed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)