---
name: "addWeapon"
type: command
status: ok
groups: ["Unit Inventory", "Vehicle Inventory"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/addWeapon
revid: 373145
updated: 2025-04-04T06:14:28Z
---

# addWeapon

*Command · Unit Inventory, Vehicle Inventory · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Locality: arguments **local** · effect **global**

## Description

Add a weapon to a unit. For a global version of this command see [addWeaponGlobal](../commands/addWeaponGlobal.md).

Infantry units can only carry a specific number of weapons, once the weapon slots are filled, any further [addWeapon](../commands/addWeapon.md) commands are ignored.

> [!NOTE]
> a **magazine** must be added first for the added weapon to be loaded.

> [!WARNING]
> In Arma 3 this command can also link items to the inventory slots, the functionality is identical to [linkItem](../commands/linkItem.md) command, which it global and thus differ in how it should be used.

## Syntax

### Syntax 1

```sqf
object addWeapon weapon
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - unit or vehicle to add the weapon to
- `weapon`: [String](../topics/String.md) - weapon class name. See the topic Category:Weapons for reference about possible values.

**Returns:** [Nothing](../topics/Nothing.md)

### Syntax 2

*since arma3 2.20*

```sqf
object addWeapon [weapon, autoselect]
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - unit or vehicle to add the weapon to
- `weapon`: [String](../topics/String.md) - weapon class name. See the topic Category:Weapons for reference about possible values.
- `autoselect`: [String](../topics/String.md) - (Optional, default [true](../commands/true.md)) [false](../commands/false.md) to abort weapon autoselection if no weapon was selected.

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
player addMagazine "30Rnd_556x45_Stanag";
player addWeapon "BAF_L85A2_RIS_SUSAT";
```

### Example 2

```sqf
An_2 addMagazine "100Rnd_762x51_M240";
An_2 addWeapon "M240_veh";
```

## See also

[addWeaponGlobal](../commands/addWeaponGlobal.md) · [addWeaponTurret](../commands/addWeaponTurret.md) · [removeWeapon](../commands/removeWeapon.md) · [removeAllWeapons](../commands/removeAllWeapons.md) · [addMagazine](../commands/addMagazine.md)

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