Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. if ( CLIENT ) then local on = false local function toggle()
  2.  
  3. on = !on
  4.  
  5. end
  6.  
  7.  
  8. hook.Add( "ShouldDrawLocalPlayer", "ThirdPersonDrawPlayer", function()if on and LocalPlayer():Alive() then return true
  9. end
  10. end )
  11.  
  12. hook.Add( "CalcView", "ThirdPersonView", function( ply, pos, angles, fov )if on and ply:Alive() then local view = {}
  13. view.origin = pos - ( angles:Forward() * 70 ) + ( angles:Right() * 20 ) + ( angles:Up() * 5 )
  14. view.angles = ply:EyeAngles() + Angle( 1, 1, 0 )
  15. view.fov = fov
  16.  
  17. return GAMEMODE:CalcView( ply, view.origin, view.angles, view.fov )
  18.  
  19. end
  20. end )
  21.  
  22. concommand.Add( "thirdperson_toggle", toggle )
  23.  
  24. end
  25. if ( SERVER ) then function ulx.thirdperson( calling_ply )
  26.  
  27. calling_ply:SendLua([[RunConsoleCommand("thirdperson_toggle")]])
  28.  
  29. end
  30. local thirdperson = ulx.command( "Utility", "ulx thirdperson", ulx.thirdperson, {"!3p"}, true )
  31. thirdperson:defaultAccess( ULib.ACCESS_ALL )
  32. thirdperson:help( "Включает вид от третьего лица" )
  33.  
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement