check_ammo
Returns the current gun being held and the ammo & ammo text of said gun
modules.check_ammo()
Parameters
none
Example
local ammo, ammo_text gun = modules.check_ammo()
if not gun then return end
-- checks if the gun ammo is 0
-- ammo - the ammo in the mag
-- ammo_text - the ammo text which is all the ammo and not just the current ammo of the mag
if tonumber(ammo) == 0 and tonumber(ammo_text) == 0 then
local ammo_part = modules.get_ammo(gun.Name)
modules.buy(ammo_part) -- it will also automatically reload any tool that you're holding
end
Last updated