# QB-Core

## Basics

For this example we will install 1 weapon of my store named "WEAPON\_GOLDM".

### Step 1

First open the file <mark style="color:blue;">"qb-core/shared/weapons.lua"</mark> and add the information of your weapon.

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

{% hint style="warning" %}

1. For <mark style="color:blue;">'name'</mark> should be the same of the spawn weapon.
2. You can change <mark style="color:blue;">'label'</mark> and <mark style="color:blue;">'ammotype'</mark> as your preference.
3. For <mark style="color:blue;">'weapontype'</mark> and <mark style="color:blue;">'damagereason'</mark> you should copy the same of the other vanilla weapons.
   {% endhint %}

### Step 2

Now open the file <mark style="color:blue;">"qb-core/shared/items.lua"</mark> and add more information of your weapon.

```lua
['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'},
```

{% hint style="warning" %}

1. For <mark style="color:blue;">'name'</mark> should be the same of the spawn weapon .
2. You can change <mark style="color:blue;">'label'</mark> , <mark style="color:blue;">'weight'</mark> , <mark style="color:blue;">'useable'</mark> , <mark style="color:blue;">'ammotype'</mark> , <mark style="color:blue;">'image'</mark> (this image should be in the html/images of your qb-inventory) and <mark style="color:blue;">'description'</mark> as your preference.
3. For <mark style="color:blue;">'type'</mark>, <mark style="color:blue;">'unique'</mark> you should copy the same of the other vanilla weapons.
   {% endhint %}

### \*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 <mark style="color:blue;">"qb-inventory/html/images"</mark> and paste the .png , should have the exact name that you used in Step 2 'image'.

<figure><img src="https://609666349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMWzL9tZxapGnBCRTCw5%2Fuploads%2FkytpF39CYqGAobr9rJkT%2Fimage.png?alt=media&#x26;token=5615ba86-8c6b-4086-834c-b561a21d175f" alt=""><figcaption></figcaption></figure>

### Step 3 (Adding Components)

First you need to know what components does your addon weapon have, usually you can find them in <mark style="color:blue;">'weaponcomponents.meta'.</mark>

<figure><img src="https://609666349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMWzL9tZxapGnBCRTCw5%2Fuploads%2FfaoYEcaYBy0BgSbxLTwB%2Fimage.png?alt=media&#x26;token=a10572dc-bb9f-4066-a600-bfc82699bf38" alt=""><figcaption><p>Usual path</p></figcaption></figure>

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

<figure><img src="https://609666349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgMWzL9tZxapGnBCRTCw5%2Fuploads%2FzMFvg2hSRX2E5svzTENB%2Fimage.png?alt=media&#x26;token=3019bc52-231d-43a9-a3d2-e4a0ccfd670b" alt=""><figcaption><p>Name of components</p></figcaption></figure>

Go to <mark style="color:blue;">"qb-weapons/config.lua"</mark> and add the information of your components.

```lua
['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',
        },
    },
```

{% hint style="warning" %}

1. For <mark style="color:blue;">'component'</mark> you should put the name of the component previously obtained in the weaponcomponents.meta.
2. For <mark style="color:blue;">'item'</mark> 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.
3. For <mark style="color:blue;">'type'</mark> 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...)
   {% endhint %}

That's all , hope you like it!.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://leoshop.gitbook.io/leoshop/weapons/installing/qb-core.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
