Advertisement
Guest User

test

a guest
Feb 8th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.44 KB | None | 0 0
  1. /*-- HUD Settings --*/
  2. local HUD = {}
  3.  
  4. /*---------------------------------------------------------------------------
  5. HUD ConVars
  6. ---------------------------------------------------------------------------*/
  7. local ConVars = {}
  8. local HUDWidth
  9. local HUDHeight
  10.  
  11. local Color = Color
  12. local cvars = cvars
  13. local DarkRP = DarkRP
  14. local CurTime = CurTime
  15. local draw = draw
  16. local GetConVar = GetConVar
  17. local IsValid = IsValid
  18. local Lerp = Lerp
  19. local localplayer
  20. local math = math
  21. local pairs = pairs
  22. local ScrW, ScrH = ScrW, ScrH
  23. local SortedPairs = SortedPairs
  24. local string = string
  25. local surface = surface
  26. local table = table
  27. local timer = timer
  28. local tostring = tostring
  29.  
  30. -- Edit settings here.
  31. HUD.X = "left" -- left / center / right
  32. HUD.Y = "bottom" -- bottom / center / top
  33.  
  34. HUD.HealthColor = Color(192, 57, 43, 255)
  35. HUD.ArmorColor = Color(41, 128, 185, 255)
  36.  
  37. HUD.Currency = "$"
  38.  
  39. --[[Hungermode Settings]]--
  40.  
  41. HUD.EnableHunger = false
  42. HUD.HungerColor = Color(200, 190, 70, 255)
  43.  
  44. -- Don't edit anything below this line.
  45. HUD.Width = 400
  46. HUD.Height = 150
  47.  
  48. HUD.Border = 15
  49.  
  50. HUD.PosX = 0
  51. HUD.PosY = 0
  52.  
  53. /*-- Hide Default HUD Elements --*/
  54. local hideHUDElements = {
  55. ["DarkRP_HUD"] = true,
  56. ["DarkRP_EntityDisplay"] = true,
  57. ["DarkRP_ZombieInfo"] = true,
  58. ["DarkRP_LocalPlayerHUD"] = true,
  59. ["DarkRP_Hungermod"] = true,
  60. ["DarkRP_Agenda"] = true,
  61. }
  62.  
  63. /*-- Hide HUD Elements --*/
  64. local function hideElements(name)
  65.  
  66. if name == "CHudHealth" or name == "CHudBattery" or name == "CHudSuitPower" then
  67. return false
  68. end
  69.  
  70. if hideHUDElements[name] then
  71. return false
  72. end
  73.  
  74. end
  75. hook.Add("HUDShouldDraw", "hideElements", hideElements)
  76.  
  77. /*-- Process Settings --*/
  78. if HUD.X == "left" then
  79. HUD.PosX = HUD.Border
  80. elseif HUD.X == "center" then
  81. HUD.PosX = ScrW() / 2 - HUD.Width / 2
  82. elseif HUD.X == "right" then
  83. HUD.PosX = ScrW() - HUD.Border
  84. else
  85. HUD.PosX = HUD.Border
  86. end
  87.  
  88. if HUD.Y == "bottom" then
  89. HUD.PosY = ScrH() - HUD.Height - HUD.Border
  90. elseif HUD.Y == "center" then
  91. HUD.PosY = ScrH() / 2 - HUD.Height / 2
  92. elseif HUD.Y == "top" then
  93. HUD.PosY = HUD.Border
  94. else
  95. HUD.PosY = ScrH() - Border
  96. end
  97.  
  98. /*-- Format Number Function --*/
  99. local function formatNumber(n)
  100. if not n then return "" end
  101. if n >= 1e14 then return tostring(n) end
  102. n = tostring(n)
  103. local sep = sep or "."
  104. local dp = string.find(n, "%.") or #n+1
  105. for i=dp-4, 1, -3 do
  106. n = n:sub(1, i) .. sep .. n:sub(i+1)
  107. end
  108. return n..",00"
  109. end
  110.  
  111. /*-- HUD Elements --*/
  112.  
  113. HUD.BHeight = HUD.Height / 2 - 15
  114. HUD.BPosY = HUD.PosY + HUD.Height / 2 + HUD.Border
  115.  
  116. HUD.BHeight1 = HUD.BHeight / 2 - 10
  117. HUD.BPosY1 = HUD.BPosY + 3
  118. HUD.BPosY2 = HUD.BPosY + 27
  119.  
  120. HUD.BarWidth = HUD.Width - 90
  121.  
  122. HUD.HHeight = HUD.Height / 2 + 11
  123.  
  124. HUD.HH = 18
  125. HUD.HO = 5
  126. local function Base()
  127.  
  128. if !HUD.EnableHunger then
  129.  
  130. -- Background
  131. draw.RoundedBoxEx(4, HUD.PosX-1, HUD.BPosY - 1, HUD.Width + 28 + 2, HUD.BHeight + 2, Color(30,30,30,255), true, true, true, true)
  132. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY, HUD.Width + 28, HUD.BHeight, Color(50,50,50,255), true, true, true, true)
  133.  
  134. -- Background 2
  135. draw.RoundedBoxEx(4, HUD.PosX-1, HUD.BPosY - 70, HUD.Width + 28 + 2, HUD.BHeight + 2, Color(30,30,30,255), true, true, true, true)
  136. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY - 70, HUD.Width + 28, HUD.BHeight, Color(50,50,50,255), true, true, true, true)
  137.  
  138. -- Background 3
  139. draw.RoundedBoxEx(4, HUD.PosX-1, HUD.BPosY - 70, HUD.Width - 28 + 2, HUD.BHeight + 2, Color(30,30,30,255), true, true, true, true)
  140. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY - 70, HUD.Width - 28, HUD.BHeight, Color(50,50,50,255), true, true, true, true)
  141. -- Sections
  142. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY, HUD.Width + 28, HUD.BHeight, Color(70,70,70,1), true, true, true, true)
  143. -- line
  144. draw.RoundedBoxEx(4, HUD.PosX+HUD.Width/2-1,HUD.BPosY,2, HUD.BHeight + 2, Color(30,30,30,255), true, true, true, true)
  145.  
  146. else -- Hunger Enabled
  147.  
  148. -- Background
  149. draw.RoundedBoxEx(4, HUD.PosX+HUD.Width/2-1, HUD.BPosY - 1 - HUD.HO, HUD.Width + 28 + 2 - HUD.HH - 4, HUD.BHeight + 2 + HUD.HH + 2, Color(30,30,30,150), true, true, true, true)
  150. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY - HUD.HO, HUD.Width + 28 - HUD.HH - 4, HUD.BHeight + HUD.HH + 2, Color(50,50,50,150), true, true, true, true)
  151.  
  152. -- Sections
  153. draw.RoundedBoxEx(4, HUD.PosX, HUD.BPosY - HUD.HO, HUD.Width + 28 - HUD.HH - 4, HUD.BHeight + HUD.HH, Color(70,70,70,1), true, true, true, true)
  154.  
  155. end
  156.  
  157. end
  158.  
  159. local function Health()
  160.  
  161. -- Values
  162. local Health = LocalPlayer():Health() or 0
  163. local FullHealth = LocalPlayer():Health() or 0
  164. if Health < 0 then Health = 0 elseif Health > 100 then Health = 100 end
  165. local DrawHealth = math.Min(Health/GAMEMODE.Config.startinghealth, 1)
  166.  
  167. if !HUD.EnableHunger then
  168.  
  169. -- Title
  170. draw.DrawText("Health", "TCB_BebasNeue_1", HUD.PosX + 10 + 1 - 2, HUD.BPosY1 + 6 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  171. draw.DrawText("Health", "TCB_BebasNeue_1", HUD.PosX + 10 - 2, HUD.BPosY1 + 6, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  172.  
  173. -- Background Bar
  174. draw.RoundedBox(4, HUD.PosX + 60, HUD.BPosY1 + 7, HUD.BarWidth, HUD.BHeight1, Color(30,30,30,255))
  175.  
  176. -- Bar
  177. if Health != 0 then
  178. draw.RoundedBox(4, HUD.PosX + 60 + 1, HUD.BPosY1 + 7 + 1, (HUD.BarWidth - 2) * DrawHealth, HUD.BHeight1 - 2, HUD.HealthColor)
  179. end
  180.  
  181. draw.DrawText(FullHealth, "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY1 + 6 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  182. draw.DrawText(FullHealth, "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY1 + 6, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  183.  
  184. else -- Hunger Enabled
  185.  
  186. -- Title
  187. draw.DrawText("Health", "TCB_BebasNeue_1", HUD.PosX + 10 + 1 - 2, HUD.BPosY1 + 6 + 1 - HUD.HO - 2, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  188. draw.DrawText("Health", "TCB_BebasNeue_1", HUD.PosX + 10 - 2, HUD.BPosY1 + 6 - HUD.HO - 2, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  189.  
  190. -- Background Bar
  191. draw.RoundedBox(4, HUD.PosX + 60, HUD.BPosY1 + 7 - HUD.HO - 2, HUD.BarWidth, HUD.BHeight1, Color(30,30,30,255))
  192.  
  193. -- Bar
  194. if Health != 0 then
  195. draw.RoundedBox(4, HUD.PosX + 60 + 1, HUD.BPosY1 + 7 + 1 - HUD.HO - 2, (HUD.BarWidth - 2) * DrawHealth, HUD.BHeight1 - 2, HUD.HealthColor)
  196. end
  197.  
  198. draw.DrawText(FullHealth, "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY1 + 6 + 1 - HUD.HO - 2, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  199. draw.DrawText(FullHealth, "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY1 + 6 - HUD.HO - 2, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  200.  
  201. end
  202. end
  203.  
  204. local function Armor()
  205.  
  206. -- Values
  207. local Armor = LocalPlayer():Armor() or 0
  208. local FullArmor = LocalPlayer():Armor() or 0
  209. if Armor < 0 then Armor = 0 elseif Armor > 100 then Armor = 100 end
  210.  
  211. if !HUD.EnableHunger then
  212.  
  213. -- Title
  214. draw.DrawText("Armor", "TCB_BebasNeue_1", HUD.PosX + 10 + 1 - 2, HUD.BPosY2 + 6 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  215. draw.DrawText("Armor", "TCB_BebasNeue_1", HUD.PosX + 10 - 2, HUD.BPosY2 + 6, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  216.  
  217. -- Background Bar
  218. draw.RoundedBox(4, HUD.PosX + 60, HUD.BPosY2 + 7, HUD.BarWidth, HUD.BHeight1, Color(30,30,30,255))
  219.  
  220. -- Bar
  221. if Armor != 0 then
  222. draw.RoundedBox(4, HUD.PosX + 60 + 1, HUD.BPosY2 + 7 + 1, (HUD.BarWidth - 2) * Armor / 100, HUD.BHeight1 - 2, HUD.ArmorColor)
  223. end
  224.  
  225. draw.DrawText(Armor , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  226. draw.DrawText(Armor , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  227.  
  228. else --Hunger Enabled
  229.  
  230. -- Title
  231. draw.DrawText("Armor", "TCB_BebasNeue_1", HUD.PosX + 10 + 1 - 2, HUD.BPosY2 + 6 + 1 - HUD.HO - 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  232. draw.DrawText("Armor", "TCB_BebasNeue_1", HUD.PosX + 10 - 2, HUD.BPosY2 + 6 - HUD.HO - 1, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  233.  
  234. -- Background Bar
  235. draw.RoundedBox(4, HUD.PosX + 60, HUD.BPosY2 + 7 - HUD.HO - 1, HUD.BarWidth, HUD.BHeight1, Color(30,30,30,255))
  236.  
  237. -- Bar
  238. if Armor != 0 then
  239. draw.RoundedBox(4, HUD.PosX + 60 + 1, HUD.BPosY2 + 7 + 1 - HUD.HO - 1, (HUD.BarWidth - 2) * Armor / 100, HUD.BHeight1 - 2, HUD.ArmorColor)
  240. end
  241.  
  242. draw.DrawText(Armor , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6 + 1 - HUD.HO - 1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  243. draw.DrawText(Armor , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6 - HUD.HO - 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  244.  
  245. end
  246.  
  247. end
  248.  
  249. local function Hunger()
  250.  
  251. -- Values
  252. local Hunger = LocalPlayer():getDarkRPVar("Energy") or 0
  253. if Hunger < 0 then Hunger = 0 elseif Hunger > 100 then Hunger = 100 end
  254.  
  255. -- Title
  256. draw.DrawText("Hunger", "TCB_BebasNeue_1", HUD.PosX + 10 + 1 - 2, HUD.BPosY2 + 6 + HUD.HH + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  257. draw.DrawText("Hunger", "TCB_BebasNeue_1", HUD.PosX + 10 - 2, HUD.BPosY2 + 6 + HUD.HH, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  258.  
  259. -- Background Bar
  260. draw.RoundedBox(4, HUD.PosX + 60, HUD.BPosY2 + 7 + HUD.HH, HUD.BarWidth, HUD.BHeight1, Color(30,30,30,255))
  261.  
  262. -- Bar
  263. if Hunger != 0 then
  264. draw.RoundedBox(4, HUD.PosX + 60 + 1, HUD.BPosY2 + 7 + HUD.HH + 1, (HUD.BarWidth - 2) * Hunger / 100, HUD.BHeight1 - 2, HUD.HungerColor)
  265. end
  266.  
  267. draw.DrawText(Hunger , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6 + HUD.HH + 1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  268. draw.DrawText(Hunger , "TCB_BebasNeue_1", HUD.PosX + 60 + HUD.BarWidth / 2, HUD.BPosY2 + 6 + HUD.HH, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  269.  
  270. end
  271.  
  272. local function PlayerInfo()
  273.  
  274. -- Values
  275. local VAL_Name = LocalPlayer():Nick() or ""
  276. local VAL_Group = LocalPlayer():GetNWString("usergroup")
  277. local VAL_Job = LocalPlayer():getDarkRPVar("job") or ""
  278. local VAL_Wallet = HUD.Currency.." "..formatNumber(LocalPlayer():getDarkRPVar("money") or 0)
  279. local VAL_Salary = HUD.Currency.." "..formatNumber(LocalPlayer():getDarkRPVar("salary") or 0)
  280.  
  281. -- Name
  282. draw.DrawText("Name: ", "TCB_BebasNeue_2", HUD.PosX + 5 + 1, HUD.PosY + 18 * 2 + 2.5 * 2 + 1, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  283. draw.DrawText("Name: ", "TCB_BebasNeue_1", HUD.PosX + 5, HUD.PosY + 18 * 2 + 2.5 * 2, Color(192, 57, 43, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  284. draw.DrawText(VAL_Name, "TCB_BebasNeue_1", HUD.PosX + 55 + 1, HUD.PosY + 18 * 2 + 2.5 * 2 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  285. draw.DrawText(VAL_Name, "TCB_BebasNeue_1", HUD.PosX + 55, HUD.PosY + 18 * 2 + 2.5 * 2, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  286.  
  287. -- Rank
  288. draw.DrawText("Rank: ", "TCB_BebasNeue_1", HUD.PosX + 5 + 1, HUD.PosY + 18 * 1 + 2.5 * 2 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  289. draw.DrawText("Rank: ", "TCB_BebasNeue_1", HUD.PosX + 5, HUD.PosY + 18 * 1 + 2.5 * 2, Color(192, 57, 43, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  290. draw.DrawText(VAL_Group, "TCB_BebasNeue_1", HUD.PosX + 55 + 1, HUD.PosY + 18 * 1 + 2.5 * 2 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  291. draw.DrawText(VAL_Group, "TCB_BebasNeue_1", HUD.PosX + 55, HUD.PosY + 18 * 1 + 2.5 * 2, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  292.  
  293. -- Job
  294. draw.DrawText("Job: ", "TCB_BebasNeue_1", HUD.PosX + 5 + 1, HUD.PosY + 18 * 3 + 2.5 * 2 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  295. draw.DrawText("Job: ", "TCB_BebasNeue_1", HUD.PosX + 5, HUD.PosY + 18 * 3 + 2.5 * 2, Color(192, 57, 43, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  296. draw.DrawText(VAL_Job, "TCB_BebasNeue_1", HUD.PosX + 55 + 1, HUD.PosY + 18 * 3 + 2.5 * 2 + 1, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  297. draw.DrawText(VAL_Job, "TCB_BebasNeue_1", HUD.PosX + 55, HUD.PosY + 18 * 3 + 2.5 * 2, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  298.  
  299. -- Wallet
  300. draw.DrawText("Wallet: ", "TCB_BebasNeue_1", HUD.PosX + 245 + 1, HUD.PosY + 18 * 2 + 2.5 * 2 + 1 - 8, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  301. draw.DrawText("Wallet: ", "TCB_BebasNeue_1", HUD.PosX + 245, HUD.PosY + 18 * 2 + 2.5 * 2 - 8, Color(0, 255, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  302. draw.DrawText(VAL_Wallet, "TCB_BebasNeue_1", HUD.PosX + 300 + 1, HUD.PosY + 18 * 2 + 2.5 * 2 + 1 - 8, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  303. draw.DrawText(VAL_Wallet, "TCB_BebasNeue_1", HUD.PosX + 300, HUD.PosY + 18 * 2 + 2.5 * 2 - 8, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  304.  
  305. -- Salary
  306. draw.DrawText("Salary: ", "TCB_BebasNeue_1", HUD.PosX + 245 + 1, HUD.PosY + 18 * 3 + 2.5 * 2 + 1 - 8, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  307. draw.DrawText("Salary: ", "TCB_BebasNeue_1", HUD.PosX + 245, HUD.PosY + 18 * 3 + 2.5 * 2 - 8, Color(0, 255, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  308. draw.DrawText(VAL_Salary, "TCB_BebasNeue_1", HUD.PosX + 300 + 1, HUD.PosY + 18 * 3 + 2.5 * 2 + 1 - 8, Color(0, 0, 0, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  309. draw.DrawText(VAL_Salary, "TCB_BebasNeue_1", HUD.PosX + 300, HUD.PosY + 18 * 3 + 2.5 * 2 - 8, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  310.  
  311. end
  312.  
  313. local IconLicense = "icon16/page_red.png"
  314. local IconWanted = "icon16/exclamation.png"
  315. local IconTalking = "icon16/comments.png"
  316.  
  317. local function PlayerIcons()
  318.  
  319. if LocalPlayer():getDarkRPVar("HasGunlicense") then
  320. surface.SetDrawColor(255,255,255,255)
  321. else
  322. surface.SetDrawColor(25,25,25,255)
  323. end
  324. surface.SetMaterial(Material(IconLicense))
  325.  
  326. if !HUD.EnableHunger then
  327. surface.DrawTexturedRect( HUD.PosX + 12 + HUD.Width - 50 + 15, HUD.BPosY + 10, 20, 20)
  328. else -- Hunger Enabled
  329. surface.DrawTexturedRect( HUD.PosX + 12 + HUD.Width - 50 + 15, HUD.BPosY + 10 - 6, 20, 20)
  330. end
  331.  
  332. if LocalPlayer():getDarkRPVar("wanted") then
  333. surface.SetDrawColor(255,255,255,255)
  334. else
  335. surface.SetDrawColor(25,25,25,255)
  336. end
  337. surface.SetMaterial(Material(IconWanted))
  338.  
  339. if !HUD.EnableHunger then
  340. surface.DrawTexturedRect( HUD.PosX + 12 + HUD.Width - 50 + 15, HUD.BPosY + 35, 20, 20)
  341. else -- Hunger Enabled
  342. surface.DrawTexturedRect( HUD.PosX + 12 + HUD.Width - 50 + 15, HUD.BPosY + 35 - 7, 20, 20)
  343. end
  344.  
  345. if LocalPlayer().DRPIsTalking then
  346. surface.SetDrawColor(255,255,255,255)
  347. else
  348. surface.SetDrawColor(25,25,25,255)
  349. end
  350. surface.SetMaterial(Material(IconTalking))
  351.  
  352. if !HUD.EnableHunger then
  353. surface.DrawTexturedRect( HUD.PosX + 36 + HUD.Width - 50 + 15, HUD.BPosY + 23, 20, 20)
  354. else -- Hunger Enabled
  355. surface.DrawTexturedRect( HUD.PosX + 12 + HUD.Width - 50 + 15, HUD.BPosY + 52, 20, 20)
  356. end
  357.  
  358. end
  359.  
  360. /*-- Default HUD Elements --*/
  361.  
  362. local function Agenda()
  363. local agenda = LocalPlayer():getAgendaTable()
  364. if not agenda then return end
  365.  
  366. draw.RoundedBoxEx(4, ScrW() - 350 - 10 , 10, 350 + 10, 22, Color(50, 50, 50, 200), true, false,true,false)
  367.  
  368. draw.DrawNonParsedText(agenda.Title, "TargetID", ScrW() - 350, 14, Color(255, 230, 40, 255), 0)
  369.  
  370. local text = LocalPlayer():getDarkRPVar("agenda") or ""
  371.  
  372. text = text:gsub("//", "\n"):gsub("\\n", "\n")
  373. text = DarkRP.textWrap(text, "DarkRPHUD1", 440)
  374. draw.DrawNonParsedText(text, "DarkRPHUD1", ScrW() - 350, 35, Color(255, 255, 255, 255), 0)
  375. end
  376.  
  377. CreateConVar("DarkRP_LockDown", 0, {FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE})
  378. local function LockDown()
  379. local chbxX, chboxY = chat.GetChatBoxPos()
  380. if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
  381. local cin = (math.sin(CurTime()) + 1) / 2
  382. local chatBoxSize = math.floor(ScrH() / 4)
  383. draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  384. end
  385. end
  386.  
  387. if HUD.Y != "top" then
  388. ArrestedY = HUD.PosY - 23
  389. ArrestedX = HUD.PosX + HUD.Width / 2
  390. else
  391. ArrestedY = ScrH() - ScrH()/12
  392. ArrestedX = ScrW()/2
  393. end
  394.  
  395. local Arrested = function() end
  396.  
  397. usermessage.Hook("GotArrested", function(msg)
  398. local StartArrested = CurTime()
  399. local ArrestedUntil = msg:ReadFloat()
  400.  
  401. Arrested = function()
  402. if CurTime() - StartArrested <= ArrestedUntil and LocalPlayer():getDarkRPVar("Arrested") then
  403. draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ArrestedX, ArrestedY, Color(255, 255, 255, 255), 1)
  404. elseif not LocalPlayer():getDarkRPVar("Arrested") then
  405. Arrested = function() end
  406. end
  407. end
  408. end)
  409.  
  410. local AdminTell = function() end
  411.  
  412. usermessage.Hook("AdminTell", function(msg)
  413. timer.Destroy("DarkRP_AdminTell")
  414. local Message = msg:ReadString()
  415.  
  416. AdminTell = function()
  417. draw.RoundedBox(4, 10, 10, ScrW() - 20, 100, Color(0, 0, 0, 200))
  418. draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, Color(255, 255, 255, 255), 1)
  419. draw.DrawNonParsedText(Message, "ChatFont", ScrW() / 2 + 10, 80, Color(200, 30, 30, 255), 1)
  420. end
  421.  
  422. timer.Create("DarkRP_AdminTell", 10, 1, function()
  423. AdminTell = function() end
  424. end)
  425. end)
  426.  
  427. local function DrawPlayerInfo(ply)
  428. local pos = ply:EyePos()
  429.  
  430. pos.z = pos.z + 18 -- The position we want is a bit above the position of the eyes
  431. pos = pos:ToScreen()
  432. pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text
  433.  
  434. -- Info
  435.  
  436. draw.DrawText(ply:Nick(), "Trebuchet24", pos.x + 1, pos.y + 25 + 3, Color(0,0,0,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) --"TCB_BebasNeue_1"
  437. draw.DrawText(ply:Nick(), "Trebuchet24", pos.x, pos.y + 25, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  438.  
  439. local teamname = team.GetName(ply:Team())
  440. draw.DrawText(ply:getDarkRPVar("job") or teamname, "TCB_BebasNeue_1", pos.x + 1, pos.y + 52 + 1, Color(0,0,0,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  441. draw.DrawText(ply:getDarkRPVar("job") or teamname, "TCB_BebasNeue_1", pos.x, pos.y + 52, team.GetColor(ply:Team()), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  442.  
  443. if ply:getDarkRPVar("HasGunlicense") then
  444. surface.SetMaterial(Material(IconLicense))
  445. surface.SetDrawColor(255,255,255,150)
  446. surface.DrawTexturedRect(pos.x - 28, pos.y - 15, 28, 28)
  447.  
  448. else
  449. surface.SetMaterial(Material(IconLicense))
  450. surface.SetDrawColor(25,25,25,75)
  451. surface.DrawTexturedRect(pos.x - 28, pos.y - 15, 28, 28) --pos.x-16 pos.y-60 32 32
  452.  
  453. end
  454.  
  455. if ply:getDarkRPVar("wanted") then
  456. surface.SetMaterial(Material(IconWanted))
  457. surface.SetDrawColor(255,255,255,150)
  458. surface.DrawTexturedRect(pos.x + 8, pos.y - 15, 28, 28)
  459.  
  460. else
  461. surface.SetMaterial(Material(IconWanted))
  462. surface.SetDrawColor(25,25,25,75)
  463. surface.DrawTexturedRect(pos.x + 8, pos.y - 15, 28, 28) --pos.x-16 pos.y-60
  464.  
  465. end
  466.  
  467. end
  468.  
  469. local function DrawWantedInfo(ply)
  470. if not ply:Alive() then return end
  471.  
  472. local pos = ply:EyePos()
  473. if not pos:isInSight({LocalPlayer(), ply}) then return end
  474.  
  475. pos.z = pos.z + 10
  476. pos = pos:ToScreen()
  477. pos.y = pos.y - 50
  478.  
  479. local wantedText = "WANTED" --DarkRP.getPhrase("wanted", tostring(ply:getDarkRPVar("wantedReason")))
  480.  
  481. draw.RoundedBox(4, pos.x - 51, pos.y - 100 - 5, 100+2, 30+2, Color(30, 30, 30, 255))
  482. draw.RoundedBox(4, pos.x - 50, pos.y - 99 - 5, 100, 30, Color(70, 70, 70, 255))
  483.  
  484. draw.DrawText(wantedText, "TCB_BebasNeue_1", pos.x + 1, pos.y - 99, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  485. draw.DrawText(wantedText, "TCB_BebasNeue_1", pos.x, pos.y - 100, Color(255, 0, 0, 200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  486. end
  487.  
  488. local function DrawEntityDisplay()
  489. local shootPos = LocalPlayer():GetShootPos()
  490. local aimVec = LocalPlayer():GetAimVector()
  491.  
  492. for k, ply in pairs(players or player.GetAll()) do
  493. if not ply:Alive() or ply == LocalPlayer() then continue end
  494. local hisPos = ply:GetShootPos()
  495. if ply:getDarkRPVar("wanted") then end
  496.  
  497. if GAMEMODE.Config.globalshow then
  498. DrawPlayerInfo(ply)
  499. -- Draw when you're (almost) looking at him
  500. elseif not GAMEMODE.Config.globalshow and hisPos:DistToSqr(shootPos) < 20000 then
  501. local pos = hisPos - shootPos
  502. local unitPos = pos:GetNormalized()
  503. if unitPos:Dot(aimVec) > 0.95 then
  504. local trace = util.QuickTrace(shootPos, pos, LocalPlayer())
  505. if trace.Hit and trace.Entity ~= ply then return end
  506. DrawPlayerInfo(ply)
  507. end
  508. end
  509. end
  510.  
  511. local tr = LocalPlayer():GetEyeTrace()
  512.  
  513. if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():Distance(LocalPlayer():GetPos()) < 200 then
  514. tr.Entity:drawOwnableInfo()
  515. end
  516. end
  517.  
  518. function GAMEMODE:DrawDeathNotice(x, y)
  519. if not GAMEMODE.Config.showdeaths then return end
  520. self.BaseClass:DrawDeathNotice(x, y)
  521. end
  522.  
  523. local function DisplayNotify(msg)
  524. local txt = msg:ReadString()
  525. GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
  526. surface.PlaySound("buttons/lightswitch2.wav")
  527.  
  528. -- Log to client console
  529. print(txt)
  530. end
  531. usermessage.Hook("_Notify", DisplayNotify)
  532.  
  533. function DisableDrawInfo()
  534. return false
  535. end
  536. hook.Add("HUDDrawTargetID", "DisableDrawInfo", DisableDrawInfo)
  537.  
  538. /*-- Draw HUD Elements --*/
  539. local function DrawTCB()
  540.  
  541. -- Custom
  542. Base()
  543. Health()
  544. Armor()
  545.  
  546. if HUD.EnableHunger then
  547. Hunger()
  548. end
  549.  
  550. PlayerInfo()
  551. PlayerIcons()
  552.  
  553. -- Default
  554. Agenda()
  555. LockDown()
  556.  
  557. Arrested()
  558. AdminTell()
  559.  
  560. --
  561. DrawEntityDisplay()
  562.  
  563. end
  564.  
  565. hook.Add("HUDPaint", "DrawTCB", DrawTCB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement