QBox

Installation guide

Download Resource

You will receive the script in keymaster.fivem.net profile, after this click in blue "download" button.

After download, put the script in your server files.

Dependencies Part

  • qbx-core

  • weapons script ( provided on download )

Download all the scripts by clicking on their respective names, put them in the server files and start server.cfg

Webhooks

Inventory uses webhooks for logs system. All you need to do is replace the default webhooks, via config.lua

For more info how to create a discord webhook follow this tutorial: https://www.youtube.com/watch?v=fKksxz2Gdnc&t=7s&ab_channel=NoIntroTutorials

SQL

You only need to execute SQL file attached to inventory folder.

Config.lua

Setup all config.lua to your needs, read all comments in green color to be more easier.

Adjust images

To edit/change images, only need to follow this directory: jpr-inventario - html - images. To change item image, put an image and rename to item name.

Adjusting QBox Core

In order to use inventory, you need to edit qbx core in order to support it, here it goes a quick tutorial:

  • Open qbx_core/bridge/qb/server/main.lua, locate:

convertItems(require '@ox_inventory.data.items', require 'shared.items')

Replace to:

--convertItems(require '@ox_inventory.data.items', require 'shared.items')

  • Open qbx_core/bridge/qb/shared/main.lua, locate:

qbShared.Items = {}
local oxItems = require '@ox_inventory.data.items'
for item, data in pairs(oxItems) do
    qbShared.Items[item] = {
        name = item,
        label = data.label,
        weight = data.weight or 0,
        type = 'item',
        image = data.client?.image or string.strjoin(item,'.png'),
        unique = false,
        useable = true,
        shouldClose = data.close or true,
        combinable = nil,
        description = data.description or nil
    }
end
local oxWeapons = require '@ox_inventory.data.weapons'
for weapon, data in pairs(oxWeapons.Weapons) do
    weapon = string.lower(weapon)
    qbShared.Items[weapon] = {
        name = weapon,
        label = data.label,
        weight = data.weight,
        type = 'weapon',
        ammotype = data.ammoname or nil,
        image = data.client?.image or string.strjoin(weapon,'.png'),
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = nil
    }
end
for component, data in pairs(oxWeapons.Components) do
    component = string.lower(component)
    qbShared.Items[component] = {
        name = component,
        label = data.label,
        weight = data.weight,
        type = 'component',
        image = data.client?.image or string.strjoin(component,'.png'),
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = data.description
    }
end
for ammo, data in pairs(oxWeapons.Ammo) do
    ammo = string.lower(ammo)
    qbShared.Items[ammo] = {
        name = ammo,
        label = data.label,
        weight = data.weight,
        type = 'ammo',
        image = data.client?.image or string.strjoin(ammo,'.png'),
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = data.description
    }
end

Replace to:

CreateThread(function()
    qbShared.Items = exports['jpr-inventory']:GetItemList()
    qbShared.Weapons = exports['jpr-inventory']:GetWeaponList()
end)

  • Open qbx_core/server/main.lua, locate:

elseif not lib.checkDependency('ox_inventory', '2.42.1', true) then
    startupErrors, errorMessage = true, 'ox_inventory version 2.42.1 or higher is required'

Replace to:

--elseif not lib.checkDependency('ox_inventory', '2.42.1', true) then
    --startupErrors, errorMessage = true, 'ox_inventory version 2.42.1 or higher is required'

  • Open qbx_core/server/player.lua, locate:

assert(GetResourceState('qb-inventory') ~= 'started', 'qb-inventory is not compatible with qbx_core. use ox_inventory instead')
    lib.print.verbose(('%s PLAYER SAVED!'):format(playerData.name))

Replace to:

--assert(GetResourceState('qb-inventory') ~= 'started', 'qb-inventory is not compatible with qbx_core. use ox_inventory instead')
    lib.print.verbose(('%s PLAYER SAVED!'):format(playerData.name))

    exports['jpr-inventory']:SaveInventory(source)

Last updated