3rd Person?

Is there anyway where when I press f2 it makes you got Third Person?

yeah with magic…

no… get an addon

bind F2 thirdperson

[editline]13th July 2013[/editline]

In console.

I think he means some sort of first person / third person toggle with f2 through lua; not a bind with console.

Here you go, it’s messy because I wrote it in about 5 minutes but it should do the trick.

[lua]
if( CLIENT ) then

function ThirdPersonUmsg( data )
	if( LocalPlayer().ThirdPerson == nil ) then
		LocalPlayer().ThirdPerson = true;
	else
		LocalPlayer().ThirdPerson = !LocalPlayer().ThirdPerson;
	end;	
end;
usermessage.Hook( "ThirdPerson", ThirdPersonUmsg );

function ThirdPerson( ply, pos, ang, fov )
	if( LocalPlayer().ThirdPerson ) then
		local view = {};
		view.origin = pos - ( ang:Forward() * 100 );
		view.angles = ang;
		view.fov = fov;
		
		return view;
	end;
end;
hook.Add( "CalcView", "ThirdPerson", ThirdPerson );

function ThirdPersonSDLP()
	if( LocalPlayer().ThirdPerson ) then
		return true;
	end;
end;
hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonSDLP", ThirdPersonSDLP );

else

function ToggleThirdPerson( ply )
	umsg.Start( "ThirdPerson", ply );
	umsg.End();
end;
hook.Add( "ShowTeam", "ToggleThirdPerson", ToggleThirdPerson );

end;
[/lua]

this goes in “garrys mod/lua/autorun” correct?

Yes, if it doesn’t work, you might need to add “AddCSLuaFile();” to the top, I just ran this through GCompute.

Is there a way to make the third person “camera” collide with walls?

Yep

[lua]
if( CLIENT ) then

function ThirdPersonUmsg( data )
	if( LocalPlayer().ThirdPerson == nil ) then
		LocalPlayer().ThirdPerson = true;
	else
		LocalPlayer().ThirdPerson = !LocalPlayer().ThirdPerson;
	end;	
end;
usermessage.Hook( "ThirdPerson", ThirdPersonUmsg );

function ThirdPerson( ply, pos, ang, fov )
	if( LocalPlayer().ThirdPerson ) then
		local view = {};
		local dist = 100;
		local trace = {};
		
		trace.start = pos;
		trace.endpos = pos - ( ang:Forward() * dist );
		trace.filter = LocalPlayer();
		local trace = util.TraceLine( trace );
		if( trace.HitPos:Distance( pos ) < dist - 10 ) then
			dist = trace.HitPos:Distance( pos ) - 10;
		end;
		view.origin = pos - ( ang:Forward() * dist );
		view.angles = ang;
		view.fov = fov;
		
		return view;
	end;
end;
hook.Add( "CalcView", "ThirdPerson", ThirdPerson );

function ThirdPersonSDLP()
	if( LocalPlayer().ThirdPerson ) then
		return true;
	end;
end;
hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonSDLP", ThirdPersonSDLP );

else

function ToggleThirdPerson( ply )
	umsg.Start( "ThirdPerson", ply );
	umsg.End();
end;
hook.Add( "ShowTeam", "ToggleThirdPerson", ToggleThirdPerson );

end;
[/lua]