Assistance with CalcView

Hi, I am pretty new to Lua and lua syntax.

Do you know how this would be formatted correctly to be called via usmg? (yes, I know I should not use this sorry.)


function CCTV1()


function MyCalcView( ply, pos, angles, fov ) -- 2318.770508 3565.911621 438.446686;setang 14.424819 -179.576904 -0.002604
print "hello :3"
	local view = {}

	view.origin = Vector( 2318.770508, 3565.911621, 438.446686 )
	view.angles = Angle ( 14.424819, -179.576904, -0.002604 )
	view.fov = fov
	view.drawviewer = true

	return view


usermessage.Hook("CCTV1Cam", CCTV1)

Use hook.Add with CalcView. No need to network anything

So I’d hook it onto my CCTV1 function right?

Why? It literally just calls MyCalcView

Just hook MyCalcView. You don’t even have to declare the function explicitly; you can just do

hook.Add( "CalcView", "HookName", function( ply, pos, angles, fov )
  -- code
end )