Installation Instructions for gs_weaponcustomizer
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_weaponcustomizer
- Download the resource
-
Extract the Files
-
Open the downloaded
.zip
file -
Inside, you'll find a folder named
gs_weaponcustomizer
-
Move the entire
gs_weaponcustomizer
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_weaponcustomizer
- Open your
-
Restart the Server
- Restart your FiveM server (Important!)
-
Configure the Script (Optional)
- Navigate to
gs_weaponcustomizer/config.lua
- Edit the configuration options to fit your server's needs
- Navigate to
Setting up the script
Standalone
If you are using a standalone server, so no framework/inventory system, then the script should work out of the box.
OX-Inventory
If you use ox-inventory, the script will automatically select the correct configuration files. The items related to each component is defined in config/items/ox.lua
and is configured for the default ox-inventory items (located in ox_inventory/data/weapons.lua
). So you do not need to do anything, it should work out of the box. Be sure to set Config.DisableAllItemRequirements = false
if you want to use the component items.
ESX
If you use esx, the script will automatically select the correct configuration files. The component-names from esx (located in es_extended/shared/config/weapons.lua
) are related to the actual components in config/items/esx.lua
. For the weapon_carbinerifle_mk2, there is a mistake in the component definition in es_extended. To fix this, go to the es_extended/shared/config/weapons.lua
file and replace the following line (769):
{ name = "scope_medium", label = TranslateCap("component_scope_medium"), hash = `COMPONENT_AT_SCOPE_MACRO_MK2` },
with this
{ name = "scope_small", label = TranslateCap("component_scope_medium"), hash = `COMPONENT_AT_SCOPE_MACRO_MK2` },
Make sure you spawn weapons through esx (like /giveweapon) if you want to save the component data. Changing components to weapons not registered to esx will cause the components not to be saved.
QB-Core
If you use qb-core, the script will automatically select the correct configuration files. The component-names from qb-core (located in qb-weapons/config.lua
) are related to the actual components in config/items/qb.lua
. To make qb-weapons compatible with gs_weaponcustomizer, make the following changes (otherwise the attachments won't be saved and items won't be added/removed):
Go to qb-weapons/server/main.lua, and replace line 296:
local function EquipWeaponAttachment(src, item)
with this:
function EquipWeaponAttachment(src, item)
Then, all the way at the bottom, add the following:
exports('EquipWeaponAttachment', EquipWeaponAttachment)
Be sure to set Config.DisableAllItemRequirements = false
if you want to use the component items.
Origen-Inventory
If you use Origen-Inventory, the script will automatically select the correct configuration files. The component-names from origen-inventory (located in origen_inventory/config/weaponoptions.lua
) are related to the actual components in config/items/qb.lua
. Origen-Inventory uses the same item names as qb-core, hence they use the same file.
Other inventory systems
In this case, you will have to add the logic for the respective inventory system, to add/remove the component items and to actually save the components on the weapon. This will most likely be needed in:
- cl_bridge.lua --> Functions.GetAvailableComponents
- sv_bridge.lua --> Functions.AddComponent
- sv_bridge.lua --> Functions.RemoveComponent
Lastly, you will need to replace the items in either esx.lua/ox.lua/qb.lua to the used items from your inventory system (also set Config.UsedComponentSystem
correctly). If you are unsure how to add/remove components in the respective inventory system, you should consult support for that specific inventory system with the corresponding author.