Advertisement
Guest User

Untitled

a guest
Sep 9th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. if !CLIENT then return end -- This will set the file to client. Do not remove under any circumstance.
  2. ply = LocalPlayer()
  3. local AboveMaterial = Material("scarness/scartg.png") -- Set the image you want here.
  4. local Width = 135 -- Adjust to be the image size /2
  5. local Height = 49 -- Adjust to be the image size /2
  6. local TeamColor = team.GetColor(ply:Team())
  7.  
  8. surface.CreateFont( "InfoText", { -- The font we're using. Adjust it if you want specifics (like outlines)
  9. font = "TargetID",
  10. size = 15,
  11. weight = 500,
  12. blursize = 0,
  13. scanlines = 0,y
  14. antialias = false,
  15. underline = false,
  16. italic = false,
  17. strikeout = false,
  18. symbol = false,
  19. rotary = false,
  20. shadow = true,
  21. additive = false,
  22. outline = false
  23. } )
  24.  
  25. local Resolutions = {} -- This is the Resolutions table, in which you can tweak the size as well as the character names.
  26. Resolutions[8] = 0.25 -- 8 Characters = Normal
  27. Resolutions[16] = 0.15
  28. Resolutions[24] = 0.15
  29.  
  30.  
  31. local function FindDesiredRes( Len ) -- This is the function for the resolutions, don't mess with it.
  32. local DesiredRes = 0.25
  33. for CharLen, Res in pairs( Resolutions ) do
  34. if Len >= CharLen then
  35. DesiredRes = Res
  36. else
  37. break
  38. end
  39. end
  40. return DesiredRes
  41. end
  42.  
  43.  
  44. local function DrawName( ply ) -- This is the function we use to draw everything.
  45. if !ply:Alive() then return end -- If they die, then it stops it until they're alive. Prevents being dead and it still being there.
  46. local offset = Vector( 0, 0, 90 ) -- Edit the final # to make it up higher.
  47. local ang = LocalPlayer():EyeAngles()
  48. local pos = ply:GetPos() + offset + ang:Up()
  49. local jobdrp = ply:getDarkRPVar("job") or "Unemployed" -- The job variables, this is what gets the DarkRP Jobs.
  50. local Res = FindDesiredRes( #ply:GetName() ) -- This is to get the strings characters, in order to allow the shrinking.
  51. local Alpha = ( math.min( 712, EyePos():Distance( pos ) )/712 )*255 -- This is the distance modifier. What this does is go based on eye distance from the target, then divide it by 512 then multiply by 255, putting it in alpha format. We cannot allow editing of this or it will cause issues.
  52. local GroupName = "Guest"
  53. if ply:IsUserGroup("owner") then -- This is where you setup the groups.
  54. GroupName = "Owner"
  55. elseif ply:IsUserGroup("moderator") then
  56. GroupName = "Moderator"
  57. end
  58.  
  59.  
  60. ang:RotateAroundAxis( ang:Forward(), 90 )
  61. ang:RotateAroundAxis( ang:Right(), 90 )
  62. if 700 > EyePos():Distance( pos ) then
  63.  
  64. cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
  65. surface.SetDrawColor(255,255,255,222)
  66. surface.SetMaterial( AboveMaterial ) -- This draws the table you made.
  67. surface.DrawTexturedRect(-67, 0, Width, Height ) -- Called at the top, sets up the positioning.
  68. draw.DrawText( jobdrp,"InfoText", 2, 13, Color( TeamColor.r, TeamColor.g, TeamcColor.b, 222), TEXT_ALIGN_CENTER )
  69. cam.End3D2D()
  70.  
  71. cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), FindDesiredRes( #ply:Nick() ) ) -- This is for the name, so we can easily change the names size.
  72. surface.SetDrawColor(255,255,255,222)
  73.  
  74. if Res == 0.15 then
  75. draw.DrawText( ply:Nick(), "InfoText", 2, 9, Color( TeamColor.r, TeamColor.g, TeamcColor.b, 222 ), TEXT_ALIGN_CENTER )
  76. else
  77. draw.DrawText( ply:Nick(), "InfoText", 2, -1, Color( TeamColor.r, TeamColor.g, TeamcColor.b, 222 ), TEXT_ALIGN_CENTER )
  78. end
  79. cam.End3D2D()
  80. elseif EyePos():Distance( pos ) >= 700 then
  81. cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
  82. surface.SetDrawColor(255,255,255, 0)
  83. cam.End3D2D()
  84. end
  85. end
  86. hook.Add( "PostPlayerDraw", "DrawThisInfoHookThingy", DrawName )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement