ShakeView Fix

So, I was searching through, when I found ShakeView. Really cool, viewbob mod. But, for some reason, it messes up all the ironsights on all the guns. Probably 'cause it edits view angles. But I know nothing about lua. If anyone could fix this old thing up and make it feasible, it would be greatly appreciated. Or, you could point me to another, working viewbob type mod. Either way, thanks in advance.

ShakeView v1.3

Ah, well usually it’s because iron sights have their own mode of modifying the player’s view, which interferes with the script. It’s not hard to play around with this and fix that problem. All you would need to do is disable the ShakeView all together if the current active weapon had iron sights enabled.

[editline]05:11PM[/editline]

[lua]local PCalcT = {}
PCalcT.VS = 0
PCalcT.WT = 0
PCalcT.Air = 0

function ShakeView(ply, origin, angles, fov)
if ply:GetActiveWeapon() && ply:GetActiveWeapon():IsValid() then
if ply:GetActiveWeapon():GetNWBool( “Ironsights” ) then
return
end
end
if ply:GetMoveType() == 8 then
return
elseif (not ply:IsOnGround()) or ply:InVehicle() then --hes in the air or in a car
PCalcT.Air = math.Clamp(PCalcT.Air + 1, 0, 300)
return
else
local vel = ply:GetVelocity()
local ang = ply:EyeAngles()
PCalcT.VS = PCalcT.VS * 0.9 + vel:Length() * 0.1
PCalcT.WT = PCalcT.WT + PCalcT.VS * FrameTime() * 0.1
local view = {}
view.origin = origin
view.ply = ply
view.fov = fov
view.angles = angles
if PCalcT.Air > 0 then
PCalcT.Air = PCalcT.Air - (PCalcT.Air/10) --make it end in 10 frames
view.angles.p = view.angles.p + (PCalcT.Air * 0.25)
view.angles.r = view.angles.r + PCalcT.Air*0.1
end
view.angles.r = angles.r + ang:Right():DotProduct(vel) * 0.01
view.angles.r = angles.r + math.sin( PCalcT.WT ) * PCalcT.VS * 0.001
view.angles.p = angles.p + math.sin( PCalcT.WT * 0.5 ) * PCalcT.VS * 0.001
return view
end
end
hook.Add(“CalcView”, “MyCalcView”, ShakeView)
Msg("ShakeView loaded…
")[/lua]

Fixed. Copy that code, and replace the inside of “cl_shakeview.lua” with it.

Is there anything you can’t do?

Yes. :frowning: