Origen Inventory

1) Set Config.Inventory = "origen_inventory" in config/_config.lua

2) Go to qb-core/server/main.lua and add this code at bottom:

AddEventHandler('av_restaurant:QBItem', function(data)
    local name = data['name']
    local path = GetResourcePath('origen_inventory') -- Rename it to lj-inventory if needed
    if not QBShared.Items[name] then
        QBShared.Items[name] = {
            name = name,
            label = data['label'],
            weight = data['weight'],
            type = 'item',
            image = data['name']..'.png',
            unique = false,
            useable = true,
            shouldClose = true,
            combinable = {},
            description = data['description']
        }
        if data.image then
            PerformHttpRequest(data.image, function (errorCode, resultData, resultHeaders)
                if errorCode >= 200 and errorCode < 300 then
                    local image = assert(io.open(path..'/html/images/'..data.name..'.png', "wb"))
                    image:write(resultData)
                    image:flush()
                    image:close()
                end
            end)
        end
    end
end)

Last updated