{"name":"hasWeapon","title":"hasWeapon","type":"command","url":"https://community.bistudio.com/wiki/hasWeapon","revid":318541,"updated":"2022-05-13T09:14:18Z","groups":["Weapons","Unit Inventory"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"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.","syntaxes":[{"syntax":"unitName hasWeapon weaponName","params":[{"name":"unitName","type":"Object","type_expr":"Object"},{"name":"weaponName","type":"String","description":"the name of the weapon to check for.","type_expr":"String"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"returns true if the unit has the weapon, false if not."},"form":"binary","left":{"text":"unitName"},"right":{"text":"weaponName"}}],"examples":[{"code":["if !(player hasWeapon \"arifle_MX_ACO_pointer_F\") then { player addWeapon \"arifle_MX_ACO_pointer_F\" };"]}],"see_also":["weapons"],"notes":[{"user":"Benargee","date":"2014-09-11T10:49:00Z","text":"This command doesn't work for Items in Arma 3, use this instead (e.g ItemGPS).\n\n```sqf\n\"ItemGPS\" in (items player + assignedItems player)\n```\n\nReturns true if unit has gps in inventory, assigned or not."}]}