Thirdperson code ( doesn't go through walls )

Hey guys, just releasing this simple thirdperson script I made that doesn’t go through walls.


 if CLIENT then
	local thirdperson_enabled = false


	hook.Add("CalcView","Thirdperson",function(ply,pos,ang,fov,nearz,farz)
		if not thirdperson_enabled then return end

		local tr = util.TraceLine( {
			start = pos,
			endpos = pos-(ang:Forward()*100),
			filter = nil
		} )

		local view = {}

		view.origin = tr.HitPos
		view.angles = angles
		view.fov = fov

		return view

	end)
	
	hook.Add("ShouldDrawLocalPlayer","Thirdperson_ShouldDrawPlayer",function(ply)
		return thirdperson_enabled
	end)

	net.Receive("thirdperson_toggle",function(len)
		thirdperson_enabled = not thirdperson_enabled
	end)


else
	
	util.AddNetworkString("thirdperson_toggle")

	concommand.Add("thirdperson_toggle",function(ply,cmd,args)

		net.Start("thirdperson_toggle")
		net.Send(ply)
	end)

	
end

function SchoolShow( ply )
	concommand.Run( ply, "thirdperson_toggle" )
end
hook.Add("ShowSpare2", "School", SchoolShow) 

Move that into lua/autorun and name the file what you want. Press F4 to toggle.

thx for the script the only issue is when you jump the view pops into the player model head also the cross is behind the player model , but its still cool :slight_smile:

Yeah, tracehull’s being strange. I’ll take a look into it though :slight_smile:

-snip, betrayed-

You didn’t make this… I wrote this and sent it to you.

It’s just the example here tweaked.

This code is so short, why would he have possibly stolen it? Please provide some proof to go with your accusation

the version with comments I sent to him

What a dick. It makes no sense why you would claim that as your own…

It was a misunderstanding. Everything is laid out now. I thought he gave me permission to take it as my own work.

I don’t think that is how things work…

You said you “made it”, but you didn’t…

I know I didn’t. I did contribute to it. And I thought he said I could say it was my work. I just wanted to help some people out. But I’m sorry I truly didn’t know.

dumbest shit i couldve read today