Darkwater

rpstuff.lua

Aug 30th, 2011
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. local user = surface.GetTextureID("gui/silkicons/user")
  2. local admin = surface.GetTextureID("gui/silkicons/shield")
  3.  
  4. surface.CreateFont ( "ChatFont", 60, 700, true, false, "Playername", true )
  5. surface.CreateFont ( "ChatFont", 30, 700, true, false, "Playerjob", true )
  6.  
  7. hook.Add("PostPlayerDraw", "RP Player Names", function (ply)
  8.     if !ply:Alive() then return end
  9.     if ply:Team() == TEAM_CONNECTING or
  10.        ply:Team() == TEAM_SPECTATOR then return end
  11.  
  12.     local offset = Vector( 0, 0, 20 )
  13.     local ang = LocalPlayer():EyeAngles()
  14.     local pos = ply:EyePos() + offset + ang:Up()
  15.  
  16.     ang:RotateAroundAxis( ang:Forward(), 90 )
  17.     ang:RotateAroundAxis( ang:Right(), 90 )
  18.  
  19.     cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.1 )
  20.         surface.SetFont("Playername")
  21.         local tw, th = surface.GetTextSize(ply:GetName() or "?")
  22.         if ply:IsAdmin() then
  23.             surface.SetTexture(admin)
  24.         else
  25.             surface.SetTexture(user)
  26.         end
  27.         surface.SetDrawColor(255, 255, 255, 255)
  28.         surface.DrawTexturedRect(tw * -0.5 - 50, 16, 32, 32)
  29.        
  30.         draw.DrawText( ply:GetName() or "?", "Playername", 0, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
  31.         draw.DrawText( ply.DarkRPVars.job or "?", "Playerjob", 0, 68, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
  32.        
  33.         local health = math.Clamp(ply:Health() / 100, 0, 1)
  34.         health = 200 * health
  35.        
  36.         surface.SetDrawColor(0, 0, 0, 150)
  37.         surface.DrawRect(-101, 62, 202, 4)
  38.         surface.SetDrawColor(200, 0, 0, 255)
  39.         surface.DrawRect(-100, 63, health, 2)
  40.     cam.End3D2D()
  41. end)
Add Comment
Please, Sign In to add comment