help setting up third to first person on dark rp server

what i was shooting for was a script that would allow the player to have its view set to 3rd person when they pick either police or gang. but what happens is fp is set to over the shoulder.

P.S i checked out immersive first person and i liked it alot, if there was a way to set up somthing like that and be able to toggle to third person that would be cool.

any help would be great thanks.



local view = {}

function MyCalcView(player, pos, angles, fov)

if player:Team() == TEAM_POLICE && player:Alive() or player:Team() == TEAM_GANG && player:Alive() then
view.origin = pos-(angles:Forward()*100)
view.angles = angles
view.fov = fov

return view
end
end

hook.Add("CalcView", "MyCalcView", MyCalcView)

hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply)
return true

end)