Last active
December 12, 2024 06:50
-
-
Save mikepauer/143450140acba1a66cbba48fac691e11 to your computer and use it in GitHub Desktop.
QBCore items.lua replacement to bring in ox_inventory items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --------------------------------------------------------------------- | |
| -- THIS FILE IS NOT USED FOR ITEMS ANY LONGER -- | |
| --------------------------------------------------------------------- | |
| QBShared = QBShared or {} | |
| QBShared.Items = {} | |
| local count = 0 | |
| print ('[QBCore] Converting Inventory Items') | |
| local file = ('data/items.lua') | |
| local datafile = LoadResourceFile('ox_inventory',file) | |
| local path = ('@@%s/%s'):format('ox_inventory', file) | |
| local func, err = load(datafile, path) | |
| local itemlist = func() | |
| for item, data in pairs(itemlist) do | |
| count += 1 | |
| QBShared.Items[item] = { name = item, label = data.label, weight = data.weight, type = data.type, image = data.client and (data.client.image and data.client.image) or item .. ".png", unique = not stackable, useable = false, shouldClose = data.close, combinable = nil, description = data.description } | |
| end | |
| file = ('data/weapons.lua') | |
| datafile = LoadResourceFile('ox_inventory',file) | |
| path = ('@@%s/%s'):format('ox_inventory', file) | |
| func, err = load(datafile, path) | |
| itemlist = func() | |
| for weapon, data in pairs(itemlist.Weapons) do | |
| count += 1 | |
| QBShared.Items[weapon:lower()] = { name = weapon:lower(), label = data.label, weight = data.weight, type = 'weapon', image = weapon:lower() .. '.png', unique = not weapon.stack, useable = false, description = '' } | |
| end | |
| for attach, data in pairs(itemlist.Components) do | |
| count += 1 | |
| QBShared.Items[attach] = { name = attach, label = data.label, weight = data.weight, type = 'item', image = attach .. ".png", unique = false, useable = true, shouldClose = true, combinable = nil, description = '' } | |
| end | |
| for ammo, data in pairs(itemlist.Ammo) do | |
| count += 1 | |
| QBShared.Items[ammo] = { name = ammo, label = data.label, weight = data.weight, type = 'item', image = ammo .. '.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = '' } | |
| end | |
| print ('[QBCore] Converted ' .. count .. ' items from ox_inventory to QBCore.Shared') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
per creator " fxmanifest.lua modified to add '@ox_inventory/data/*.lua' into files" for anyone looking to implement