My weapon is supposed to hit 2 times if pressed mouse once, but it either does 2 hits, or 1.
That's my code:
[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[/code]
[QUOTE=I'm great;43506412]-snipeh-[/QUOTE]
Why don't you just make it fire two bullets on primary attack instead of checking every tick? Unless the primary fire is something really complicated.
Sorry, you need to Log In to post a reply to this thread.