I’m trying to make a simple SWEP with ammo that auto replenishes, much like the airboat gun from HL2.
The gun will have 3 ammo, and 1 ammo will replenish every second.
Right now I’m just using this code in the think hook:
[LUA]SWEP.Primary.ClipSize = 3
SWEP.Primary.DefaultClip = 3
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “Pistol”
SWEP.ReloadCooldown = false
if CLIENT then return end
if (not self.ReloadCooldown) and self:Clip1() ~= 3 then
self.ReloadCooldown = true
print( “Running reload” )
timer.Simple(1, function() self.ReloadCooldown = false end)
However, this isn’t a very good solution because the player can still manually reload whenever.
Is there a way to just set the primary ammo that is in the gun, without having to give the player ammo that has to be reloaded in?
The player never needs to pick up ammo so I suppose using an ammo type is not needed, I just wanted to use the SWEP ammo system so that all the default functions for getting amount of ammo etc. would work.