# OX Inventory

## 0Resmon Weapon Sync – Quick Install

Choose `qb-inventory` or `ox_inventory`, follow the common fix, then jump to your branch. No comment lines, straight to the point 🏃‍♂️💨

***

### Ox Inventory

✅ **It should be true in server.cfg**

```cfg
setr inventory:weaponanims false
```

**\[Recommended] Go inside Ox Inventory and replace with (Pre-configured setup)**\
You do not need to make any changes. Just copy and paste the code.

{% file src="/files/wNicMx9PRQSfXAriicL9" %}

***

#### Manual Edit *(If you've already made the above file change, this part is not necessary)*

**🔁 Line: \~1222**

In the `ox_inventory:setPlayerInventory` event, replace the block starting with `if currentWeapon then` with:

```lua
if currentWeapon then
    if weaponHash ~= currentWeapon.hash and currentWeapon.timer then
        local weaponCount = Items[currentWeapon.name]?.count

        if weaponCount > 0 then
            SetAmmoInClip(playerPed, currentWeapon.hash, currentWeapon.metadata.ammo)
            SetPedCurrentWeaponVisible(playerPed, true, false, false, false)

            weaponHash = GetSelectedPedWeapon(playerPed)
        end
    end
elseif client.weaponmismatch and not client.ignoreweapons[weaponHash] then
    local weaponType = GetWeapontypeGroup(weaponHash)

    if weaponType ~= 0 and weaponType ~= `GROUP_UNARMED` then
        Weapon.Disarm(currentWeapon, true)
    end
end
```

**🔁 Line: 584**

Inside the `useSlot` function, replace the `useItem(data, function(result)` block **after** `RemoveWeaponFromPed(cache.ped, data.hash)` with:

```lua
useItem(data, function(result)
    if result then
        local sleep
        currentWeapon, sleep = Weapon.Equip(item, data, noAnim)
        if sleep then Wait(sleep) end
        SetTimeout(WEAPON_SWITCH_COOLDOWN, function()
            weaponCooldown = false
        end)
    else
        weaponCooldown = false
    end
end, noAnim)
```

**🔁 Line: 554**

In the same `useSlot` function, replace the block `if CurrentWeapon then` **above** `RemoveWeaponFromPed(cache.ped, data.hash)` with:

```lua
if currentWeapon then
    if data.slot == currentWeapon.slot then
        currentWeapon = Weapon.Disarm(currentWeapon)
        return
    end
    return lib.notify({ type = 'error', description = 'You already have a gun in your hand.' })
end
weaponCooldown = true
```

**➕ Line: 524**

At the **start** of the `useSlot` function, add this block:

```lua
if weaponCooldown or (currentWeapon and currentWeapon.timer and currentWeapon.timer - GetGameTimer() > 0) then
    if not notifyCooldown then
        notifyCooldown = true
        lib.notify({ type = 'error', description = 'Please wait before switching weapons' })
        SetTimeout(NOTIFY_COOLDOWN, function()
            notifyCooldown = false
        end)
    end
    return
end
```

**➕ Line: 472**

**Above** the `useSlot` function, add these local variables:

```lua
local weaponCooldown = false
local notifyCooldown = false
local WEAPON_SWITCH_COOLDOWN = 3000
local NOTIFY_COOLDOWN = 2000
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0r-resources/0r-holsteranim/required-item.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
