SA-MP Forums Archive
Wrong dialog showing up - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Wrong dialog showing up (/showthread.php?tid=183450)



Wrong dialog showing up - AirGuy92 - 15.10.2010

I have two arrays with 10 skin ID's each. They're called WSKINS and NSKINS.

I also have two dialogs. I want the correct dialog to show up for each array of skins. Right now I get the dialog for NSKINS for "the WSKINS" as well.

Код:
case 0://VAPEN
	        	    {
	        	        if(Skin == NSKINS[0], NSKINS[1], NSKINS[2], NSKINS[3], NSKINS[4], NSKINS[5], NSKINS[6], NSKINS[7], NSKINS[8], NSKINS[9])
	        	        {
	        	            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Weapons", "AK-47 \nSatchel Charges \nArmor", "Purchase", "Exit");
	        	        }
						else
						{
						    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Weapons", "M4 \nMinigun \nArmor", "Purchase", "Exit");
						}
	        	    }
What am I doing wrong? I'm not really sure how to access multiple values from my array... but I don't get any errors with this at least.


Re: Wrong dialog showing up - Mauzen - 15.10.2010

pawn Код:
if(Skin == NSKINS[0], NSKINS[1], NSKINS[2], NSKINS[3], NSKINS[4], NSKINS[5], NSKINS[6], NSKINS[7], NSKINS[8], NSKINS[9])
you cannot compare it like this, you will have to use Skin == ... for every part, and link it with || (or)

pawn Код:
if(Skin == NSKINS[0] || Skin == NSKINS[1] || Skin == NSKINS[2] || ...