• Shooting with OnMousePressed?
    4 replies, posted
Im trying to make a gun that shoots when the left mouse button is pressed, instead of normal primary attack, but i cant figure out how to do. When the mouse button is released then i want to abort every timer i've created with the mouse button. Thanks.
Why? Why not just use normal primary attack in a SWEP?
Its because im making some kind of dubstep gun that shoots completely sync with the music and for this i need lots of timers. i need to stop the timers when i release the mouse button so the gun stops shooting. I just noticed that i only need to stop the timers when i release the mouse button (and/or switch weapons), but i actually think: "when im going to remove timers when the mouse button is released, why not creating them by pressing the mouse button?"
Because that involves somewhat more code. Create timers in SWEP:PrimaryAttack and remove them in SWEP:Holster and when player releases button, if self.Owner:KeyReleased(IN_ATTACK) then in SWEP:Think.
I'll try it when im home. Thank you again. edit: Everything works how in my imagination. Thank you :D
Sorry, you need to Log In to post a reply to this thread.