{"name":"primaryWeapon","operator":null,"title":"primaryWeapon","type":"command","url":"https://community.bistudio.com/wiki/primaryWeapon","revid":349379,"updated":"2023-11-08T15:35:14Z","groups":["Unit Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"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 to get the weapon the unit is using.","syntaxes":[{"syntax":"primaryWeapon unit","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unit: Object"}],"returns":{"type":"String","types":["String"],"description":"weapon class name or \"\" if no primary weapon","text":"String - weapon class name or \"\" if no primary weapon"},"form":"unary","operator":null,"left":null,"right":{"text":"unit","types":["Object"]}}],"examples":[{"text":"```sqf\n_pWeap = primaryWeapon player;\n```","code":["_pWeap = primaryWeapon player;"]},{"text":"```sqf\nhint primaryWeapon player; // \"arifle_MX_ACO_pointer_F\"\n```","code":["hint primaryWeapon player; // \"arifle_MX_ACO_pointer_F\""]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["primaryWeaponMagazine","primaryWeaponItems","addPrimaryWeaponItem","removePrimaryWeaponItem","removeAllPrimaryWeaponItems","secondaryWeapon","handgunWeapon","currentWeapon","weapons"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Unit Inventory","Introduced with Operation Flashpoint version 1.75","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}