How to reset view punch when switching weapons?


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

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

Player:ViewPunchReset in the Holster method

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.

Thank you so much bb

[editline]16th October 2016[/editline]

Thank you bb