How to Go Into Third Person in Gmod
-
05-04-2017 #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)
-
05-04-2017 #2
dude why are you releasing all this dumb shit literally everyone knows how to do it
this code is awful anywaysCode:
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)
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)
Last edited by too much sauce; 05-04-2017 at 10:33 PM.
-
05-05-2017 #3
Originally Posted by too much sauce
dude why are you releasing all this dumb shit literally everyone knows how to do it
this code is awful anywaysCode:
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)
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)
-
05-05-2017 #4
Originally Posted by Cyaegha
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)
-
05-05-2017 #5
Nice men
-
The Following User Says Thank You to oxcraftboys For This Useful Post:
JayFromSubway (05-06-2017)
-
05-05-2017 #6
Nice work men <3
-
The Following User Says Thank You to HUNDER. For This Useful Post:
JayFromSubway (05-06-2017)
-
05-08-2017 #7
Originally Posted by JayFromSubway
I just didn't want people C+Ping from random cheats or something
-
The Following User Says Thank You to mavvsy For This Useful Post:
How to Go Into Third Person in Gmod
Source: https://www.mpgh.net/forum/showthread.php?t=1255315