Secondary doesn't take ammo but empties after 6 shots.


SWEP.AdminSpawnable = true
SWEP.ViewModelFOV = 90
SWEP.ViewModel = "models/weapons/v_alphamp5.mdl"
SWEP.WorldModel = "models/weapons/w_alphaglock.mdl"
SWEP.AutoSwitchTo = true
SWEP.Slot = 2
SWEP.HoldType = "shotgun"
SWEP.PrintName = "MP5"
SWEP.Author = ""
SWEP.Spawnable = true
SWEP.AutoSwitchFrom = true
SWEP.FiresUnderwater = true
SWEP.Weight = 5
SWEP.DrawCrosshair = true
SWEP.Category = "Half-life Alpha"
SWEP.SlotPos = 1
SWEP.DrawAmmo = true
SWEP.Instructions = ""
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.base = "weapon_base"

SWEP.Primary.Sound = ("v_alphaglock/hks1.wav")
SWEP.Secondary.Sound = ("v_alphaglock/glauncher.wav")

SWEP.Primary.Damage = 5
SWEP.Primary.TakeAmmo = 1
SWEP.Primary.ClipSize = -1
SWEP.Primary.Ammo = "smg1"
SWEP.Secondary.Ammo = "grenade"
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Spread = 0.4
SWEP.Primary.NumberofShots = 1
SWEP.Primary.Automatic = true
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Delay = 0.1
SWEP.Secondary.Delay = 1
SWEP.Primary.Force = 20
 
 
 
//SWEP:Initialize()\\
function SWEP:Deploy()
	timer.Simple( 0.50, function() self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) end)
end
function SWEP:Initialize()
        util.PrecacheSound("quake/reload.wav")
        self:SetWeaponHoldType( self.HoldType )
end
//SWEP:Initialize()\\
 
//SWEP:PrimaryFire()\\
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
        if self.Owner:GetAmmoCount("smg1") == 0 then
        self.Weapon:EmitSound("v_alphaglock/null.wav")
        return
        end
        //if ( !self:CanPrimaryAttack() ) then return end
        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 = 0
                bullet.Force = self.Primary.Force
                bullet.Damage = self.Primary.Damage
                bullet.AmmoType = self.Primary.Ammo
        local rnda = self.Primary.Recoil * -1
        local rndb = self.Primary.Recoil * math.random(-1, 1)
        self:ShootEffects()
        self.Owner:FireBullets( bullet )
		timer.Simple( 1.40, function() self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) end)
		local soundnumber = math.random(1,3)
	if soundnumber == 1 then
		self.Weapon:EmitSound("v_alphaglock/hks1.wav")
	elseif soundnumber == 2 then
		self.Weapon:EmitSound("v_alphaglock/hks2.wav")
	else
		self.Weapon:EmitSound("v_alphaglock/hks3.wav")
	end
        self.Weapon:EmitSound(Sound(self.Primary.Sound))
        self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
        self:TakePrimaryAmmo(self.Primary.TakeAmmo)
        self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end
//SWEP:PrimaryFire()\\
 
function SWEP:SecondaryAttack()
	if ( !self:CanSecondaryAttack() ) then return end
local ent = ents.Create("alpha_grenade")
local pos = self.Owner:GetShootPos()
local ang = self.Owner:GetAimVector():Angle()
pos = pos +ang:Forward() *40 +ang:Right() *-3 +ang:Up() *-7
ent:SetPos(pos)
ent:SetAngles(ang)
ent:SetOwner(self.Owner)
ent:SetExplodeDelay(2.1)
ent:Spawn()
ent:Activate()
ent:GetPhysicsObject():ApplyForceCenter(self.Owner:GetAimVector() * 6666)
self.Owner:FireBullets( bullet )
		local soundnumber = math.random(1,2)
	if soundnumber == 1 then
		self.Weapon:EmitSound("v_alphaglock/glauncher.wav")
else
		self.Weapon:EmitSound("v_alphaglock/glauncher2.wav")
	end
	self.Weapon:EmitSound(Sound(self.Secondary.Sound))
	self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
	self:TakeSecondaryAmmo(1)
	self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
			self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK );
end
 
/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()
end

You are not setting all of the SWEP.Secondary.* values.

If I do, it gives errors of weapon base. That’s why I came here.

Perfect. Just don’t post the latest code and error and expect us to help you.