Bullets and Framerate

I’ve run across a strange problem in my code that doesn’t occur in other weapons I’ve wrote.



function SWEP:PrimaryAttack( )
	if not IsFirstTimePredicted( ) then
		return
	end

	if self.Reloading then
		self.Reloading = false
		return
	end
	
	if self.Locked then
		return
	end
	
	if self:Clip1( ) < 1 then
		self:PlaySound( "Dry Fire" )
		if self.Irons then
			self:PlayAnimation( "Ironsights Dry Fire", true )
		else
			self:PlayAnimation( "Dry Fire", true )
		end
		return
	end
	
	local bullet
	
	bullet = { }
	
	bullet.Src 	= self.Owner:GetShootPos( )
	bullet.Dir 	= self.Owner:GetAimVector( )
	bullet.Damage 	= self.Primary.Damage
	bullet.Attacker = self.Owner
	bullet.Num 	= 1
	bullet.Spread	= Vector( self.Primary.Cone, self.Primary.Cone, self.Primary.Cone )
	bullet.Force	= math.random( 3, self.Primary.Damage )
	bullet.Tracer	= 1
	
	if self.Irons then
		self:PlayAnimation( "Ironsights Fire", true )
	else
		self:PlayAnimation( "Fire", true )
	end
	
	self:PlaySound( "Fire" )
	self.Owner:FireBullets( bullet )
	self:TakePrimaryAmmo( 1 )
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
end


PlaySound( string ) and PlayAnimation( string [, bool, number ] ) are wrappers for doing what they say on the tin.

The code runs fine, but clientside there tends to be multiple bullets shot. If I limit my framerate to 60 ( with fps_max ), the problem is entirely gone. This issue also does not persist across other weapons.

Does anyone know why it is happening to this weapon ( and any based off of it )? IsFirstTimePredicted should be preventing this from happening, but it doesn’t actually seem to be working.

It doesn’t stop the weapon from working, it just looks stupid.

Edit:

Resolved, used manual timing instead.