26.06.2018, 03:33
I've run into a issue similar to this before.. With using textdraw's that is, however this isn't the same issue; The issue is being able to get the inventory data correctly.. Drawing the slots work's perfectly and as expect, however displaying the model isn't working as intended..
For the purposes of getting help, only the necessary part's (the parts I'm having issues with) will be provided.. So I will not be providing the code behind the textdraw, only the displaying portion and the data portion.
Data
Show/Get
When displaying the inventory, it either displays each item (kind of) correctly in the first bar of slots (row + col /or/ col + row [not that changing the position will make a difference) then continues to cascade down and to left so by the time you get to the item set you have an issue as follow (where each letter is a separate model)
For the purposes of getting help, only the necessary part's (the parts I'm having issues with) will be provided.. So I will not be providing the code behind the textdraw, only the displaying portion and the data portion.
Data
pawn Код:
#define MAX_INVENTORY_ITEMS (120)
#define E_INVENTORY_ROWS_MAX (6)
#define E_INVENTORY_COLUMNS_MAX (4)
new PlayerText: InventoryItems[MAX_PLAYERS][E_INVENTORY_ROWS_MAX][E_INVENTORY_COLUMNS_MAX];
enum E_CHARACTER_INVENTORY
{
itemModel,
itemName[32],
itemQuantity,
itemData[1024],
bool: itemExists,
bool: itemStackable,
}
new InventoryInformation[MAX_PLAYERS][MAX_INVENTORY_ITEMS][E_CHARACTER_INVENTORY];
pawn Код:
stock Inventory_Show(playerid, page=0)
{
new tmpStr[248];
for(new ui; ui < sizeof(CharacterInventory[]); ui ++)
PlayerTextDrawShow(playerid, CharacterInventory[playerid][ui]);
format(tmpStr, sizeof(tmpStr), "YOUR INVENTORY: %d/%d", Inventory_Items(playerid), MAX_INVENTORY_ITEMS);
PlayerTextDrawSetString(playerid, CharacterInventory[playerid][3], tmpStr);
for( new col; col < E_INVENTORY_COLUMNS_MAX; col ++ )
{
for( new row; row < E_INVENTORY_ROWS_MAX; row ++)
{
#if defined enableDebug
printf("Checking Slot: %d (Row: %d, Column: %d)", col * (row + 1), row,col);
#endif
if(InventoryInformation[playerid][col * (row + 1)][itemExists])
PlayerTextDrawSetPreviewModel(playerid, InventoryItems[playerid][row][col], InventoryInformation[playerid][col * (row + 1)][itemModel]);
PlayerTextDrawShow(playerid, InventoryItems[playerid][row][col]);
}
}
IsViewingInventory(playerid) = true;
SelectTextDraw(playerid, COLOUR_ACTIVECAPTION);
return true;
}
pawn Код:
ABCD
BCD
CD
D