ViewPunch - Tremble

When I hold the button screen starts to shake, how to fix it?

[LUA]
if ply:KeyDown(IN_MOVELEFT) then
ply:ViewPunch( Angle( 0, 0, math.sin( 3.4 ) ) )
elseif ply:KeyDown(IN_MOVERIGHT) then
ply:ViewPunch( Angle( 0, 0, math.sin( -3.4 ) ) )
end
[/LUA]

Maybe, there another way to do this?

You don’t fix it, it’s intended.
Do OnKeyPress hook or something, I don’t remember it’s name. But there has to be a hook.

But I need the camera tilted until the button is released.
Maybe ViewPunch() is not right way to do this?

Use the calcview hook and return the new angle.
For an example look at the yellow marked lines: https://github.com/LennyPenny/Lennys/blob/master/lua/Lenny/pkiller.lua#L44-L52

I used it for my tttpropkill thingy.