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.

[`weapon_goldm`] 		 = {['name'] = 'weapon_goldm', 	 	['label'] = 'GOLDM', 				['weapontype'] = 'Assault Rifle',	['ammotype'] = 'AMMO_RIFLE',	['damagereason'] = 'Ended / Rifled / Shot down / Floored'},

Step 2

Now open the file "qb-core/shared/items.lua" and add more information of your weapon.

['weapon_goldm'] 		 = {['name'] = 'weapon_goldm', 	 	  	['label'] = 'GOLDM', 			['weight'] = 1000, 		['type'] = 'weapon', 	['ammotype'] = 'AMMO_RIFLE',			['image'] = 'weapon_carbinerifle.png', 	['unique'] = true, 		['useable'] = true, 	['description'] = 'A lightweight automatic rifle'},

*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'.

Usual path

Now open the file and you can see all the components that your weapon have.

Name of components

Go to "qb-weapons/config.lua" and add the information of your components.

['WEAPON_GOLDM'] = {
        ['defaultclip'] = {
            component = 'COMPONENT_GOLDM_CLIP_01',
            item = 'carbinerifle_defaultclip',
            type = 'clip',
        },
        ['extendedclip'] = {
            component = 'COMPONENT_GOLDM_CLIP_02',
            item = 'carbinerifle_extendedclip',
            type = 'clip',
        },
        ['drum'] = {
            component = 'COMPONENT_GOLDM_CLIP_03',
            item = 'carbinerifle_drum',
            type = 'clip',
        },
        ['suppressor'] = {
            component = 'COMPONENT_AT_GOLDM_SUPP',
            item = 'rifle_suppressor',
        },
    },

That's all , hope you like it!.

Last updated