Thirdperson Angles!!!

Hi AGAIN!!! (I have lot’s of coding problems XD)

Shout out to: code_gs for solving the previous problem!

Now I have a thirdperson command but it show’s the player’s side?
I want so you can see your player’s head and ahead of him?
I was looking through the thirdperson lua file and found an Angles function but I don’t know how this works?
Plse Help!

Can you post the code?

This is the hole command. Try and find a way?

What? I meant the code of the thirdperson lua file you were referring to.

if ( CLIENT ) then

local on = false

local function toggle()

on = !on

if on == true then

	print( 'enabled' )
	
	LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode enabled." )

else

	print( 'disabled')
	
	LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode disabled." )

end

end

hook.Add( “ShouldDrawLocalPlayer”, “ThirdPersonDrawPlayer”, function()

if on and LocalPlayer():Alive() then

	return true

end

end )

hook.Add( “CalcView”, “ThirdPersonView”, function( ply, pos, angles, fov )

if on and ply:Alive() then

	local view = {}
	view.origin = pos - ( angles:Forward() * 70 ) + ( angles:Right() * 20 ) + ( angles:Up() * 5 )
	view.angles = ply:EyeAngles() + Angle( 1, 1, 0 )
	view.fov = fov

	return GAMEMODE:CalcView( ply, view.origin, view.angles, view.fov )

end

end )

concommand.Add( “thirdperson_toggle”, toggle )

end

if ( SERVER ) then

function ulx.thirdperson( calling_ply )

calling_ply:SendLua([[RunConsoleCommand("thirdperson_toggle")]])	

end
local thirdperson = ulx.command( “Utility”, “ulx thirdperson”, ulx.thirdperson, {"!thirdperson", “!3p”}, true )
thirdperson:defaultAccess( ULib.ACCESS_ALL )
thirdperson:help( “Toggles third person mode” )

end

[editline]24th September 2015[/editline]

[QUOTE]
if ( CLIENT ) then

local on = false

local function toggle()

on = !on

if on == true then

	print( 'enabled' )
	
	LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode enabled." )

else

	print( 'disabled')
	
	LocalPlayer():PrintMessage( HUD_PRINTTALK, "Third person mode disabled." )

end

end

hook.Add( “ShouldDrawLocalPlayer”, “ThirdPersonDrawPlayer”, function()

if on and LocalPlayer():Alive() then

	return true

end

end )

hook.Add( “CalcView”, “ThirdPersonView”, function( ply, pos, angles, fov )

if on and ply:Alive() then

	local view = {}
	view.origin = pos - ( angles:Forward() * 70 ) + ( angles:Right() * 20 ) + ( angles:Up() * 5 )
	view.angles = ply:EyeAngles() + Angle( 1, 1, 0 )
	view.fov = fov

	return GAMEMODE:CalcView( ply, view.origin, view.angles, view.fov )

end

end )

concommand.Add( “thirdperson_toggle”, toggle )

end

if ( SERVER ) then

function ulx.thirdperson( calling_ply )

calling_ply:SendLua([[RunConsoleCommand("thirdperson_toggle")]])	

end
local thirdperson = ulx.command( “Utility”, “ulx thirdperson”, ulx.thirdperson, {"!thirdperson", “!3p”}, true )
thirdperson:defaultAccess( ULib.ACCESS_ALL )
thirdperson:help( “Toggles third person mode” )

end

[QUOTE]

Where do you put that code?

-edit Of course you’d vote me dumb… I just don’t remember this stuff from a year ago and would like to be reminded how to do it. Sorry if I piss any of you off by me asking questions to obtain knowledge. I don’t mean to be a bother. Isn’t this forum to help anyways?

Why not go and mess around with the code and see what happens instead of having someone else do it for you? Even if you know nothing about coding there’s literally nothing stopping you. Just fool around and if you mess up, who honestly gives a shit? It’s better to learn from your mistakes than to keep making the same mistake. Here’s the bit of code you want to mess around with:


hook.Add( "CalcView", "ThirdPersonView", function( ply, pos, angles, fov )

    if on and ply:Alive() then

        local view = {}
        view.origin = pos - ( angles:Forward() * 70 ) + ( angles:Right() * 20 ) + ( angles:Up() * 5 )
        view.angles = ply:EyeAngles() + Angle( 1, 1, 0 )
        view.fov = fov

        return GAMEMODE:CalcView( ply, view.origin, view.angles, view.fov )

    end

end )