Quasar Inventory

1) Go to qs-inventory/server/custom/framework/qb.lua and add this event at bottom

RegisterNetEvent('inventory:refresh', function()
    QBCore = exports['qb-core']:GetCoreObject()
    ItemList = QBCore.Shared.Items
end)

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('qs-inventory')
    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