2d array in mSelection
#1

Код:
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
Reply
#2

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..
Reply
#3

bumper car
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)