---
name: "addWeaponGlobal"
type: command
status: ok
groups: ["Vehicle Inventory", "Unit Inventory"]
arma3_since: "0.76"
locality: {"argument": "global", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/addWeaponGlobal
revid: 373148
updated: 2025-04-04T06:15:52Z
---

# addWeaponGlobal

*Command · Vehicle Inventory, Unit Inventory · Arma 3 v0.76*

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

## Description

Add a weapon to a unit. Infantry units can only carry weapons in their respective slots (primary, secondary and handgun),
the [addWeaponGlobal](../commands/addWeaponGlobal.md) command will replace the weapon currently in a slot with the added weapon if it shares the same slot.
This command can link items to respective slots as well, in which case the functionality is identical to [linkItem](../commands/linkItem.md).

To make sure the added weapon is loaded and ready, add the magazine first.

> [!NOTE]
> This command was broken when used on dedicated server and fixed on Arma 3 v2.00.

## Syntax

### Syntax 1

```sqf
object addWeaponGlobal weapon
```

**Parameters:**

- `object` : [Object](../topics/Object.md) - unit or vehicle to add the weapon to
- `weapon`: [String](../topics/String.md) - weapon class name

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

### Syntax 2

*since arma3 2.20*

```sqf
object addWeaponGlobal [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
{
    _x addMagazineGlobal "Laserbatteries";
    _x addWeaponGlobal "Laserdesignator";
} forEach allUnits;
```

### Example 2

```sqf
{
    if (typeOf _x == "O_Heli_Attack_02_black_F") then
    {
        _x addMagazineGlobal "38Rnd_80mm_rockets";
        _x addWeaponGlobal "rockets_Skyfire";
    };
} forEach vehicles;
```

## See also

[removeWeaponGlobal](../commands/removeWeaponGlobal.md) · [addWeapon](../commands/addWeapon.md) · [addMagazine](../commands/addMagazine.md) · [addMagazineGlobal](../commands/addMagazineGlobal.md)

## Community notes

**Killzone_Kid** — 2015-07-07

If you do not remove weapon first, using this command from dedicated server will duplicate weapon.

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