{"name":"ammo","title":"ammo","type":"command","url":"https://community.bistudio.com/wiki/ammo","revid":364083,"updated":"2024-05-03T19:33:29Z","groups":["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":"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","params":[{"name":"unit","type":"Object","type_expr":"Object"},{"name":"muzzle","type":"String","description":"weapon's muzzle - see the Weapons topic for reference about possible values","type_expr":"String"}],"returns":{"type":"Number","type_expr":"Number"},"form":"binary","left":{"text":"unit"},"right":{"text":"muzzle"}}],"examples":[{"code":["_count = player ammo \"M16\"; // returns 30 in case of a full magazine"]},{"code":["_count = player ammo \"M203Muzzle\";"]},{"code":["_count = player ammo primaryWeapon player;"]}],"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."}]}