---
name: "hasWeapon"
type: command
status: ok
groups: ["Weapons", "Unit Inventory"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/hasWeapon
revid: 318541
updated: 2022-05-13T09:14:18Z
---

# hasWeapon

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

Locality: arguments **global**

## Description

Checks if a unit has the given weapon in hands or on back/in holster. Weapons inside unit containers such as vest and backpack are not counted.

## Syntax

```sqf
unitName hasWeapon weaponName
```

**Parameters:**

- `unitName`: [Object](../topics/Object.md)
- `weaponName`: [String](../topics/String.md) - the name of the weapon to check for.

**Returns:** [Boolean](../topics/Boolean.md) - returns true if the unit has the weapon, false if not.

## Examples

### Example 1

```sqf
if !(player hasWeapon "arifle_MX_ACO_pointer_F") then { player addWeapon "arifle_MX_ACO_pointer_F" };
```

## See also

[weapons](../commands/weapons.md)

## Community notes

**Benargee** — 2014-09-11

This command doesn't work for Items in Arma 3, use this instead (e.g ItemGPS).

```sqf
"ItemGPS" in (items player + assignedItems player)
```

Returns [true](../commands/true.md) if unit has gps in inventory, assigned or not.

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