Open Kashioliver777 opened 2 months ago
I spent more time looking for the error and it seems that the "CanAddItem" function is always returning false
To solve the problem temporarily I just went to qb-inventory>server>main.lua and in the callback: QBCore.Functions.CreateCallback('qb-inventory:server:attemptPurchase', function(source, cb, data)
I put the "if not CanAddItem" at the bottom of everything
same issue none of the shops work it says cannot find export in main create shops
I took a good look at the code and tried to break it down further to look for the error. From what I noticed, for some reason the code cannot identify the player's inventory
--- Checks if an item can be added to a inventory based on the weight and slots available. --- @param identifier string The identifier of the player or inventory. --- @param item string The item name. --- @param amount number The amount of the item. --- @return boolean - Returns true if the item can be added, false otherwise. --- @return string|nil - Returns a string indicating the reason why the item cannot be added (e.g., 'weight' or 'slots'), or nil if it can be added.
print ('this is inventory:' ..identifier) function CanAddItem(identifier, item, amount) if not Inventories[identifier] then print('dont seach inventory') return false end local Player = QBCore.Functions.GetPlayer(identifier) local itemData = QBCore.Shared.Items[item:lower()] if not itemData then return false end