{"name":"ammo","operator":null,"title":"ammo","type":"command","url":"https://community.bistudio.com/wiki/ammo","revid":364083,"updated":"2024-05-03T19:33:29Z","groups":["Unit Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"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.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Check how many rounds are left in the currently loaded magazine in the given muzzle.\n\n> [!NOTE]\n> In older titles and before Arma 3 v1.56, the command did not return ammo for units in vehicles.","syntaxes":[{"syntax":"unit ammo muzzle","since":null,"effect":null,"exec":null,"params":[{"name":"unit","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"unit: Object"},{"name":"muzzle","type":"String","optional":false,"default":null,"description":"weapon's muzzle - see the Weapons topic for reference about possible values","types":["String"],"since":null,"text":"muzzle: String - weapon's muzzle - see the Weapons topic for reference about possible values"}],"returns":{"type":"Number","types":["Number"],"description":null,"text":"Number"},"form":"binary","operator":null,"left":{"text":"unit","types":["Object"]},"right":{"text":"muzzle","types":["String"]}}],"examples":[{"text":"```sqf\n_count = player ammo \"M16\"; // returns 30 in case of a full magazine\n```","code":["_count = player ammo \"M16\"; // returns 30 in case of a full magazine"]},{"text":"```sqf\n_count = player ammo \"M203Muzzle\";\n```","code":["_count = player ammo \"M203Muzzle\";"]},{"text":"```sqf\n_count = player ammo primaryWeapon player;\n```","code":["_count = player ammo primaryWeapon player;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["setAmmo","someAmmo","magazines"],"notes":[{"user":".kju","date":"2012-02-17T22:38:00Z","text":"The command works (now?) also for units in vehicles. However only for the vehicle's gunners' weapons - aka those returned by \"weapons vehicle\"."},{"user":".kju","date":"2018-08-30T17:42:00Z","text":"Actually the command wants the `currentMuzzle (gunner _vehicle)` as parameter - not the weapon class.\nMost of the time both are the same. However when you have custom modes[] for the weapons, this is likely not true."}],"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.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}