FiveM Modding Tutorial
Hi guys! I finally bring you my tutorial on adding new weapons to your server! No more replacing those weapons of yours. So if you read my tutorial on melee weapons, you will find some similarities here. This will require OpenIV.
NOTE: this is a basic setup for streaming add-on weapons. This will not spoonfeed you on exactly what you want to do. You will need to research for the weapon you want to create.
UPDATE: 11/3/19 – Weapon Component pool size has been increased!
UPDATE: 6/15/20 – Documentation coming soon.
Step 1: Choosing your model
So why is this a step?
GTA V reads 2 different models when loading your weapon, one being your base model, and the other one being the Hi def model. You will find that some weapon mods on sites (Like GTA5-MODS) will only have the HI def model. These cannot be streamed if the creator of the mod did not make the base model. Here is an example of what is correct;
If the mod also includes the HI def textures, these may be included IF the base model is present.
Step 2: Resource Setup
Ok! The model has been selected and we are ready to setup the resource! Put your models into a “stream” folder.
Next; you will need your META files for these weapons! back to my example for the AK47 NEON, I have copied the META files from the ASSAULT RIFLE. These can be found in OPENIV. here is what I have; (Red lines meaning these files are not required.)
Next; to setup our __resource.lua. Make sure that your Weapons.meta is AFTER everything else, (in this case, my Weapons.meta is renamed to WeaponAKP.meta) and your weaponcomponents.meta being loaded first, otherwise some things will not work! Here is my example;
Once that is squared away, you can proceed with editing/adding weapons!
Step 3: Weapon.meta editing
The weapon meta is the main configuration of the gun; what it’ll shoot, how fast, what it is classified as, etc. First is the ordering of the weapons, which is shown as below;
As you can tell; the numbers do not really matter, as long as they are not the same as another weapon.
The slot name should be identical to the weapon for that slot.
Next is the basic weapon information;
Here, you list the name of the weapon, the audio for it, slot, etc. everything on the top is pretty self explanatory, and mostly what you want to edit. Change the name, model, and slot. Then simply scroll down until you find “ATTACHPOINTS” like so;
and simply change the name to “COMPONENT_WEAPONNAME_CLIP_01” to set up the gun’s magazine for later. You can also add more attachments for the weapon here as well.
If you are just adding a basic weapon; you are now finished!
Step 4: Weaponcomponents.meta editing
Next we will set up the components for the gun! Really, this part is just a cut and paste.
All you need to do here is change the name, model, and clip size (if it is a magazine) to your liking. The clip size here will override what you put in weapons.meta.
Step 5: Weapon animations
This part will be a full on copy and paste. Find what your add-on weapon would originally replace (EX. My AK47 would replace the ASSAULT RIFLE, so you would copy the animations from an ASSAULT RIFLE in the Weaponanimations.meta in OpenIV.) Make sure you copy all animations that are for that weapon, then change the name of the weapon to the name you set in Weapons.meta
Step 6: Other Meta files
Finally; we will finish the other meta files. Only the weaponarchetypes and pedpersonality metas should be left.
For the weaponarchetypes, the format is always the same, just change the names. You should have any weapons/weapon components that you are adding in here
And lastly; The Pedpersonality.meta
There are 4 categories for this meta; unarmed, 1h, 2h, and minigun.
Unarmed is any melee weapon or any handheld bombs
1h is Pistols, and small SMG’s
2h is Anything else but minigun
Minigun is… well the minigun.
Follow the format that is given in any pedpersonality.meta in OpenIV. The only thing you change in here the weapon names like so;
Once this is done, you are finished!
Now just load up your server, and spawn in your weapon! Yay!
Hope you guys find use in this, and hope this opens your server up to much more!
A few other notes
This tutorial was made simple for now just because of my time restraints. Over time, I will add more information here to make it more accessible to people who have troubles finding certain information. This tutorial does not include pointers for making weapons such as RPG’s or bombs, but these are not hard to make. This tutorial was made to show you the basics of setting up your add-on weapon(s)
There is no template for this tutorial as this tutorial is a basic format for any weapon. Though, you can use the template from the melee tutorial, and replace what’s needed.
Q: Is there any restrictions as to how much I can add?
A: For the weapons themselves, I have not noticed yet.
Q: I want to use vehicle weapon ammo for my guns. Is this possible?
A: Yes. Might be buggy, but it is possible to tweak it correctly.
Q: My weapon isn’t showing!
A: Check to make sure all the names match up & you are actually streaming your models!
Q: My weapon shows up… But where’s my attachments?
A: Make sure you are streaming the model for the attachments, the attachments are identified in Weaponarchetypes.meta, and the default value is set to TRUE for the attachment in Weapons.meta if the gun is to have it by default.
Q: Can I use clips/attachments from other weapons?
A: Yes! Just make sure you set them in Weapons.meta
Q: Isn’t there supposed to be a pickups.meta with the gun?
A: Technically, yes. But I have yet to get this to work properly. FiveM has troubles with mounting/unmounting this file, and causes crashes. I just use pickups from other guns for now. If anyone finds a fix for this before me, be sure to inform me!
Original source: https://forum.cfx.re/t/how-to-stream-add-on-weapons/293807