Arma 3 Scripting

hasWeapon

  • Global argument
  • Arma 3 v0.50
  • First in Operation Flashpoint v1.00

Command · also in Unit Inventory · Markdown · JSON · original wiki page

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

unitName hasWeapon weaponName

Parameters:

Returns: Boolean - returns true if the unit has the weapon, false if not.

Examples

Example 1

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

See also

weapons

Community notes