Origen Inventory

  • This only applies if you are using ESX and Origen Inventory.

  • Go to origen_inventory/server/custom and create a new file name it restaurant.lua

  • Open restaurant.lua and paste this code:

AddEventHandler('inventory:refresh', function()
    local success, items = pcall(MySQL.query.await, 'SELECT * FROM av_items')
    if success and items and next(items) then
        local dump = {}
        local resource = GetCurrentResourceName()
        local path = GetResourcePath(resource)
        for i = 1, #items do
            local item = items[i]
            if not QBItems[item.name] then
                item.shouldClose = true
                item.unique = false
                item.useable = true
                item.description = item.description
                item.weight = item.weight or 100
                item.type = 'item'
                if item.image then
                    PerformHttpRequest(item.image, function(errorCode, resultData, resultHeaders)
                        if errorCode >= 200 and errorCode < 300 then
                            local image = assert(io.open(path .. '/html/images/' .. item.name .. '.png', "wb"))
                            image:write(resultData)
                            image:flush()
                            image:close()
                        else
                            print("Image URL not found for item " .. item.label)
                        end
                    end)
                end
                item.image = tostring(item.name .. '.png')
                QBItems[item.name] = item
            end
        end
    end
end)
  • Save your changes, don't forget to set Config.Inventory = "origen_inventory" in both av_laptop and av_restaurants.

  • NOTE: You need to wait for a server restart before using a new item for the first time.

Last updated