• How to reset view punch when switching weapons?
    4 replies, posted
[CODE]function SWEP:Deploy() self.Weapon:SendWeaponAnim(ACT_VM_DRAW) self:SetPlaybackRate(1) self:SetNextPrimaryFire( CurTime() + 1.4 ) timer.Simple(0.4, function() if IsValid(self) and IsValid(self.Owner) then self.Owner:ViewPunch( Angle(0,2,1) ) end end) timer.Simple(0.15, function() if IsValid(self) and IsValid(self.Owner) then self.Owner:ViewPunch( Angle(3,0,0) ) end end) timer.Simple(0.7, function() if IsValid(self) and IsValid(self.Owner) then self.Owner:ViewPunch( Angle(-5,0,0) ) end end) timer.Simple(0.3, function() if IsValid(self) and IsValid(self.Weapon) then self.Weapon:EmitSound("weapons/fnx45/cloth.wav") end end) timer.Simple(0.4, function() if IsValid(self) and IsValid(self.Weapon) then self.Weapon:EmitSound("weapons/fnx45/5.wav") end end) timer.Simple(0.7, function() if IsValid(self) and IsValid(self.Weapon) then self.Weapon:EmitSound("weapons/fnx45/6.wav") end end) end[/CODE] I tried making a true and false statement but it wouldn't work Any suggestions?
I don't get what you're trying to do. Can you explain it in words? By your title, the answer would be to run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ViewPunchReset]Player:ViewPunchReset[/url] in the Holster method
[QUOTE=code_gs;51214013]I don't get what you're trying to do. Can you explain it in words? By your title, the answer would be to run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ViewPunchReset]Player:ViewPunchReset[/url] in the Holster method[/QUOTE] Basically, when you deploy with my swep, it would bounce up when pulling the slide of a pistol. The problem is that when youre switching to my gun and then immediently switch to another gun, the view punch still carries out. I can make a little vid of it if you need it
Use timer.Create instead of timer.Simple and remove the timer using timer.Remove or timer.Destroy on Holster.
[QUOTE=deinemudda32;51214114]Use timer.Create instead of timer.Simple and remove the timer using timer.Remove or timer.Destroy on Holster.[/QUOTE] Thank you so much bb [editline]16th October 2016[/editline] [QUOTE=code_gs;51214013]I don't get what you're trying to do. Can you explain it in words? By your title, the answer would be to run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/ViewPunchReset]Player:ViewPunchReset[/url] in the Holster method[/QUOTE] Thank you bb
Sorry, you need to Log In to post a reply to this thread.