Add-on weapons: meta files, weapons.meta and sounds
In short
An add-on weapon is a new WEAPON_… name with its own model, textures and meta files, and it sits beside the stock weapons. A replace streams files under a stock weapon’s names instead, so that weapon changes for everyone.
my_pistol/
fxmanifest.lua
meta/
weapons.meta
weaponarchetypes.meta
weaponanimations.meta
weaponcomponents.meta
pedpersonality.meta
stream/
w_pi_mypistol.ydr
w_pi_mypistol.ytd
w_pi_mypistol_mag1.ydrfx_version 'cerulean'
game 'gta5'
files {
'meta/weaponcomponents.meta',
'meta/weaponarchetypes.meta',
'meta/weaponanimations.meta',
'meta/pedpersonality.meta',
'meta/weapons.meta',
}
data_file 'WEAPONCOMPONENTSINFO_FILE' 'meta/weaponcomponents.meta'
data_file 'WEAPON_METADATA_FILE' 'meta/weaponarchetypes.meta'
data_file 'WEAPON_ANIMATIONS_FILE' 'meta/weaponanimations.meta'
data_file 'PED_PERSONALITY_FILE' 'meta/pedpersonality.meta'
data_file 'WEAPONINFO_FILE' 'meta/weapons.meta'
client_script 'names.lua'AddTextEntry('WT_MYPISTOL', 'My Pistol')| Replace | Add-on | |
|---|---|---|
| How | Stream files with vanilla names (w_pi_pistol.ydr) | New WEAPON_… with its own meta files |
| Meta files | None needed | weapons, archetypes, animations (+ components) |
| Inventory | Nothing to add | Add the weapon and its item |
| Use for | Skins and vanilla overhauls | When players should have both |
weaponarchetypes.meta: everymodelNameandtxdNamehas to equal the streamed file name exactly, without the extension.weaponanimations.meta: copy the entries of the stock weapon yours most resembles, and change nothing but the weapon key.<HumanNameHash>in weapons.meta is the text key thatAddTextEntryregisters.
weapons.meta holds CWeaponInfo items inside a CWeaponInfoBlob. Of everything in an item, only these fields are ones you are likely to edit.
| Field | Controls |
|---|---|
Name | The weapon name, e.g. WEAPON_MYPISTOL |
Model | The streamed model name |
Slot | Which weapon wheel slot it uses |
AmmoInfo | The ammo type, e.g. AMMO_PISTOL — weapons sharing a type share ammo |
ClipSize | Rounds per magazine |
Damage | Base damage per bullet |
HeadShotDamageModifierPlayer | Headshot multiplier against players |
DamageFallOffRangeMin / Max / Modifier | How damage drops with distance |
TimeBetweenShots | Fire rate (seconds between shots) |
WeaponRange | Maximum range |
RecoilShakeHash / RecoilShakeAmplitude | Visual recoil shake |
WeaponFlags | Behaviour flags |
AttachPoints | Which components attach to which bone |
HumanNameHash | The display name key |
The same file names the weapon’s audio. Pointing it at another weapon’s sound is a one-line change; fully custom sounds need audio banks.
<Audio>AUDIO_ITEM_…</Audio>in weapons.meta selects the sound set, and an add-on can simply reuse a stock one.- Fully custom sounds are
.awcwave packs plus.relaudio data, streamed through theAUDIO_WAVEPACK,AUDIO_GAMEDATAandAUDIO_SOUNDDATAdata files. - Players can install sound packs on their own client. sv_pureLevel 1 still lets audio mods through; level 2 blocks them.
Go deeper:How to add a custom weapon to a FiveM server →Replacing vanilla weapons or adding new ones →weapons.meta explained, field by field →weaponarchetypes.meta: tying a weapon model to its textures →weaponanimations.meta: how a weapon is held and handled →Giving weapons proper display names →Changing weapon damage in FiveM →Changing weapon sounds in FiveM →