> For the complete documentation index, see [llms.txt](https://docs.menanak47.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.menanak47.com/multi-framework/ak47_inventory/qbox-installation.md).

# Qbox Installation

This guide explains how to use **ak47\_inventory** as a complete standalone replacement for **ox\_inventory** on a **Qbox (QBX)** server.

***

#### Step 1: Configure `server.cfg` & `ox.cfg`

Add the framework convar and ensure `qbx_core` starts **before** `ak47_inventory`:

```cfg
# inside ox.cfg
setr inventory:framework "qbx"

# inside server.cfg
ensure qbx_core
ensure ak47_inventory
```

***

#### Step 2: Edit `ak47_inventory/configs/config.lua`

Explicitly set the framework to `'qbcore'` (around line 154):

```lua
Config.Framework = 'qbcore'
```

***

#### Step 3: Edit `ak47_inventory/fxmanifest.lua`

Remove `'qb-inventory'` from the `provides` block:

```lua
provides {
    'ak47_qb_inventory',
    'ox_inventory'
}
```

***

#### Step 4: Edit `qbx_core/server/main.lua`

Disable the strict `ox_inventory` version check around **line 5**:

```lua
if not lib.checkDependency('ox_lib', '3.20.0', true) then
    startupErrors, errorMessage = true, 'ox_lib version 3.20.0 or higher is required'
-- elseif not lib.checkDependency('ox_inventory', '2.42.1', true) then
--     startupErrors, errorMessage = true, 'ox_inventory version 2.42.1 or higher is required'
elseif GetConvar('inventory:framework', '') ~= 'qbx' then
```

***

#### Step 5: Edit `qbx_core/bridge/qb/server/main.lua`

Comment out lines 6 and 7 so it doesn't look for `@ox_inventory.data.items`:

```lua
-- local convertItems = require 'bridge.qb.shared.compat'.convertItems
-- convertItems(require '@ox_inventory.data.items', require 'shared.items')
```

***

#### Step 6: Edit `qbx_core/bridge/qb/shared/main.lua`

Replace lines 3 to 65 with the following parser to dynamically load all items and weapons directly from `ak47_inventory`:

```lua
qbShared.Items = {}

local function loadAk47File(filePath)
    local content = LoadResourceFile('ak47_inventory', filePath)
    if not content then return {} end
    local env = { Config = { Shared = {} } }
    local fn = load(content, '@@ak47_inventory/' .. filePath, 't', env)
    if fn then
        pcall(fn)
    end
    return env.Config.Shared or {}
end

-- 1. Parse Standard Items
local akItems = loadAk47File('shared/items.lua').Items or {}
for item, data in pairs(akItems) do
    qbShared.Items[item] = {
        name = item,
        label = data.label or item,
        weight = data.weight or 0,
        type = data.type or 'item',
        image = data.image or (item .. '.png'),
        unique = data.unique or false,
        useable = data.useable ~= nil and data.useable or true,
        shouldClose = data.close ~= nil and data.close or true,
        combinable = data.combinable or nil,
        description = data.description or nil
    }
end

-- 2. Parse Weapons
local akWeapons = loadAk47File('shared/weapons.lua').Weapons or {}
for weapon, data in pairs(akWeapons) do
    local weaponName = string.lower(weapon)
    qbShared.Items[weaponName] = {
        name = weaponName,
        label = data.label or weaponName,
        weight = data.weight or 0,
        type = 'weapon',
        ammotype = data.ammoname or nil,
        image = weaponName .. '.png',
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = nil
    }
end

-- 3. Parse Attachments / Components
local akComponents = loadAk47File('shared/components.lua').Components or {}
for component, data in pairs(akComponents) do
    local compName = string.lower(component)
    qbShared.Items[compName] = {
        name = compName,
        label = data.label or compName,
        weight = data.weight or 0,
        type = 'component',
        image = compName .. '.png',
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = nil
    }
end

-- 4. Parse Ammo
local akAmmo = loadAk47File('shared/ammo.lua').Ammo or {}
for ammo, data in pairs(akAmmo) do
    local ammoName = string.lower(ammo)
    qbShared.Items[ammoName] = {
        name = ammoName,
        label = data.label or ammoName,
        weight = data.weight or 0,
        type = 'ammo',
        image = ammoName .. '.png',
        unique = true,
        useable = false,
        shouldClose = true,
        combinable = nil,
        description = nil
    }
end
```

***

#### Step 7: Managing Items & Weapons

Define and manage all your items inside `ak47_inventory/shared/`:

* **Items:** `shared/items.lua`
* **Weapons:** `shared/weapons.lua`
* **Attachments:** `shared/components.lua`
* **Ammo:** `shared/ammo.lua`

**Converting Existing Ox Items:**

Paste your existing Ox item tables into `converter/ox/items.lua` (and weapons into `converter/ox/weapons.lua`). When you restart the resource, `ak47_inventory` will automatically convert and write them to your `shared/` files.
