GM:CalcView

So im having trouble in running this function ( im really new to coding in lua, ive read and finished Java only)

Where do i put this? In gamemode? An Addon? or run it straight in console? is there and addon i can use run this type of code in?

Appreciate any help i cant get, even tho i know its a dumb question ive been trying to get it work and i cant figure it out.

This is the function they want to put in. GM:CalcView( Player ply, Vector origin, Angle angles, number fov, number znear, number zfar )

This is what the page shows

local function MyCalcView( ply, pos, angles, fov )
local view = {}

view.origin = pos-( angles:Forward()*100 )
view.angles = angles
view.fov = fov
view.drawviewer = true

return view

end

hook.Add( “CalcView”, “MyCalcView”, MyCalcView )

You can put it in whatever file you want to as long as it’s a clientside Lua file and it gets ran.

which one would be easiest? Do i need to call it or will it run auto?

If its on the folder autorun, as the name implies it will be ran automatically. In case its not in the autorun folder, then you should either include it or run it via a console command.

Ignore (problem was solved, typo found)