---
name: "primaryWeapon"
type: command
status: ok
groups: ["Unit Inventory"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/primaryWeapon
revid: 349379
updated: 2023-11-08T15:35:14Z
---

# primaryWeapon

*Command · Unit Inventory · Arma 3 v0.50 · introduced in Operation Flashpoint v1.75*

Locality: arguments **global**

## Description

Returns name of unit's primary weapon. This command will also return a weapon class name if the weapon is not used by the player, for example, it is on the unit's back. Use [currentWeapon](../commands/currentWeapon.md) to get the weapon the unit is using.

## Syntax

```sqf
primaryWeapon unit
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)

**Returns:** [String](../topics/String.md) - weapon class name or "" if no primary weapon

## Examples

### Example 1

```sqf
_pWeap = primaryWeapon player;
```

### Example 2

```sqf
hint primaryWeapon player; // "arifle_MX_ACO_pointer_F"
```

## See also

[primaryWeaponMagazine](../commands/primaryWeaponMagazine.md) · [primaryWeaponItems](../commands/primaryWeaponItems.md) · [addPrimaryWeaponItem](../commands/addPrimaryWeaponItem.md) · [removePrimaryWeaponItem](../commands/removePrimaryWeaponItem.md) · [removeAllPrimaryWeaponItems](../commands/removeAllPrimaryWeaponItems.md) · [secondaryWeapon](../commands/secondaryWeapon.md) · [handgunWeapon](../commands/handgunWeapon.md) · [currentWeapon](../commands/currentWeapon.md) · [weapons](../commands/weapons.md)

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