Guest User

Gmod Thirdperson Posted by Insanity

a guest
Feb 7th, 2016
6,118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. if CLIENT then
  2. local on = false
  3.  
  4. function togglethirdperson()
  5. on = not on
  6. end
  7.  
  8. net.Receive("sv_togglethirdperson")
  9.  
  10. function CalcThirdperson(ply, pos, angles, fov)
  11. if on then
  12.     local view = {}
  13.     view.origin = pos-(angles:Forward()*100)
  14.     view.angles = angles
  15.     view.fov = fov
  16.  
  17.     return view
  18. end
  19. end
  20.  
  21. hook.Add("CalcView", "CalcThirdperson", CalcThirdperson)
  22.  
  23. hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply)
  24. if on then
  25.         return true
  26.     end
  27. end)
  28.  
  29. concommand.Add("togglethirdperson", togglethirdperson)
  30.  
  31. local lastf4 = false
  32. hook.Add( "Tick", "CheckPlayerKey", function()
  33.    if (input.IsKeyDown(KEY_F4) and lastf4 == false) then
  34.    togglethirdperson()
  35.    lastf4 = true
  36.    timer.Simple(0.1,function()
  37.    lastf4 = false
  38.    end)
  39.    end
  40. end )
  41. end
Advertisement
Add Comment
Please, Sign In to add comment