My weapon is supposed to hit 2 times if pressed mouse once, but it either does 2 hits, or 1.
That’s my code:
function SWEP:Think()
self:Stuff()
if CLIENT then return end
if ( self.Owner:KeyPressed( IN_ATTACK ) ) then
if self.Owner.lastpressed == nil or self.Owner.lastpressed + .3 < CurTime() then
self.Owner.lastpressed = CurTime()
self:PrimaryAttack()
self.doubleshoot = CurTime() +.3
end
end
if self.doubleshoot and CurTime() > self.doubleshoot then
self.doubleshoot = nil
self:PrimaryAttack()
self.stopattack = CurTime() +.6
end
if self.stopattack and CurTime() > self.stopattack then
self.stopattack = nil
self.doubleshoot = nil
end
end