---
name: "BIS_fnc_addWeapon"
type: function
status: ok
groups: ["Inventory", "Weapons"]
arma3_since: "1.00"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_addWeapon
revid: 349361
updated: 2023-11-08T15:35:10Z
---

# BIS_fnc_addWeapon

*Function · Inventory, Weapons · Arma 3 v1.00*

## Description

Adds a weapon to the specified unit, with magazine classnames taken from the weapon's config (in CfgWeapons).
This function does not remove magazines nor weapons prior to adding the new weapon, so that still has to be done manually.

## Syntax

```sqf
[unit, weaponClassName, quantity, type] call BIS_fnc_addWeapon
```

**Parameters:**

- `unit`: [Object](../topics/Object.md) - unit to add weapon to.
- `weaponClassName`: [String](../topics/String.md) - weapon Classname (found in CfgWeapons).
- `quantity`: [Number](../topics/Number.md) - amount of magazines.
- `type`: [Number](../topics/Number.md) or [String](../topics/String.md) - (Optional, default 0)
  - [Number](../topics/Number.md) - Index of magazine name that should be used - found in `magazines = {}` array.
  - [String](../topics/String.md) - Magazine name to be used.

**Returns:** [String](../topics/String.md) - primary**(!)** muzzle name of weapon.

## Examples

### Example 1

Add 6 dual-purpose magazines and the underwater gun to the player:

```sqf
[player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;
```

### Example 2

Adds 2 × 30 Rnd Stanag Tracer (Red) magazines to bluforUnit, with an Mk20_F:

```sqf
[bluforUnit, "arifle_Mk20_F", 2, 1] call BIS_fnc_addWeapon;
```

### Example 3

Alternative syntax of second example, with magazine name written out:

```sqf
[bluforUnit, "arifle_Mk20_F", 2, "30Rnd_556x45_Stanag_Tracer_red"] call BIS_fnc_addWeapon;
```

## See also

[addWeapon](../commands/addWeapon.md) · [selectWeapon](../commands/selectWeapon.md)

## Community notes

**Tryteyker-** — 2014-09-29

This function only returns the primary muzzle name of a gun. For more info on how to select guns' secondary muzzle names (like an underhand grenade launcher), view the notes on [selectWeapon](../commands/selectWeapon.md).

<sub>Source: [BI Community Wiki — BIS fnc addWeapon](https://community.bistudio.com/wiki/BIS_fnc_addWeapon) (revision 349361).</sub>
