ESX • QBCore • Qbox compatible
Instant download
Updates included
Discord support
Secure checkout

Pepperspray Script + Weapon

Resource folder: gs_pepperspray

View product

Installation Instructions for Pepperspray Script + Weapon

Follow these steps to install and configure gs_pepperspray on your FiveM server.

  1. Download the Resource
    • Go to portal.cfx.re
    • Navigate to Assets > Granted Assets > gs_pepperspray
    • Download the resource
  2. Extract the Files
    • Open the downloaded .zip file
    • Inside, you'll find a folder named gs_pepperspray
    • Move the entire gs_pepperspray folder into your desired server resources folder (e.g., /resources/[scripts])
  3. Add to Server Configuration
    • Open your server.cfg
    • Add the following line:
      ensure gs_pepperspray
  4. Restart the Server
    • Restart your FiveM server (Important!)
  5. Configure the Script (Optional)
    • Navigate to gs_pepperspray/config.lua
    • Edit the configuration options to fit your server's needs

Additional documentation

Pepperspray versions

There are two versions included in the script:

  • weapon_v1: The original version as shown in the showcase video.
  • weapon_v2: A new version, with a more extreme spray effect and is easier to install for inventory systems.

It is recommended to use weapon_v2 for new users (especially for non esx/qb/ox inventory systems), as it is easier to install! If you are not running an inventory system, and have access to the GTA-5 weapon wheel using TAB, then the pepperspray should work out of the box without any changes. The pepperspray will not have a weapon wheel icon, but you can still select it in the top-left corner (the throwables part of the weapon wheel).

Switching version

By default, v1 will be used, you can switch from v1 to v2 by going to fxmanifest.lua and replacing all weapon_v1 text with weapon_v2. Be sure to fully restart the server after switching from versions!

Installation when using V1 (Scroll down for V2 installation)

If you are using an inventory system, you will most likely have to add the addon-weapon to the inventory system. Below is the information for adding the weapon to ESX/QB/OX.

ESX:

Add the following line in es_extended\shared\config\weapons.lua (or es_extended/config.weapons.lua for older versions)

{ 
name = "WEAPON_PEPPERSPRAY",
label = 'Pepper Spray',
components = {},
ammo = { label = TranslateCap("ammo_charge"),
hash = `AMMO_FIREEXTINGUISHER` }
},

QB-Core:

First go to qb-core/shared/items.lua and add this line to the item list:

weapon_pepperspray = { name = 'weapon_pepperspray', label = 'Pepper Spray', weight = 500, type = 'weapon', ammotype = nil, image = 'weapon_pepperspray.png', unique = true, useable = false, description = 'Pepper Spray' },

Then go to qb-core/shared/weapons.lua and add this line to the weapons list:

[`weapon_pepperspray`] = { name = 'weapon_pepperspray', label = 'Pepper Spray', weapontype = 'Miscellaneous', ammotype = nil, damagereason = 'Died' },

Then go to qb-weapons/config.lua, in the Config.DurabilityBlockedWeapons list and add 'weapon_pepperspray' (if you want the pepperspray to not lose durability) Finally go to qb-weapons/client/main.lua, line 149. Originally, it will look like this:

if weaponName == 'weapon_petrolcan' or weaponName == 'weapon_fireextinguisher' then

You can change this to

if weaponName == 'weapon_petrolcan' or weaponName == 'weapon_fireextinguisher' or weaponName == 'weapon_pepperspray' then

OX-Inventory

For ox-inventory, add the following to ox_inventory/data/weapons.lua:

['WEAPON_PEPPERSPRAY'] = { label = 'Pepperspray', weight = 500, durability = 0 },

Note that ox-inventory uses separate ammo. You should give the pepperspray weapon infinite ammo by changing the following (using ammo-items is known to work problematic, so not recommended). Go to ox-inventory/modules/items/server.lua, line 188. Originally, it will look like this:

if item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` or item.hash == `WEAPON_FIREEXTINGUISHER` then

You need to change this to:

if item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` or item.hash ==`WEAPON_FIREEXTINGUISHER` or item.hash == `WEAPON_PEPPERSPRAY` then

Additionally, you will need to go to ox_inventory/modules/inventory/server.lua, line 2548. Originally, it will look like this:

if item.hash == `WEAPON_FIREEXTINGUISHER` or item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` then

You need to change this to:

if item.hash == `WEAPON_FIREEXTINGUISHER` or item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` or item.hash == `WEAPON_PEPPERSPRAY` then

So we are basically using the durability of the weapon as ammo, if you set durability = 0 in the weapon config, then the weapon will have infinite ammo.

Installation when using V2

If you are using an inventory system, you will most likely have to add the addon-weapon to the inventory system. Below is the information for adding the weapon to ESX/QB/OX.

ESX

For ESX, add the following line in es_extended\shared\config\weapons.lua (or es_extended/config.weapons.lua for older versions):

{ name = "WEAPON_PEPPERSPRAY", label = 'Pepper Spray', components = {}, ammo = { label = TranslateCap("ammo_charge"), hash = `AMMO_PEPPERSPRAY` } },

QB-Core

For qb-core, first go to qb-core/shared/items.lua and add this line to the item list:

 weapon_pepperspray = { name = 'weapon_pepperspray', label = 'Pepper Spray', weight = 500, type = 'weapon', ammotype = nil, image = 'weapon_pepperspray.png', unique = true, useable = false, description = 'Pepper Spray' },

Then go to qb-core/shared/weapons.lua and add this line to the weapons list:

[`weapon_pepperspray`] = { name = 'weapon_pepperspray', label = 'Pepper Spray', weapontype = 'Miscellaneous', ammotype = nil, damagereason = 'Died' },

Then go to qb-weapons/config.lua, in the Config.DurabilityBlockedWeapons list and add 'weapon_pepperspray' (if you want the pepperspray to not lose durability)

OX-Inventory

For ox-inventory, add the following to ox_inventory/data/weapons.lua:

['WEAPON_PEPPERSPRAY'] = { label = 'Pepperspray', weight = 500, durability = 0, ammoname = 'ammo-pepperspray' }, -- You do not need to add the ammo item, the pepperspray will have infinite ammo

Should I use v1 or v2?

Both versions are included. Choose one in fxmanifest.lua by pointing to either weapon_v1 or weapon_v2. v2 is recommended for most servers: stronger spray visuals, easier inventory setup, and fewer reported weapon issues. Use v1 only if you specifically want the subtler look from the showcase video.

Is pepperspray a weapon or a regular inventory item?

It is an addon weapon (weapon_pepperspray), not a standard usable item. Register it in your framework or inventory weapons list. A common mistake is placing it under ammo types in ox_inventory instead of the weapons section.

Does pepperspray work on a standalone server with no framework?

Yes. Start the resource and spawn weapon_pepperspray. Set Config.JobRequirement.Enabled = false in config so all players can use it. For standalone, switching to v2 only requires a change in fxmanifest.lua.

I see spray particles but players are not affected. What should I check?

This is the most common issue. Work through these in order:

  • Ammo: The effect only applies when the weapon has ammo. Spray visuals can still show at 0 ammo. Set up infinite ammo like the fire extinguisher, or switch to v2.
  • Job requirement: If Config.JobRequirement.Enabled is true, only listed jobs (police, ambulance, etc.) can apply the effect.
  • Range and angle: Targets must be sprayed from the front at close range.
  • Blocked input: Another script may block left-click (attack input).
  • Version: Update to the latest Keymaster build. Older v2 builds had a spray-without-effect bug that was fixed in 1.1.2+.

Why does ox_inventory show "attempt to compare number with nil"?

Usually a v1/v2 mismatch: ox_inventory is configured for one version while fxmanifest.lua points to the other. Align both. Do not add a separate ammo-pepperspray item. If you use a custom ox_inventory fork, match the logic from the docs rather than exact line numbers.

The weapon appears in inventory but will not equip

Verify infinite-ammo changes were applied in both required ox_inventory files. Confirm the entry is in the weapons section, not ammo types. Test by stopping ox_inventory and spawning the weapon directly to isolate whether the problem is the weapon or the inventory integration.

Pepperspray shows 0 ammo on QBCore and does nothing

Add the weapon to qb-core/shared/weapons.lua with ammotype = nil, following the same pattern as weapon_fireextinguisher. If that does not work, try ammotype = AMMO_FIREEXTINGUISHER. No separate ammo item is needed.

Where do I register the weapon on ESX?

Add it to your ESX weapons list (es_extended/shared/config.lua or your version's equivalent). Give it with /giveweapon <id> weapon_pepperspray 1000. If you use ox_inventory, also add the weapon entry there.

Does it work with Qbox and ox_inventory?

Yes, using the same ox_inventory weapon setup as other frameworks. Register in qbx_core/shared/weapons.lua with ammotype = nil. Put WEAPON_PEPPERSPRAY in ox_inventory/data/weapons.lua, not in items.lua.

Spray works on NPCs but not on players

Check Config.JobRequirement.Enabled. An older hardcoded police check in Functions.CanPlayerApplySprayEffect in the server bridge can also block player effects even when config says otherwise. Update to the latest version or set that bridge function to return true while testing.

Can pepperspray affect NPCs?

Yes, when Config.EnableSprayingNPCs is true (the default). Set it to false in config to restrict spraying to players only.

Why does the weapon wheel show "fire extinguisher" ammo?

By design. Pepperspray shares the fire extinguisher ammo type (single clip, not reloadable). Do not create a separate ammo shop item for it.

I get "You lack the required entitlement to use gs_pepperspray"

Link the asset to your Cfx.re account through Tebex/Keymaster, then restart the server after claiming it.

The weapon model or textures do not load

Check the F8 console for .meta load errors on resource restart. Confirm fxmanifest.lua points to the correct v1 or v2 folder. Re-download from Keymaster if files were overwritten by another resource.

Pepperspray is missing from vMenu

Add "weapon_pepperspray" to vMenu/config/addons.json under the weapons tab.

v1 spray is barely visible but v2 cannot hit players

For weak v1 visuals, switch to v2. For v2 hit issues, confirm fxmanifest.lua is fully switched to v2, check job requirements and ammo, and update to the latest version.

Pepperspray stopped working after I added skinchanger

Skinchanger integration in the client bridge can block the screen effect even when network events fire. Remove or adjust the skinchanger-related code in the bridge if you do not need clothing-based immunity.

Pepperspray creates fire when used with Smart Fires

This is a compatibility conflict between the two scripts. Contact support or adjust resource load order and Smart Fires config.

How do I change how long the spray effect lasts?

Adjust Config.SprayEffectTimer in config.lua (default is 10000 ms, or 10 seconds).

Players hear a gunshot sound when sprayed from far away

Update weapons.meta from the latest Keymaster download. A fix was pushed after this was reported.

Does it work with qs-inventory or Codem_inventory?

Switch to v2 and configure the weapon like weapon_fireextinguisher with infinite ammo and no separate ammo item. These inventories are not officially tested; mirror the fire extinguisher pattern from your inventory's docs.