Disabling weapon bobbing?

Is there a way to disable weapon bobbing for ALL weapons temporarily? I’ve tried LocalPlayer:GetActiveWeapon().BobScale (and SwayScale), but neither are set.

Just because they aren’t set it doesn’t mean that setting them to 0 won’t have an impact. Have you tried it? Other then that I have no how to do it.

It won’t have any effect on HL2 weapons.

True, I hadn’t thought about that.
Edit: I found this. Although I don’t know if it does either: http://forum.facepunch.com/showthread.php?t=1263488

Turns out it’s even simpler than the one posted (the one posted doesn’t actually work).

local function CalcViewModelView( wep, vm, pos, ang )
  return pos, ang

hook.Add( "CalcViewModelView", "CalcViewModelView:NoBob", CalcViewModelView )

[editline]6th July 2014[/editline]

Damn, turns out that when you go into third person, it crashes.

if SERVER then return end

model = Model("models/VGUI/bloodanimation.mdl")

function HUDPaint()
	local ply = LocalPlayer()
	-- I know I shouldn't do this here, but it's just here whilst testing

hook.Add("HUDPaint", "HUDPaint", HUDPaint)

local function CalcViewModelView(wep, vm, pos, ang)
  return pos, ang

hook.Add("CalcViewModelView", "CalcViewModelView:NoBob", CalcViewModelView)