QB-Core
Correct installing of addon weapon in qb-core
Basics
For this example we will install 1 weapon of my store named "WEAPON_GOLDM".
Step 1
First open the file "qb-core/shared/weapons.lua" and add the information of your weapon.
For 'name' should be the same of the spawn weapon.
You can change 'label' and 'ammotype' as your preference.
For 'weapontype' and 'damagereason' you should copy the same of the other vanilla weapons.
Step 2
Now open the file "qb-core/shared/items.lua" and add more information of your weapon.
For 'name' should be the same of the spawn weapon .
You can change 'label' , 'weight' , 'useable' , 'ammotype' , 'image' (this image should be in the html/images of your qb-inventory) and 'description' as your preference.
For 'type', 'unique' you should copy the same of the other vanilla weapons.
*Step 2.1 (Optional, only if you want to put a different image for your weapon in inventory, needs to be called in Step 2 - 'image')
Go to "qb-inventory/html/images" and paste the .png , should have the exact name that you used in Step 2 'image'.
Step 3 (Adding Components)
First you need to know what components does your addon weapon have, usually you can find them in 'weaponcomponents.meta'.
Now open the file and you can see all the components that your weapon have.
Go to "qb-weapons/config.lua" and add the information of your components.
For 'component' you should put the name of the component previously obtained in the weaponcomponents.meta.
For 'item' you should put the item that it will be used for apply the component, it should be a existing item of your "qb-core/shared/items.lua", in this case we use the vanilla items for trigger the use of our components.
For 'type' you should copy the vanilla options or just don't use that option if you have extra components that are not in vanilla normal options (stocks,barrels,etc...)
That's all , hope you like it!.
Last updated