# Add a custom weapon on OX Inventory

{% embed url="<https://www.youtube.com/watch?v=ifzMmOax3P0>" %}

{% hint style="danger" %}
Don't forget to add the weapon image to your inventory system.

The images are located in each our script file.

For all inventories, the addition of images is more or less identical.

For qb-inventory the directory is: /qb-inventory/html/images/

For ak47\_qb\_inventory the directory is: /ak47\_qb\_inventory/web/build/images/

For ox\_inventory the directory is: /ox\_inventory/web/images/

For esx\_inventory the directory is: /esx\_inventory/html/img/items/
{% endhint %}

{% hint style="info" %}
When you've finished creating your item, don't forget to set UseFramework to true in the config.lua file of the script in question!
{% endhint %}

List of weapon names in our scripts:

#### Advanced Megaphone System

`WEAPON_MEGAPHONE`

#### Advanced Pepper Spray

`WEAPON_PEPPERSPRAY`

`WEAPON_ANTIDOTE`

#### Advanced Remote Restraint

`WEAPON_BOLAWRAP`

#### Advanced Extrication System

`WEAPON_SPREADER`

`WEAPON_CUTTER`

`WEAPON_GLASSMASTER`

#### Advanced Tactical Gas System

`WEAPON_GRENADE_SMOKE`

`WEAPON_GRENADE_STUN`

`WEAPON_GRENADE_TEARGAS`

![](https://2818543518-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvGiawlnUQy629isMoQhj%2Fuploads%2FqNP2vht9v90BQAJYEZBk%2Fd2dd460acfbc486acdf8831029ca3ca9.gif?alt=media\&token=ffb7adb8-889d-415d-b80a-e10af6f6afa5)

If the weapon gets a bug similar to the gif below (the weapon vibrates) follow the tutorial

1. Go to the ox\_inventory/modules/weapon/client.lua directory
2. Go to line 77 and replace the two selected lines as shown in the photo below with our code

<figure><img src="https://2818543518-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvGiawlnUQy629isMoQhj%2Fuploads%2Fg9tUAASeVdtcdkd5h0rm%2F31215762a4fd605563375676ef57dda2.gif?alt=media&#x26;token=1404f4a0-0641-4530-a6de-2c5f8ad2e597" alt=""><figcaption></figcaption></figure>

Replace:

```
SetCurrentPedWeapon(playerPed, data.hash, true)
SetPedCurrentWeaponVisible(playerPed, true, false, false, false)
```

by this:

```lua
local weaponAddons = {
	'WEAPON_MEGAPHONE',
	'WEAPON_PEPPERSPRAY',
	'WEAPON_ANTIDOTE',
	'WEAPON_BOLAWRAP',
	'WEAPON_SPREADER',
	'WEAPON_CUTTER',
	'WEAPON_GLASSMASTER',
	'WEAPON_GRENADE_SMOKE',
	'WEAPON_GRENADE_STUN',
	'WEAPON_GRENADE_TEARGAS'
}

local function isWeaponAddons(hash)
	for _,v in pairs(weaponAddons) do
		if hash == GetHashKey(v) then
			return true
		end
	end
	return false
end

if not isWeaponAddons(data.hash) then
	SetCurrentPedWeapon(playerPed, data.hash, true)
	SetPedCurrentWeaponVisible(playerPed, true, false, false, false)
end
```


---

# 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.rytrak.fr/framework-compatibility/add-a-custom-weapon-on-ox-inventory.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.
