This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
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.