Simple Clientside Thirdperson

Posts 1–7 of 7 · Page 1 of 1
Simple Clientside Thirdperson
So I was adding this to my script and my friend didn't understand how I did it, and it got me thinking "What if a LOT of people didn't understand it?" so I decided to release my 3rd person script..ENJOY!

Code:
CreateClientConVar(rook.."ThirdPerson", 0, true, false)
hook.Add( "CalcView", "ThirdPerson", function(ply, pos, angles, fov)
	local ThirdPerson = {}
	if GetConVarNumber("ThirdPerson") == 1 then
	ThirdPerson.origin = pos-( angles:Forward()*100 )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	ThirdPerson.drawviewer = true
	return ThirdPerson
	elseif GetConVarNumber(rook.."ThirdPerson") == 0 then
	ThirdPerson.origin = pos-( angles:Forward() )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	end
end)
dude why are you releasing all this dumb shit literally everyone knows how to do it
this code is awful anyways

Code:
CreateClientConVar(rook.."ThirdPerson", 0, true, false)
hook.Add( "CalcView", "ThirdPerson", function(ply, pos, angles, fov)
	local ThirdPerson = {}
	if GetConVarNumber("ThirdPerson") == 1 then
	ThirdPerson.origin = pos-( angles:Forward()*100 )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	ThirdPerson.drawviewer = true
	return ThirdPerson
	elseif GetConVarNumber(rook.."ThirdPerson") == 0 then
	ThirdPerson.origin = pos-( angles:Forward() )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	end
end)
can be shortened to
Code:
CreateClientConVar(ThirdPerson", 0, true, false)
hook.Add( "CalcView", "ThirdPerson", function(ply, pos, angles, fov)
	local ThirdPerson = {}
	ThirdPerson.origin = (GetConVarNumber("ThirdPerson") == 1) and (pos-(angles:Forward()*100)) or pos
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	ThirdPerson.drawviewer = GetConVarNumber("ThirdPerson") == 1
	return ThirdPerson
end)
Quote Originally Posted by too much sauce View Post
dude why are you releasing all this dumb shit literally everyone knows how to do it
this code is awful anyways

Code:
CreateClientConVar(rook.."ThirdPerson", 0, true, false)
hook.Add( "CalcView", "ThirdPerson", function(ply, pos, angles, fov)
	local ThirdPerson = {}
	if GetConVarNumber("ThirdPerson") == 1 then
	ThirdPerson.origin = pos-( angles:Forward()*100 )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	ThirdPerson.drawviewer = true
	return ThirdPerson
	elseif GetConVarNumber(rook.."ThirdPerson") == 0 then
	ThirdPerson.origin = pos-( angles:Forward() )
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	end
end)
can be shortened to
Code:
CreateClientConVar(ThirdPerson", 0, true, false)
hook.Add( "CalcView", "ThirdPerson", function(ply, pos, angles, fov)
	local ThirdPerson = {}
	ThirdPerson.origin = (GetConVarNumber("ThirdPerson") == 1) and (pos-(angles:Forward()*100)) or pos
	ThirdPerson.angles = angles
	ThirdPerson.fov = fov
	ThirdPerson.drawviewer = GetConVarNumber("ThirdPerson") == 1
	return ThirdPerson
end)
or if you do it properly it'll look like
Code:
local tp = CreateClientConVar("_thirdperson", "0")

local Thirdperson = function(ply, origin, angles)
	local view = {}
	local active = tp:GetBool()

	view.origin = active and origin - (angles:Forward() * 100) or origin
	view.drawviewer = active

	return view
end
hook.Add("CalcView", "Thirdperson", Thirdperson)
Quote Originally Posted by Cyaegha View Post
or if you do it properly it'll look like
Code:
local tp = CreateClientConVar("_thirdperson", "0")

local Thirdperson = function(ply, origin, angles)
	local view = {}
	local active = tp:GetBool()

	view.origin = active and origin - (angles:Forward() * 100) or origin
	view.drawviewer = active

	return view
end
hook.Add("CalcView", "Thirdperson", Thirdperson)
Hmm.. smart! I released mine just because nobody really had any info on it and I just didn't want people C+Ping from random cheats or something. I got mine to work that way, and I can't stress enough that I am new to GLua, and I thought it was quite an accomplishment. Use it or not, it's for the people who didn't get theirs working or need one. I looked greatly into the ways you've done yours and I still prefer my way since it is mine, however I will try to learn from the ways you've done it. Thanks for expanding my idea!
Quote Originally Posted by JayFromSubway View Post
I just didn't want people C+Ping from random cheats or something
and now they'll c+p from random posts on mpgh, what's the difference
Nice work men <3
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?