I've seen other posts helping people out on this and they give the code but I have no idea where to put this code and its all confusing me. Can someone maybe write something that allowed people to toggle thirdperson and firstperson useing f4. This would be greatly appreciated, and please make sure that the third person camera collideswith walls. Thanks so much guys! Finally please tell me where the code is supposed to go!
Can you post the code you've been seeing?
[CODE]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 );
[/CODE]
Would this work? If so where does it go?
lua/autorun.
Sorry, you need to Log In to post a reply to this thread.