Loops
#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


Messages In This Thread
Loops - by mirou123 - 16.03.2014, 13:41
Re: Loops - by Calabresi - 16.03.2014, 15:47
Re: Loops - by mirou123 - 16.03.2014, 15:48
Re: Loops - by Calabresi - 16.03.2014, 15:52
Re: Loops - by mirou123 - 16.03.2014, 15:53

Forum Jump:


Users browsing this thread: 1 Guest(s)