Weapon and Attachment
For this section, if you do not have the minimum knowledge, or an experienced developer, avoid modifying or integrating custom weapons to your server to avoid errors, or problems with the inventory resource, with this we make clear that a support will not help you to configure a section like this to your server.
Both esx and qbcore will use config/weapons.lua, since this inventory is not compatible with external weapon assets such as qb-weapons or other similar ones.
This guide will help you set up new weapons, specifying the characteristics of each and adding attachments or tints in a standardized manner.
Basic Weapon Configuration
To add a weapon, define it in two main files:
items.lua
: Defines the general properties of the weapon.weapons.lua
: Defines additional details such as ammo type and in-game name.
Example Configuration in items.lua:
name
: Internal name of the weapon.label
: Display name in the game.weight
: Weight in the inventory.type
: Defines it as a weapon.ammotype
: Type of ammunition.image
: Image file name.unique
: Determines if the weapon is unique.rare
: Rarity level.description
: Brief description of the weapon.
Example Configuration in weapons.lua:
name
andlabel
as initems.lua
.weapontype
: Specific weapon type.ammotype
: Type of ammunition.damagereason
: Description of the damage caused.
Attachment and Tint Configuration
Naming Conventions to maintain consistency:
Attachments should follow the format
weapon_attachment
. Example:pistol_suppressor
.Tints (colors) should follow the format
color_weapontint
. Example:black_weapontint
.
Example Attachment Configuration for WEAPON_PISTOL:
Each attachment has:
component
: In-game identifier.item
: Attachment name in the inventory, following the formatweapon_attachment
.
Example Attachments:
defaultclip: Standard weapon clip.
extendedclip: Extended clip.
flashlight: Flashlight for illumination.
suppressor: Silencer to reduce noise.
You must add these attachments in Config.WeaponAttachmentItems as this example shows:
Weapon Durability Configuration
To customize durability, use Config.DurabilityMultiplier
where higher values represent faster degradation.
Example Durability Configuration:
Weapon Repair Configuration
You can set repair points where players repair weapons for a fee.
Example Repair Point Configuration:
Last updated