The inventory was designed with the intention to move towards a more generic / standalone structure so it can be integrated into any framework without hassle, but that’s for a future update.
Sick looking inventory im 100% going to use this one. Could you add names for glovebox and trunk for cars. For example if you open a glovebox it shows ‘Glovebox’ and the same for vehicle trunks
?
You’d have to ask @Dunak on that since he’s the TS nerd; I barely touched the interface outside of some minor style changes and durability calculations.
Is it backward compatible? I mean in database we have stored items for normal esx. So ex. If player has 10 piece of bread etc… in storages will he able to use his items after installing this inventory? Our server runs more than a year everyone has lot of items in their storages and we dont want them to lose them.
It’s difficult to know what people are running in order to run queries for converting all of their inventories; it wouldn’t be too difficult to convert some standard formats but it can easily get complicated depending on how they store items.
Right now, the only thing I can guarantee is player inventories; there’s also an export that I haven’t thoroughly tested that you could try to use. Considering the nature of this resource I would hope everybody is backing up before attempting anything.
--- Takes traditional item data and updates it to support ox_inventory, i.e.
---
--- Old: [{"cola":1, "bread":3}]
--- New: [{"slot":1,"name":"cola","count":1}, {"slot":2,"name":"bread","count":3}]
---
local function ConvertItems(playerId, items)
if type(items) == 'table' then
local returnData, totalWeight = table.create(#items, 0), 0
local slot = 0
for name, count in pairs(items) do
local item = Items(name)
local metadata = Items.Metadata(playerId, item, false, count)
local weight = Inventory.SlotWeight(item, {count=count, metadata=metadata})
totalWeight = totalWeight + weight
slot += 1
returnData[slot] = {name = item.name, label = item.label, weight = weight, slot = slot, count = count, description = item.description, metadata = metadata, stack = item.stack, close = item.close}
end
return returnData, weight
end
end
exports('ConvertItems', ConvertItems)
For stuff like esx_addoninventory you could probably load all the items into a table and pass it through (it normally stores each item as a single entry in the database). After some time to let things settle and some relaxation I can look at implementing my own stuff for support.
The plan is to remove the dependency on ESX entirely; once I’ve done that I’ll be adding a guide so anybody could theoretically use it. However, considering the amount this resource affects your server I can’t recommend it for anything before ESX 1.2.
Considering ESX Legacy is almost entirely backwards compatible with 1.2, you would be better off updating everything.