Inventory Textdraw Issue...
#1

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
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];
Show/Get
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;   
}
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)

pawn Код:
ABCD
BCD
CD
D
Reply
#2

Not really sure, but did u define the variable as integer??


You can try %i.. that might help..
Reply
#3

Quote:
Originally Posted by div
Посмотреть сообщение
Not really sure, but did u define the variable as integer??


You can try %i.. that might help..
For a start "%i" is used in formatting as an example "format(str, sizeof(str), "%d/i", 1)" so your reply isn't going assist in helping me resolve or find a possible solution to my problem... However thank you for the reply.
Reply
#4

Issue resolved.

pawn Код:
(row + 1) + (col * 6) + (( (page + 1) * 24) - 24) - 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)