# QBCore Weapons

### Add Weapons to Core

{% hint style="info" %}
qb-core/shared/weapons.lua - (End of Script)
{% endhint %}

```lua
   [`weapon_huntingrifle`] = { name = 'weapon_huntingrifle', label = 'Hunting Rifle', weapontype = 'Sniper Rifle', ammotype = 'AMMO_HUNTINGRIFLE', damagereason = 'Sniped / Picked off / Scoped' },
   [`weapon_crossbow`] = { name = 'weapon_crossbow', label = 'Hunting Crossbow', weapontype = 'Sniper Rifle', ammotype = 'AMMO_ARROW', damagereason = 'Sniped / Picked off / Scoped' },
```

### QB-Weapons Config

{% hint style="info" %}
4\. qb-weapons/config.lua - (Around Line 170) (Inside Config.DurabilityMultiplier)
{% endhint %}

```lua
weapon_huntingrifle = 0.15,
weapon_crossbow = 0.15,
```

### QB-Weapons Recoil

{% hint style="info" %}
5\. qb-weapons/client/recoil.lua - (Around Line 87) (Inside recoils table)
{% endhint %}

```lua
[`weapon_huntingrifle`] = 0.5,
[`weapon_crossbow`] = 0.05,
```

### QB-Weapons Ammo

{% hint style="warning" %}
Important Follow Closely Location Varies on Version
{% endhint %}

There are **three unique versions** of **qb-weapons**. To ensure proper setup, you’ll need to determine your version and follow the corresponding steps.

#### How to Identify Your Version

Follow the instructions below to determine which version you’re using. Once identified, follow the appropriate step for that version.

⚠️ *Note: You only need to complete the step that matches your version!*

***

#### How to Find Your qb-weapons Version

1. Open `qb-weapons/server/main.lua` and **search for `AmmoTypes`**:
   * If you see a **table**, follow **Step A**.
2. Open `qb-weapons/config.lua` and **search for `Config.AmmoTypes`**:
   * If you see a **table**, follow **Step B**.
3. Open `qb-weapons/server/main.lua` and **search for `emp_ammo`**:
   * If you find a `CreateUsableItem` function, paste the code from **Part C** directly beneath it.

***

#### Step 6a

**File**: `qb-weapons/server/main.lua`\
**Location**: Around Line 217 (Inside `AmmoTypes` Table)\
**Add the following entries**:

```lua
gg_hunting_arrowammo = { ammoType = 'AMMO_ARROW', amount = 25 },
gg_hunting_rifleammo = { ammoType = 'AMMO_HUNTINGRIFLE', amount = 10 },
```

***

#### Step 6b

**File**: `qb-weapons/config.lua`\
**Location**: Around Line 12 (Inside `Config.AmmoTypes` Table)\
**Add the following entries**:

```lua
gg_hunting_arrowammo = { ammoType = 'AMMO_ARROW', amount = 25 },
gg_hunting_rifleammo = { ammoType = 'AMMO_HUNTINGRIFLE', amount = 10 },
```

***

#### Step 6c

**File**: `qb-weapons/server/main.lua`\
**Location**: Around Line 232

**Paste the following code beneath the `CreateUsableItem` function**:

```lua
QBCore.Functions.CreateUseableItem('gg_hunting_arrowammo', function(source, item)
    TriggerClientEvent('qb-weapons:client:AddAmmo', source, 'AMMO_ARROW', 25, item)
end)

QBCore.Functions.CreateUseableItem('gg_hunting_rifleammo', function(source, item)
    TriggerClientEvent('qb-weapons:client:AddAmmo', source, 'AMMO_HUNTINGRIFLE', 10, item)
end)
```
