Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.75 KB | None | 0 0
  1. function initFonts()
  2. surface.CreateFont( "Money", {
  3. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  4. size = 30,
  5. weight = 600,
  6. } )
  7.  
  8. surface.CreateFont( "ObvodkaHealth", {
  9. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  10. size = 14,
  11. weight = 700
  12.  
  13. } )
  14.  
  15. surface.CreateFont( "ObvodkaArmor", {
  16. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  17. size = 14,
  18. weight = 700
  19.  
  20. } )
  21.  
  22. surface.CreateFont( "Lockdown", {
  23. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  24. extended = false,
  25. size = 17,
  26. weight = 1000,
  27. blursize = 0,
  28. scanlines = 0,
  29. antialias = true,
  30. underline = false,
  31. italic = false,
  32. strikeout = false,
  33. symbol = false,
  34. rotary = false,
  35. shadow = false,
  36. additive = false,
  37. outline = false,
  38. } )
  39.  
  40. surface.CreateFont( "Salary", {
  41. font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  42. extended = false,
  43. size = 20,
  44. weight = 600,
  45. } )
  46.  
  47. surface.CreateFont( "Nick", {
  48. font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  49. extended = true,
  50. size = 30,
  51. weight = 300,
  52. antialias = true,
  53. italic = false,
  54. symbol = false,
  55. } )
  56.  
  57. surface.CreateFont( "Job", {
  58. font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  59. extended = true,
  60. size = 20,
  61. weight = 600,
  62. italic = false,
  63. symbol = false,
  64. } )
  65.  
  66. surface.CreateFont( "Health", {
  67. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  68. extended = false,
  69. size = 14,
  70. weight = 1000,
  71. blursize = 0,
  72. scanlines = 0,
  73. antialias = true,
  74. underline = false,
  75. italic = false,
  76. strikeout = false,
  77. symbol = false,
  78. rotary = false,
  79. shadow = false,
  80. additive = false,
  81. outline = false,
  82. } )
  83.  
  84. surface.CreateFont( "HealthText", {
  85. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  86. extended = false,
  87. size = 11,
  88. weight = 1000,
  89. blursize = 0,
  90. scanlines = 0,
  91. antialias = true,
  92. underline = false,
  93. italic = false,
  94. strikeout = false,
  95. symbol = false,
  96. rotary = false,
  97. shadow = false,
  98. additive = false,
  99. outline = false,
  100. } )
  101.  
  102. surface.CreateFont( "Wanted", {
  103. font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  104. extended = false,
  105. size = 40,
  106. weight = 1000,
  107. blursize = 0,
  108. scanlines = 0,
  109. antialias = true,
  110. underline = false,
  111. italic = false,
  112. strikeout = false,
  113. symbol = false,
  114. rotary = false,
  115. shadow = false,
  116. additive = false,
  117. outline = false,
  118. } )
  119. end
  120.  
  121. initFonts()
  122.  
  123. timer.Simple( .1, initFonts )
  124.  
  125. function drawOutlinedText(text, font, x, y, color, align)
  126. draw.SimpleText( text, "Obvodka" .. font, x-1, y-1, color_black, align )
  127. draw.SimpleText( text, font, x, y, color, align )
  128. end
  129.  
  130. local gaybars = 0
  131.  
  132. function nullGayBars()
  133. gaybars = 0
  134. end
  135.  
  136. function drawGayBar(round, val, x, y, w, h, color, text)
  137. draw.RoundedBox( 0, x, y + gaybars, w, h, Color(255,255,255) )
  138. draw.RoundedBox( 0, x, y + gaybars, w * val, h, color )
  139.  
  140. if text then
  141. surface.SetFont("Health")
  142. local tw,th = surface.GetTextSize(text)
  143.  
  144. --local align = tw >= w * val and TEXT_ALIGN_RIGHT or TEXT_ALIGN_CENTER
  145. --local align = w * val <= tw * 0.5 and TEXT_ALIGN_LEFT or align
  146. local align = TEXT_ALIGN_CENTER
  147. draw.DrawText(text, "Health", x + w * 0.5, y + gaybars, Color(0,0,0), align)
  148. end
  149. gaybars = gaybars + h + 2
  150. end
  151.  
  152. function InitializeHUD()
  153. local smoothHealth = 100
  154. local smoothArmor = 100
  155.  
  156. function MainHUD()
  157.  
  158. local Money = LocalPlayer():getDarkRPVar("money") or 0
  159. local Name = LocalPlayer():Nick()
  160. local Job = LocalPlayer():getDarkRPVar("job") or "Данные загружаются" .. string.rep(".", CurTime()%3)
  161. local Hunger = LocalPlayer():getDarkRPVar("Energy") or 0
  162.  
  163. surface.SetFont("Nick")
  164. local NameW, NameH = surface.GetTextSize(Name)
  165.  
  166. surface.SetFont("Job")
  167. local JobW, JobH = surface.GetTextSize(Job)
  168. local NameX, NameY = 14, ScrH() - 100
  169.  
  170. draw.SimpleText( Name, "Nick", NameX, NameY, color_white, TEXT_ALIGN_LEFT )
  171. draw.SimpleText( Job, "Job", NameX + 2, NameY + NameH - 2, team.GetColor(LocalPlayer():Team()), TEXT_ALIGN_LEFT )
  172.  
  173. smoothHealth = Lerp(FrameTime()*2, smoothHealth, LocalPlayer():Health())
  174. smoothArmor = Lerp(FrameTime()*2, smoothArmor, LocalPlayer():Armor())
  175.  
  176. nullGayBars()
  177.  
  178. drawGayBar( 0, math.Clamp(smoothHealth, 0, 100)/100, 15, ScrH() - 45, 300, 14, Color(200,50,50), "Здоровье: " .. LocalPlayer():Health() .. "%" )
  179. drawGayBar( 0, math.Clamp(smoothArmor, 0, 100)/100, 15, ScrH() - 45, 300, 14, Color(0,54,200), "Броня: " .. LocalPlayer():Armor() .. "%" )
  180. drawGayBar( 0, math.Clamp(Hunger, 0, 100)/100, 15, ScrH() - 45, 300, 3, Color(255,120,0))
  181.  
  182. draw.SimpleText( "AlexandriaRP", "Nick", ScrW() - 105, ScrH() - 40, color_white, TEXT_ALIGN_CENTER )
  183. draw.SimpleText( DarkRP.formatMoney( Money or 0 ), "Money", 320, ScrH() - 70, color_white, TEXT_ALIGN_LEFT )
  184. draw.SimpleText( DarkRP.formatMoney( LocalPlayer():getDarkRPVar("salary") or 0 ) .. "/час", "Salary", 322, ScrH() - 40, color_white, TEXT_ALIGN_LEFT )
  185.  
  186.  
  187. end
  188. hook.Add("HUDPaint", "MainHUD", MainHUD)
  189.  
  190. local ammo_alpha = 0
  191. local ammo_text = ""
  192.  
  193. function LerpAmmo()
  194. if ammo_alpha > 0 then
  195. ammo_alpha = Lerp(FrameTime()*10, ammo_alpha, 0)
  196. end
  197. end
  198.  
  199. function AmmoHUD()
  200.  
  201. local weapon = LocalPlayer():GetActiveWeapon()
  202. if weapon and IsValid( weapon ) then
  203. local clip = weapon:Clip1()
  204. local ammo = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType())
  205.  
  206. if ammo and clip >= 0 and not (clip == -1 or clip <= 0 and ammo <= 0) then
  207.  
  208. ammo_text = clip .. " / " .. ammo
  209.  
  210. ammo_alpha = 255
  211.  
  212. else LerpAmmo() end
  213. else LerpAmmo() end
  214.  
  215. draw.SimpleText( ammo_text, "Nick", ScrW() - 195, ScrH() - 40, Color(255,255,255,ammo_alpha), TEXT_ALIGN_RIGHT )
  216.  
  217. draw.RoundedBox( 0, ScrW()-185, ScrH()-40, 2, 30, Color(255,120,0,ammo_alpha) )
  218.  
  219. end
  220. hook.Add("HUDPaint", "AmmoHUD", AmmoHUD)
  221.  
  222. function AgendaHUD()
  223.  
  224. local agenda = LocalPlayer():getAgendaTable()
  225. if not agenda then return end
  226.  
  227. draw.RoundedBox( 0, 5, 5, 350, 150, Color(255,0,0) )
  228. surface.SetDrawColor( color_gray )
  229. surface.DrawOutlinedRect( 5, 5, 350, 150 )
  230.  
  231. draw.RoundedBox( 0, 5, 5, 350, 40, color_white )
  232. surface.SetDrawColor( color_gray )
  233. surface.DrawOutlinedRect( 5, 5, 350, 40 )
  234.  
  235. draw.DrawText( agenda.Title, "Job", 175, 10, color_black, TEXT_ALIGN_CENTER )
  236.  
  237. local text = LocalPlayer():getDarkRPVar("agenda") or ""
  238. text = text:gsub("//", "\n"):gsub("\\n", "\n")
  239. text = DarkRP.textWrap(text, "DarkRPHUD1", 300)
  240.  
  241. draw.DrawText(text, "Зарплата", 10, 50, color_black )
  242.  
  243. end
  244. hook.Add("HUDPaint", "Agenda", AgendaHUD)
  245.  
  246. function LockdownHUD()
  247.  
  248. if GetGlobalBool("DarkRP_LockDown") then
  249.  
  250. draw.SimpleText( "Начался ком. час! Возвращайтесь домой!", "Lockdown", 170, ScrH() - 150, color_white, TEXT_ALIGN_CENTER )
  251. end
  252.  
  253. end
  254. hook.Add("HUDPaint", "Lockdown", LockdownHUD)
  255.  
  256.  
  257. function hidehud(name)
  258. for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "DarkRP_HUD", "DarkRP_Hungermod", "CHudSecondaryAmmo", "DarkRP_LocalPlayerHUD"})do
  259. if name == v then return false end
  260. end
  261. end
  262. hook.Add("HUDShouldDraw", "hide", hidehud)
  263. end
  264.  
  265. InitializeHUD()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement