Knife help?

For some reason my knife shoots 2 bullets instead of just 1? It can back stab but if you do the next attack time is longer. This is only the code you need to understand this really. Primary and secondary attacks just send self:KnifeSwing( false ) or self:KnifeSwing( true )

Edit:
Fixed!
bullet.Num = 1 should be bullet.Num = 0




function SWEP:CanSwing( )
	
	local caniswing = false
	
	if CurTime() > self.NextSwing then caniswing = true  end
	
	return caniswing
	
end

function SWEP:SetNextSwing( nextswing )
	
	self.NextSwing = nextswing
	
end

function SWEP:KnifeSwing( crit )
	
	if !self:CanSwing() then return end
	
    self:TakePrimaryAmmo( 0 )
	self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
	
	if crit then
		self:SetNextSwing( CurTime() + self.Secondary.Delay )
	else
		self:SetNextSwing( CurTime() + self.Primary.Delay )
	end
	
	ply = self.Owner
	trace = ply:GetEyeTrace()
	ent = trace.Entity
	pos = trace.HitPos
	dist = ply:EyePos():Distance( pos )
	
	if dist < 80 then
		
		bullet = {}
		bullet.Num    = 1
		bullet.Src    = self.Owner:GetShootPos()
		bullet.Dir    = self.Owner:GetAimVector()
		bullet.Spread = Vector(0, 0, 0)
		bullet.Tracer = 0
		bullet.Force  = 100
		bullet.Damage = 25
		
		local sound = "weapons/knife/knife_hit"..math.random( 4 )..".wav"
		
		if ent and ent:IsPlayer() and crit then
			
			local yaw = ent:GetAngles().y
			local myyaw = ply:GetAngles().y
			
			if math.abs( math.AngleDifference( yaw, myyaw ) ) < 50 then
				
				bullet.Damage = 1000
				
				sound = "weapons/knife/knife_stab.wav"
				
			end
			
		end
		
		if trace.HitWorld then sound = "weapons/knife/knife_hitwall1.wav" end
		
		ply:EmitSound( sound )
		ply:FireBullets(bullet) 
		
		return
		
	end
	
	self.Weapon:EmitSound( "weapons/knife/knife_slash"..math.random( 2 )..".wav" )
	
end

I had an Issue like this on a 3 shot M16 I had made,

It would shoot 6 instead of 3,

I never truely looked into it, but I believe that Client and Shared had both sent the shoot func, or some bullshit

Like I said, I never looked into it, so Im probably wrong

If you want to test this put the bullet fire chunk under
[Lua]if ( SEVER ) then
<code>
end
[/Lua]

What is the point of the single arguments for math.random?
self:TakePrimaryAmmo(0) is pretty useless too.

Instead of putting 1, 4 you can just do 4 and the take ammo is to make sure it does not take ammo.