In trying to recreate the C3000-B1ATCH35 from call of duty zombies, I encountered a glitch that causes the gun to continue firing even though there is no ammo in the clip. The part I found especially odd is that when it fires it deducts from reserve ammo once the clip runs out (and will continue to fire after reserve ammo is gone) How do I stop the gun from firing once the clip is empty? Here’s what I’ve got.
AddCSLuaFile()
SWEP.Author = “McManager”
SWEP.Purpose = “Pew pew, kaboom.”
SWEP.Category = “Nazi Zombies”
SWEP.Spawnable = true
SWEP.UseHands = true
SWEP.ViewModel = “models/weapons/v_pist_usp.mdl”
SWEP.WorldModel = “models/weapons/w_pistol.mdl”
SWEP.ViewModelFOV = 75
SWEP.ViewModelFlip = true
SWEP.Primary.ClipSize = 6
SWEP.Primary.DefaultClip = 54
SWEP.Primary.Automatic = true
SWEP.Primary.Recoil = 3
SWEP.Primary.Ammo = “RPG_Round”
SWEP.CSMuzzleFlashes = true
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”
SWEP.PrintName = “C-3000 B1AT-CH35”
SWEP.Slot = 2
SWEP.SlotPos = 3
local ShootSound = Sound( “NPC_Hunter.FlechetteShoot” )
function SWEP:PrimaryAttack()
self:SetNextPrimaryFire( CurTime() + 1 )
self:TakePrimaryAmmo( 1 )
self:EmitSound( ShootSound )
self:ShootEffects( self )
if (!SERVER) then return end
local Forward = self.Owner:EyeAngles():Forward()
local ent = ents.Create( "grenade_ar2" )
if ( IsValid( ent ) ) then
ent:SetPos( self.Owner:GetShootPos() + Forward * 25 )
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn()
ent:SetVelocity( Forward * 3000 )
ent:SetOwner( self.Owner )
end
end