Advertisement
Guest User

Untitled

a guest
May 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. --[[-------------------------------------------------------------------------
  2. HUD By Valfunde from RuddyCode.fr
  3. I will not offer support with it, a "premium" version will come in few days / weeks with more options, more optimisation, and support. Etc.
  4. Thanks for downloading and using it !
  5. Have fun, see you
  6. ---------------------------------------------------------------------------]]
  7. --[[-------------------------------------------------------------------------
  8. Simple config space
  9. ---------------------------------------------------------------------------]]
  10. local server = "LeSaintServeur" -- Server name
  11. local tname = "Nom" -- Name word
  12. local thealth = "Vie" -- Health word
  13. local tenergy = "Faim" -- Hunger word
  14. local tmoney = "Argent" -- Money word
  15. --[[-------------------------------------------------------------------------
  16. HUDShouldDraw
  17. ---------------------------------------------------------------------------]]
  18. local HideElements = { "DarkRP_HUD", "DarkRP_LocalPlayerHUD", "DarkRP_EntityDisplay", "DarkRP_Agenda", "DarkRP_Hungermod" }
  19.  
  20. local function HUDShouldDraw( Element )
  21.  
  22. if table.HasValue( HideElements, Element ) then return false end
  23.  
  24. end
  25. hook.Add( "HUDShouldDraw", "HUDShouldDraw", HUDShouldDraw )
  26. --[[-------------------------------------------------------------------------
  27. Custom fonts
  28. ---------------------------------------------------------------------------]]
  29. surface.CreateFont("valfunde_hud_32",
  30. {
  31. font = "Lato Light",
  32. size = 32,
  33. weight = 500,
  34. antialias = true,
  35. strikeout = true,
  36. additive = true,
  37. })
  38. surface.CreateFont("valfunde_hud_24",
  39. {
  40. font = "Lato Light",
  41. size = 24,
  42. weight = 500,
  43. antialias = true,
  44. strikeout = true,
  45. additive = true,
  46. })
  47. surface.CreateFont("valfunde_hud_26",
  48. {
  49. font = "Lato Light",
  50. size = 26,
  51. weight = 500,
  52. antialias = true,
  53. strikeout = true,
  54. additive = true,
  55. })
  56. surface.CreateFont("valfunde_hud_20",
  57. {
  58. font = "Lato Light",
  59. size = 20,
  60. weight = 500,
  61. antialias = true,
  62. strikeout = true,
  63. additive = true,
  64. })
  65. --[[-------------------------------------------------------------------------
  66. Starting HUD design
  67. ---------------------------------------------------------------------------]]
  68.  
  69. hook.Add("HUDPaint", "Hud", function()
  70. local health = LocalPlayer():Health()
  71. local name = LocalPlayer():Name()
  72. local armor = LocalPlayer():Armor()
  73. local energy = LocalPlayer():getDarkRPVar("Energy") or 0
  74. local money = LocalPlayer():getDarkRPVar("money") or 0
  75. local salary = LocalPlayer():getDarkRPVar("salary") or 0
  76.  
  77. draw.RoundedBox( 0, 12, ScrH() - 162, ScrW() / 4, 150, Color(0, 0, 0, 190))
  78. draw.RoundedBox( 0, 16, ScrH() - 158, ScrW() / 4 - 8, 142, Color(0, 0, 0, 150))
  79. draw.RoundedBox(0, 20, ScrH() - 154, ScrW() / 11, 134 , Color(0, 0, 0, 205))
  80. draw.RoundedBox(0, ScrW() / 9.5, ScrH() - 154, 4, 134 , Color(0, 0, 0, 190))
  81. draw.SimpleText(server, "valfunde_hud_32", ScrW() / 5.5, ScrH() - 160, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
  82. draw.SimpleText(tname.." : "..name, "valfunde_hud_24", ScrW() / 9, ScrH() - 122.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
  83. draw.SimpleText(thealth.." : "..health.." ("..armor..")", "valfunde_hud_24", ScrW() / 9, ScrH() - 100.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
  84. draw.SimpleText(tenergy.." : "..energy, "valfunde_hud_24", ScrW() / 9, ScrH() - 78.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
  85. draw.SimpleText(tmoney.." : "..money.." ("..salary..")", "valfunde_hud_24", ScrW() / 9, ScrH() - 56.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
  86.  
  87. surface.SetDrawColor(255, 255, 255, 255)
  88. surface.DrawLine(ScrW() / 5.5 - 80, ScrH() - 125, ScrW() / 5.5 + 80, ScrH() - 125)
  89.  
  90. end)
  91.  
  92. --[[-------------------------------------------------------------------------
  93. Show Playermodel on HUD
  94. ---------------------------------------------------------------------------]]
  95. hook.Add( "InitPostEntity", "pm_show", function()
  96. local pm_show = vgui.Create("DModelPanel")
  97. pm_show:SetPos(20, ScrH() - 154)
  98. pm_show:SetSize(ScrW() / 11, 134)
  99. pm_show:SetModel(LocalPlayer():GetModel())
  100. pm_show:SetCamPos(Vector(30, -15, 60))
  101. pm_show:SetFOV(55)
  102. pm_show:SetLookAt(Vector(0, 0, 60))
  103. pm_show.Think = function()
  104. if not LocalPlayer():Alive() then
  105. pm_show:SetSize(0, 0)
  106. else
  107. pm_show:SetSize(ScrW() / 11, 134)
  108. end
  109. pm_show:SetModel(LocalPlayer():GetModel())
  110. end
  111. pm_show.LayoutEntity = function()
  112. return false
  113. end
  114. end)
  115.  
  116. --[[-------------------------------------------------------------------------
  117. Starting Agenda design
  118. ---------------------------------------------------------------------------]]
  119. local agendaText
  120. local function DrawAgenda()
  121.  
  122. local agenda = LocalPlayer():getAgendaTable()
  123. if not agenda then return end
  124.  
  125. agendaText = agendaText or DarkRP.textWrap( ( LocalPlayer():getDarkRPVar( "agenda" ) or "" ):gsub( "//", "\n" ):gsub( "\\n", "\n" ), "valfunde_hud_26", 440 )
  126.  
  127. draw.RoundedBox( 0, 10, 10, 465, 115, Color(0, 0, 0, 190))
  128. draw.RoundedBox(0, 14, 44, 457, 77, Color(0, 0, 0, 150))
  129. draw.RoundedBox( 0, 10, 10, 465, 30, Color(0, 0, 0, 205))
  130.  
  131. draw.DrawText( agenda.Title, "valfunde_hud_24", 240, 15, Color( 225, 225, 225, 255 ), 1 )
  132. draw.DrawText( agendaText, "valfunde_hud_24", 20, 44, Color( 225, 225, 225, 255 ) )
  133.  
  134. end
  135. hook.Add( "HUDPaint", "DrawAgenda", DrawAgenda )
  136.  
  137. hook.Add( "DarkRPVarChanged", "AgendaUpdate", function( ply, var, _, new )
  138.  
  139. if ply != LocalPlayer() then return end
  140.  
  141. if var == "agenda" and new then
  142.  
  143. agendaText = DarkRP.textWrap( new:gsub( "//", "\n" ):gsub( "\\n", "\n" ), "valfunde_hud_26", 440 )
  144. else
  145.  
  146. agendaText = nil
  147.  
  148. end
  149.  
  150. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement