Installation Instructions for gs_pepperspray
Follow these steps to properly install and configure your new resource:
-
Download the Resource
- Go to portal.cfx.re
-
Navigate to Assets > Granted Assets >
gs_pepperspray
- Download the resource
-
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]
)
-
Open the downloaded
-
Add to Server Configuration
- Open your
server.cfg
-
Add the following line:
ensure gs_pepperspray
- Open your
-
Restart the Server
- Restart your FiveM server (Important!)
-
Configure the Script (Optional)
- Navigate to
gs_pepperspray/config.lua
- Edit the configuration options to fit your server's needs
- Navigate to
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