{"name":"currentWeaponMode","title":"currentWeaponMode","type":"command","url":"https://community.bistudio.com/wiki/currentWeaponMode","revid":379327,"updated":"2026-10-30T23:51:46Z","groups":["Weapons"],"status":"ok","games":{"arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2oa 1.50","arma3_since":"0.50","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> You can alternatively use\n>\n> ```sqf\n> _muzzle = weaponState player select 2;\n> ```","syntaxes":[{"syntax":"currentWeaponMode gunner","params":[{"name":"gunner","type":"Object","type_expr":"Object"}],"returns":{"type":"String","type_expr":"String","description":"current mode's classname"},"form":"unary","right":{"text":"gunner"}}],"examples":[{"code":["_weaponMode = currentWeaponMode player;"]},{"code":["_weaponMode = currentWeaponMode gunner vehicle player;"]}],"see_also":["ArmA: Actions","currentWeapon"],"notes":[{"user":"Pierre MGI","date":"2014-09-27T18:20:00Z","text":"- Be careful using this in script. This function returns these strings but also:\n- 0 if unit is in a vehicle (pax),\n- absolutely nothing if AH-99 helo driver or all weapons removed,\n- \"truckhorn2\" if Hunter driver...\nAbsolutely nothing means: if you use a hint to display the returned value, you obtain absolutely no text,no black box, no error! Hint isn't displayed and there is no error in rpt file with compile preprocessFileLineNumbers.\n\nOn the other hand, returned value 0 when unit is pax of a vehicle, could lead to a variable error type if your script is waiting for a string."},{"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```"}]}