How to Go Into Third Person in Gmod
-                                     05-04-2017 #1 Simple Clientside ThirdpersonSo 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 anywayscan be shortened toCode: 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 or if you do it properly it'll look like Originally Posted by                    too much sauce 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 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! Originally Posted by                    Cyaegha 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 and now they'll c+p from random posts on mpgh, what's the difference Originally Posted by                    JayFromSubway 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