Inventory item list problem.
#1

I'm in the process of creating an inventory system and at the moment it's been working fine, up until this point... Now, using the code below I'm fetching each inventory item from the database depending on the users ID, I'm then storing it into an array and outputting it into ShowModelSelectionMenuEx();

Now, my problem is... It lists the items the database has stored on the user, but it overwrites the first item as ID 0 so it's replacing the first item in the inventory with the CJ character model rather than the correct item image.

Anyone know why this could be?

Code:
stock LoadInventory(playerid)
{
	new InvQuery[900];
	new count;
	new Inv[21];
	format(InvQuery, sizeof(InvQuery), "SELECT * FROM `inventory` WHERE `player_id` = '%d' ORDER BY `inv_id` ASC", pData[playerid][pID]);
	mysql_query(InvQuery);
	mysql_store_result();
    while(mysql_fetch_row(InvQuery))
    {
		count++;
        mysql_fetch_int("inv_id", pInv[count][iID]);
		mysql_fetch_int("item_id", pInv[count][iItemID]);
		mysql_fetch_int("amount", pInv[count][iAmount]);
		Inv[count] = pInv[count][iItemID];
    }
	ShowModelSelectionMenuEx(playerid, Inv, count, "Inventory", CUSTOM_INVENTORY_MENU, 0.0, 10.0, -55.0);
	mysql_free_result();
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)