Re-adjusting the IDs.
#2

pawn Code:
case DIALOG_INVENTORY:
{
    if(response)
    {
        new count;
        for(new item; item < MAX_ITEMS; item++)
        {
            if(!InventoryInfo[playerid][item][inventoryExist]) continue;

            if (count == listitem)
            {
                CallLocalFunction("OnPlayerUseItem", "ds", playerid, InventoryInfo[playerid][item][inventoryName]);
                break;
            }
            count++;
        }
    }
    else
    {
        DeletePVar(playerid, "item_name");
    }
}
What you basically do is directly use listitem. Listitem values are according to the dialog not the array you use to store player's inventory. So you should loop in the dialog response and start an own counter (new count;) which will side by be added +1 if the inventory item is valid with the loop's index. And then you should check if the count is equals the listitem id which makes sense as it was the listitem shown at that specific index.

I don't expect you to understand this at once !

EDIT: count++; should be in the bottom instead of top.
Reply


Messages In This Thread
Re-adjusting the IDs. - by JaKe Elite - 24.04.2016, 02:08
Re: Re-adjusting the IDs. - by Gammix - 24.04.2016, 02:19
Re: Re-adjusting the IDs. - by JaKe Elite - 24.04.2016, 02:34

Forum Jump:


Users browsing this thread: 1 Guest(s)