SWEP is not empty when ammo=0 ?

For some reason, the secondary fire for an SWEP i created does not stop once the ammo has reached zero. the SWEP is running off of 2 different ammo banks, and when the “bank” for the secondary is empty, you can still fire. and as well as there seems to be a glitch where when reloading it takes from the secondary ammo bank and refills the primary. any ideas?

//Created by LeadJackal, part of CSWEPS
SWEP.ViewModelFlip = false;
SWEP.Category = “CSWEPS”;
SWEP.Author = “LeadJackal”;
SWEP.Contact = “”;
SWEP.Purpose = “To bust caps”;
SWEP.Instructions = “LMB - fire | RMB - grenade”;
SWEP.PrintName = “M4a1”;
SWEP.Slot = 2;
SWEP.SlotPos = 1;
SWEP.DrawCrosshair = true;
SWEP.DrawAmmo = true;
SWEP.ViewModel = “models/weapons/v_rifle.mdl”;
SWEP.WorldModel = “models/weapons/w_rifle.mdl”;
SWEP.ViewModelFOV = 70;
SWEP.ReloadSound = “weapons/ar2/ar2_reload_push.wav”;
SWEP.HoldType = “SMG1”;
SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;
SWEP.Weight = 14;
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = true;
SWEP.FiresUnderwater = false;

SWEP.Primary.RPG = false
SWEP.Primary.Sound = “weapons/ar2/fire1.wav”
SWEP.Primary.Tracer = 5;
SWEP.Primary.Automatic = true;
SWEP.Primary.Force = 10;
SWEP.Primary.FireFromHip = true;
SWEP.Primary.Weld = false;
SWEP.Primary.Ammo = “ar2”;
SWEP.Primary.BulletShot = true;
SWEP.Primary.BreakAll = false;
SWEP.Primary.Ignite = false;
SWEP.Primary.ClipSize = 30;
SWEP.Primary.DefaultClip = 90;
SWEP.Primary.Recoil = 0.8;
SWEP.Primary.Damage = 38;
SWEP.Primary.NumberofShots = 1;
SWEP.Primary.Spread = 0.2;
SWEP.Primary.Delay = 0.1;
SWEP.Primary.TakeAmmo = 1;

SWEP.Secondary.Sound = “weapons/mortar/mortar_fire1.wav”
SWEP.Secondary.Tracer = 1;
SWEP.Secondary.Force = 50;
SWEP.Secondary.Automatic = false;
SWEP.Secondary.FireFromHip = true;
SWEP.Secondary.Ammo = “rpg_round”;
SWEP.Secondary.ClipSize = 3;
SWEP.Secondary.DefaultClip = 0;
SWEP.Secondary.Weld = false;
SWEP.Secondary.ExplosionShot = false;
SWEP.Secondary.BreakAll = false;
SWEP.Secondary.Ignite = false;
SWEP.Secondary.Recoil = 7;
SWEP.Secondary.Spread = 0.1;
SWEP.Secondary.Delay = 2;
SWEP.Secondary.Automatic = false;
SWEP.Secondary.Sound = “weapons/mortar/mortar_fire1.wav”;
SWEP.Secondary.TakeAmmo = 1;
SWEP.Secondary.ExplosionSound = “weapon_AWP.Single”;
SWEP.Secondary.ExplosionSoundDistance = 400;
SWEP.Secondary.ExplosionSize = 175;

function SWEP:Initialize()
util.PrecacheSound(self.Primary.Sound);
util.PrecacheSound(self.Secondary.Sound);
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType );
end
end

function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end

//Default stuff, normally used in any condition.
local tr = self.Owner:GetEyeTrace();
self.Weapon:EmitSound ( self.Primary.Sound );
self:ShootEffects();
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay );
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay );
self:TakePrimaryAmmo(1);
local rnda = -self.Primary.Recoil;
local rndb = self.Primary.Recoil * math.random(-1, 1);
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) );

//The attack mode, can vary from the user settings
if ( self.Primary.BulletShot ) then
local bullet = {};
bullet.Num = self.Primary.NumberofShots;
bullet.Src = self.Owner:GetShootPos();
bullet.Dir = self.Owner:GetAimVector();
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0);
bullet.Tracer = self.Primary.Tracer;
bullet.Force = self.Primary.Force;
bullet.Damage = self.Primary.Damage;
bullet.AmmoType = self.Primary.Ammo;
self.Owner:FireBullets( bullet );
end
if ( self.Primary.BreakAll ) then
if( tr.Entity:IsValid() and tr.Entity:GetClass() == “prop_physics” ) then
constraint.RemoveAll( tr.Entity );
local physobject = tr.Entity:GetPhysicsObject();
physobject:EnableMotion( true );
physobject:SetVelocity( self.Owner:GetAimVector() * 2 );
end
end

if ( self.Primary.Ignite ) then
    if (!tr.Entity) then return false end
    if (!tr.Entity:IsValid() ) then return false end
    if (tr.Entity:IsPlayer()) then return false end
    if (tr.Entity:IsWorld()) then return false end
    if ( CLIENT ) then return true end
    local Time = math.random(20);
    tr.Entity:Extinguish();
    tr.Entity:Ignite( Time, 0 );
end

end

function SWEP:SecondaryAttack()
if ( !self:CanPrimaryAttack() ) then return end

//Default stuff, normally used in any condition.
local tr = self.Owner:GetEyeTrace();
self.Weapon:EmitSound ( self.Secondary.Sound );
self:ShootEffects();
self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay );
self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay );
self:TakeSecondaryAmmo(1);
local rnda = -self.Secondary.Recoil;
local rndb = self.Secondary.Recoil * math.random(-1, 1);
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) );

if ( self.Secondary.ExplosionShot ) then
local explode = ents.Create( “env_explosion” );
explode:SetPos( tr.HitPos );
explode:SetOwner( self.Owner );
explode:Spawn();
explode:SetKeyValue( “iMagnitude”, self.Secondary.ExplosionSize );
explode:Fire( “Explode”, 0, 0 );
explode:EmitSound( self.Secondary.ExplosionSound, self.Secondary.ExplosionSoundDistance, self.Secondary.ExplosionSoundDistance );
explode.AmmoType = self.Secondary.Ammo;
end
if ( self.Secondary.BreakAll ) then
if( tr.Entity:IsValid() and tr.Entity:GetClass() == “prop_physics” ) then
constraint.RemoveAll( tr.Entity );
local physobject = tr.Entity:GetPhysicsObject();
physobject:EnableMotion( true );
physobject:SetVelocity( self.Owner:GetAimVector() * 2 );
end
end
if ( self.Secondary.Ignite ) then
if (!tr.Entity) then return false end
if (!tr.Entity:IsValid() ) then return false end
if (tr.Entity:IsPlayer()) then return false end
if (tr.Entity:IsWorld()) then return false end
if ( CLIENT ) then return true end
local Time = math.random(20);
tr.Entity:Extinguish();
tr.Entity:Ignite( Time, 0 ); end
end

function SWEP:Think()
end

function SWEP:Reload()
self.Weapon:DefaultReload(ACT_VM_RELOAD);
return true
end

function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW);
return true
end

function SWEP:Holster()
return true
end

function SWEP:OnRemove()
end

function SWEP:OnRestore()
end

function SWEP:Precache()
end

function SWEP:OwnerChanged()
end


(User was banned for this post ("Wrong section" - mahalis))

Yeah, theres no way we’re reading that if its not in LUA tags…