CapsAdmin

Untitled

Mar 28th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local convar = CreateConVar( "thirdperson_enabled", "0", { FCVAR_ARCHIVE, } )
  2.  
  3. hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", function()
  4.     if convar:GetBool() and LocalPlayer():Alive() then
  5.         return true
  6.     end
  7. end )
  8.  
  9. hook.Add( "CalcView", "ThirdPersonView", function( ply, _, _, fov )
  10.  
  11.     if convar:GetBool() and ply:Alive() then
  12.         local ang = ply:EyeAngles()
  13.         local dir = ply:GetAimVector()
  14.         local origin = ply:EyePos() + (dir * -30) + (ang:Right() * 20)
  15.        
  16.         return GAMEMODE:CalcView(
  17.             ply,
  18.             origin,
  19.             (ply:GetEyeTrace().HitPos - origin):Angle(),
  20.             fov
  21.         )
  22.     end
  23.      
  24. end )
Advertisement
Add Comment
Please, Sign In to add comment