SA-MP Forums Archive
2d array in mSelection - 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)
+--- Thread: 2d array in mSelection (/showthread.php?tid=617015)



2d array in mSelection - JaydenJason - 14.09.2016

Код:
static  gTableFurniture[] =
{
	1824, 1896, 2964,
};

~~~~

case 0: ShowModelSelectionMenu(playerid, "Tables", MENU_BUY_FURNITURE, gTableFurniture, sizeof(gTableFurniture));
That was my little piece of code before I decided to use a different array

I'm messing around with arrays now, got this

Код:
enum e_FurnitureData
{
	e_FurnitureName[64],
	e_FurnitureModel,
	e_FurniturePrice
};

static  gTableFurniture[][e_FurnitureData] =
{
	{"Wood Table", 1824, 250},
	{"Oak Table", 1896, 300},
	{"Other Table", 2964, 350}
};
Код:
\script.pwn(2468) : error 048: array dimensions do not match
case 0: ShowModelSelectionMenu(playerid, "Tables", MENU_BUY_FURNITURE, gTableFurniture, sizeof(gTableFurniture));
How do I use this in that mSelection line so it uses the e_FurnitureModel


Re: 2d array in mSelection - JaydenJason - 14.09.2016

Found a little work-around for this


Код:
case 0: 
{
	new objarray[100] = -1;
	for(new i = 0; i < sizeof(gTableFurniture); i++)
	{
		objarray[i] = gTableFurniture[i][e_FurnitureModel];
	}
	ShowModelSelectionMenu(playerid, "Tables", MENU_BUY_FURNITURE, objarray, sizeof(objarray));
}
My problem is that CJ's butt is being shown here. Meaning every single item in the "objarray" is being shown, regardless of its value..


Re: 2d array in mSelection - JaydenJason - 15.09.2016

bumper car