{"name":"currentWeaponMode","operator":null,"title":"currentWeaponMode","type":"command","url":"https://community.bistudio.com/wiki/currentWeaponMode","revid":369197,"updated":"2024-09-03T10:34:48Z","groups":["Weapons"],"status":"ok","replaced_by":[],"games":[{"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":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns current weapon mode of unit's weapon.\n\n> [!WARNING]\n> This command will return 0 Number if given object is a vehicle instead of a person.\n>\n> You can alternatively use \n>\n> ```sqf\n> _muzzle = weaponState player select 2;\n> ```","syntaxes":[{"syntax":"currentWeaponMode gunner","since":null,"effect":null,"exec":null,"params":[{"name":"gunner","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"gunner: Object"}],"returns":{"type":"String","types":["String"],"description":"current mode's classname","text":"String - current mode's classname"},"form":"unary","operator":null,"left":null,"right":{"text":"gunner","types":["Object"]}}],"examples":[{"text":"```sqf\n_weaponMode = currentWeaponMode player;\n```","code":["_weaponMode = currentWeaponMode player;"]},{"text":"```sqf\n_weaponMode = currentWeaponMode gunner vehicle player;\n```","code":["_weaponMode = currentWeaponMode gunner vehicle player;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["ArmA: Actions","currentWeapon"],"notes":[{"user":"Sarogahtyp","date":"2022-07-04T12:48:33Z","text":"To set the firemode of the current weapon of a player, simply use the workaround described by Killzone_Kid in the first note of the forceWeaponFire wiki entry:\n\n```sqf\n_weapon = currentWeapon player;\n_ammo = player ammo _weapon;\nplayer setAmmo [_weapon, 0];\nplayer forceWeaponFire [_weapon, \"FullAuto\"];\nplayer setAmmo [_weapon, _ammo];\n```"}],"categories":["Arma 2: Operation Arrowhead: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 3: Scripting Commands","Command Group: Weapons","Introduced with Arma 2: Operation Arrowhead version 1.50","Scripting Commands","Take On Helicopters: Scripting Commands"]}