pogh10

Untitled

May 22nd, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.67 KB | None | 0 0
  1. /*---------------------------------------------------------------------------
  2. HUD ConVars
  3. ---------------------------------------------------------------------------*/
  4. local ConVars = {}
  5. local HUDWidth
  6. local HUDHeight
  7.  
  8. local Color = Color
  9. local CurTime = CurTime
  10. local cvars = cvars
  11. local DarkRP = DarkRP
  12. local draw = draw
  13. local GetConVar = GetConVar
  14. local hook = hook
  15. local IsValid = IsValid
  16. local Lerp = Lerp
  17. localplayer = LocalPlayer()
  18. local math = math
  19. local pairs = pairs
  20. local ScrW, ScrH = ScrW, ScrH
  21. local SortedPairs = SortedPairs
  22. local string = string
  23. local surface = surface
  24. local table = table
  25. local timer = timer
  26. local tostring = tostring
  27. local plyMeta = FindMetaTable("Player")
  28. LocalPlayer().MaxHealth = 100
  29. LocalPlayer().MaxArmor = 100
  30.  
  31.  
  32. local colors = {}
  33. colors.black = Color(0, 0, 0, 255)
  34. colors.blue = Color(0, 0, 255, 255)
  35. colors.brightred = Color(200, 30, 30, 255)
  36. colors.darkred = Color(0, 0, 70, 100)
  37. colors.darkblack = Color(0, 0, 0, 200)
  38. colors.gray1 = Color(0, 0, 0, 155)
  39. colors.gray2 = Color(51, 58, 51,100)
  40. colors.red = Color(255, 0, 0, 255)
  41. colors.white = Color(255, 255, 255, 255)
  42. colors.white1 = Color(255, 255, 255, 200)
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. local material = Material("vgui/ob_hudelements/statusbar.png", "smooth")
  51.  
  52. local Lerp = Lerp
  53.  
  54. local localplayer, bar, red, green, blue, orange
  55. local texCoords = {}
  56.  
  57. local stamina, maxStamina = 100, 100
  58.  
  59. local function SetupCoords()
  60. local texW, texH = 512, 96
  61.  
  62. texCoords[1] = {x = 0, y = 1, w = 348, h = 22}
  63. texCoords[2] = {x = 0, y = 58, w = 512, h = 16}
  64. texCoords[3] = {x = 0, y = 41, w = 512, h = 16}
  65. texCoords[4] = {x = 0, y = 32, w = 512, h = 8}
  66. texCoords[5] = {x = 0, y = 75, w = 512, h = 16}
  67.  
  68. for k,v in pairs(texCoords) do
  69. v.w = math.Round((v.w + v.x) / texW, 3)
  70. v.h = math.Round((v.h + v.y) / texH, 3)
  71. v.x = math.Round(v.x / texW, 3)
  72. v.y = math.Round(v.y / texH, 3)
  73. end
  74.  
  75. bar = texCoords[1]
  76. red = texCoords[2]
  77. green = texCoords[3]
  78. blue = texCoords[4]
  79. orange = texCoords[5]
  80. end
  81. SetupCoords()
  82.  
  83. local lastHealth, lastArmor, lastFood, lastStamina = 0, 0, 0, 0
  84.  
  85. hook.Add("HUDPaint", "SKYRIM_HUD", function()
  86. if(Inventory and Inventory.Open) then return end
  87.  
  88. surface.SetMaterial(material)
  89. surface.SetDrawColor(color_white)
  90.  
  91. surface.DrawTexturedRectUV( 50, ScrH() * 0.95, 348, 22, bar.x, bar.y, bar.w, bar.h)
  92. surface.DrawTexturedRectUV( 72, ScrH() * 0.95 + 2, lastFood, 18, orange.x, orange.y, orange.w, orange.h)
  93.  
  94. surface.DrawTexturedRectUV( ScrW() * 0.5 - 174, ScrH() * 0.95, 348, 22, bar.x, bar.y, bar.w, bar.h)
  95. surface.DrawTexturedRectUV( ScrW() * 0.5 - 152, ScrH() * 0.95 + 3, lastHealth, 16, red.x, red.y, red.w, red.h)
  96. surface.DrawTexturedRectUV( ScrW() * 0.5 - 152, ScrH() * 0.95 + 11, lastArmor, 8, blue.x, blue.y, blue.w, blue.h)
  97.  
  98. surface.DrawTexturedRectUV( ScrW() - 398, ScrH() * 0.95, 348, 22, bar.x, bar.y, bar.w, bar.h)
  99. surface.DrawTexturedRectUV( ScrW() - 377, ScrH() * 0.95 + 3, lastStamina, 16, green.x, green.y, green.w, green.h)
  100. end)
  101.  
  102.  
  103. hook.Add("Think", "SKYRIM_HUD", function()
  104. if(!IsValid(LocalPlayer())) then return end
  105.  
  106. if(lastHealth != LocalPlayer():Health()) then
  107. local d = math.Clamp( LocalPlayer():Health(), 0, 100 ) / (LocalPlayer():GetMaxHealth())
  108. lastHealth = Lerp(FrameTime(), lastHealth, d * 305)
  109. red.w = math.Clamp( LocalPlayer():GetMaxHealth(), 0, 100 )
  110.  
  111. end
  112.  
  113.  
  114. if(lastArmor != LocalPlayer():Armor()) then
  115. local d = LocalPlayer():Armor() / (LocalPlayer().MaxArmor or 100)
  116. lastArmor = Lerp(FrameTime(), lastArmor, d * 305)
  117. blue.w = math.Clamp((lastArmor / (LocalPlayer().MaxArmor or 100)) / 3.05, 0, 200)
  118. end
  119.  
  120. local energy = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0)
  121. if(lastFood != energy) then
  122. local d = energy / 100
  123. lastFood = Lerp(FrameTime(), lastFood, d * 305)
  124. orange.w = math.Clamp( (lastFood / (energy or 100)) / 3.05, 0, 200)
  125. end
  126.  
  127. if(lastStamina != stamina) then
  128. local d = stamina / maxStamina
  129. lastStamina = Lerp(FrameTime(), lastStamina, d * 305)
  130. green.w = math.Clamp( (lastStamina / (maxStamina or 100)) / 3.05, 0, 200)
  131. end
  132. end)
  133.  
  134. net.Receive("HUD_Stamina", function(ply, length)
  135. stamina = net.ReadUInt(8)
  136. end)
  137.  
  138. net.Receive("HUD_MaxStamina", function(ply, length)
  139. maxStamina = net.ReadUInt(8)
  140. end)
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. --===============================================START OF SKYRIM HUD IS ABOVE ME FACK BOI LOL AND BELOW IS THE BAR IF YOU IZ NOT EFEX AND SEE DIS FUCK YA!@@! ENJOY M8
  150. local function bizzahud()
  151. if !IsValid(LocalPlayer()) then return end
  152. local localplayer = LocalPlayer()
  153.  
  154. draw.RoundedBox( 0, 0, ScrH() - 0.5, 1500, 25, Color( 0, 0, 0, 195 ) )
  155. -- OLD: draw.SimpleText( "[AG] Kingdom RP |", "SkyrimBAR", 30, ScrH() - 800, Color( 255, 255, 255, 25 ) )
  156. draw.SimpleText( "[AG] Kingdom RP |", "SkyrimBAR", 30, ScrH() * 0.5, Color( 255, 255, 255, 25 ) )
  157.  
  158. -- OLD: draw.SimpleText( localplayer:Nick(), "SkyrimBAR", 260, ScrH() - 800, Color( 255, 255, 255, 255 ))
  159. draw.SimpleText( localplayer:Nick(), "SkyrimBAR", ScrW() * 0.2, ScrH() * 0, Color( 255, 255, 255, 255 ))
  160.  
  161. draw.SimpleText( "Life Style:", "SkyrimBAR", 450, ScrH() - 800, Color( 255, 255, 255, 255 ))
  162. draw.SimpleText(( localplayer:getDarkRPVar( "job" ) or 0 ), "SkyrimBAR", 522, ScrH() - 800, team.GetColor(localplayer:Team()))
  163. draw.SimpleText( "Salary: " .. ( localplayer:getDarkRPVar( "salary" ) or 0 ) .. " gold", "SkyrimBAR", 670, ScrH() - 800, Color( 255, 255, 255, 255 ) )
  164. draw.SimpleText( "Gold: " .. ( localplayer:getDarkRPVar( "money" ) or 0 ), "SkyrimBAR", 850, ScrH() - 800, Color( 255, 255, 255, 255 ) )
  165. draw.SimpleText( "Level: " .. ST_Level, "SkyrimBAR", 990, ScrH() - 800, Color( 255, 255, 255, 255 ) )
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179. end
  180.  
  181. hook.Add("HUDPaint", "HUDByMrIbizza", bizzahud)
  182.  
  183. --=========================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  184.  
  185.  
  186. local function ReloadConVars()
  187. ConVars = {
  188. background = {0,0,0,100},
  189. Healthbackground = {0,0,0,200},
  190. Healthforeground = {140,0,0,180},
  191. HealthText = {255,255,255,200},
  192. Job1 = {0,0,150,200},
  193. Job2 = {0,0,0,255},
  194. salary1 = {0,150,0,200},
  195. salary2 = {0,0,0,255}
  196. }
  197.  
  198. for name, Colour in pairs(ConVars) do
  199. ConVars[name] = {}
  200. for num, rgb in SortedPairs(Colour) do
  201. local CVar = GetConVar(name..num) or CreateClientConVar(name..num, rgb, true, false)
  202. table.insert(ConVars[name], CVar:GetInt())
  203.  
  204. if not cvars.GetConVarCallbacks(name..num, false) then
  205. cvars.AddChangeCallback(name..num, function() timer.Simple(0,ReloadConVars) end)
  206. end
  207. end
  208. ConVars[name] = Color(unpack(ConVars[name]))
  209. end
  210.  
  211.  
  212. HUDWidth = (GetConVar("HudW") or CreateClientConVar("HudW", 240, true, false)):GetInt()
  213. HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()
  214.  
  215. if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then
  216. cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)
  217. cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)
  218. end
  219. end
  220. ReloadConVars()
  221.  
  222. local Scrw, Scrh, RelativeX, RelativeY
  223. /*---------------------------------------------------------------------------
  224. HUD Seperate Elements
  225. ---------------------------------------------------------------------------*/
  226. local Health = 0
  227. local function DrawHealth()
  228. local maxHealth = localplayer:GetMaxHealth()
  229. local myHealth = localplayer:Health()
  230. Health = math.min(maxHealth, (Health == myHealth and Health) or Lerp(0.1, Health, myHealth))
  231.  
  232. local DrawHealth = math.Min(Health / maxHealth, 1)
  233. local rounded = math.Round(3*DrawHealth)
  234. local Border = math.Min(6, rounded * rounded)
  235. draw.RoundedBox(Border, RelativeX + 4, RelativeY - 30, HUDWidth - 8, 20, ConVars.Healthbackground)
  236. draw.RoundedBox(Border, RelativeX + 5, RelativeY - 29, (HUDWidth - 9) * DrawHealth, 18, ConVars.Healthforeground)
  237.  
  238. draw.DrawNonParsedText(math.Max(0, math.Round(myHealth)), "DarkRPHUD2", RelativeX + 4 + (HUDWidth - 8)/2, RelativeY - 32, ConVars.HealthText, 1)
  239.  
  240. -- Armor
  241. local armor = localplayer:Armor()
  242. if armor ~= 0 then
  243. draw.RoundedBox(2, RelativeX + 4, RelativeY - 15, (HUDWidth - 8) * armor / 100, 5, colors.blue)
  244. end
  245. end
  246.  
  247. local salaryText, JobWalletText
  248. local function DrawInfo()
  249. salaryText = salaryText or DarkRP.getPhrase("salary", DarkRP.formatMoney(localplayer:getDarkRPVar("salary")), "")
  250.  
  251. JobWalletText = JobWalletText or string.format("%s\n%s",
  252. DarkRP.getPhrase("job", localplayer:getDarkRPVar("job") or ""),
  253. DarkRP.getPhrase("wallet", DarkRP.formatMoney(localplayer:getDarkRPVar("money")), "")
  254. )
  255.  
  256. --draw.DrawNonParsedText(salaryText, "DarkRPHUD2", RelativeX + 5, RelativeY - HUDHeight + 6, ConVars.salary1, 0)
  257. --draw.DrawNonParsedText(salaryText, "DarkRPHUD2", RelativeX + 4, RelativeY - HUDHeight + 5, ConVars.salary2, 0)
  258.  
  259. surface.SetFont("DarkRPHUD2")
  260. local w, h = surface.GetTextSize(salaryText)
  261.  
  262. --draw.DrawNonParsedText(JobWalletText, "DarkRPHUD2", RelativeX + 5, RelativeY - HUDHeight + h + 6, ConVars.Job1, 0)
  263. --draw.DrawNonParsedText(JobWalletText, "DarkRPHUD2", RelativeX + 4, RelativeY - HUDHeight + h + 5, ConVars.Job2, 0)
  264. end
  265.  
  266. local Page = Material("icon16/page_white_text.png")
  267. local function GunLicense()
  268. if localplayer:getDarkRPVar("HasGunlicense") then
  269. surface.SetMaterial(Page)
  270. surface.SetDrawColor(255, 255, 255, 255)
  271. surface.DrawTexturedRect(RelativeX + HUDWidth, Scrh - 34, 32, 32)
  272. end
  273. end
  274.  
  275. local agendaText
  276. local function Agenda()
  277. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Agenda")
  278. if shouldDraw == false then return end
  279.  
  280. local agenda = localplayer:getAgendaTable()
  281. if not agenda then return end
  282. agendaText = agendaText or DarkRP.textWrap((localplayer:getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
  283.  
  284. draw.RoundedBox(10, 10, 10, 460, 110, colors.gray1)
  285. draw.RoundedBox(10, 12, 12, 456, 106, colors.gray2)
  286. draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)
  287.  
  288. draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 30, 12, colors.red, 0)
  289. draw.DrawNonParsedText(agendaText, "DarkRPHUD1", 30, 35, colors.white, 0)
  290. end
  291.  
  292. hook.Add("DarkRPVarChanged", "agendaHUD", function(ply, var, _, new)
  293. if ply ~= localplayer then return end
  294. if var == "agenda" and new then
  295. agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
  296. else
  297. agendaText = nil
  298. end
  299.  
  300. if var == "salary" then
  301. salaryText = DarkRP.getPhrase("salary", DarkRP.formatMoney(new), "")
  302. end
  303.  
  304. if var == "job" or var == "money" then
  305. JobWalletText = string.format("%s\n%s",
  306. DarkRP.getPhrase("job", var == "job" and new or localplayer:getDarkRPVar("job") or ""),
  307. DarkRP.getPhrase("wallet", var == "money" and DarkRP.formatMoney(new) or DarkRP.formatMoney(localplayer:getDarkRPVar("money")), "")
  308. )
  309. end
  310. end)
  311.  
  312. local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
  313. local function DrawVoiceChat()
  314. if localplayer.DRPIsTalking then
  315. local chbxX, chboxY = chat.GetChatBoxPos()
  316.  
  317. local Rotating = math.sin(CurTime()*3)
  318. local backwards = 0
  319. if Rotating < 0 then
  320. Rotating = 1-(1+Rotating)
  321. backwards = 180
  322. end
  323. surface.SetTexture(VoiceChatTexture)
  324. surface.SetDrawColor(ConVars.Healthforeground)
  325. surface.DrawTexturedRectRotated(Scrw - 100, chboxY, Rotating*96, 96, backwards)
  326. end
  327. end
  328.  
  329. local function LockDown()
  330. local chbxX, chboxY = chat.GetChatBoxPos()
  331. if GetGlobalBool("DarkRP_LockDown") then
  332. local cin = (math.sin(CurTime()) + 1) / 2
  333. local chatBoxSize = math.floor(Scrh / 4)
  334. draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  335. end
  336. end
  337.  
  338. local Arrested = function() end
  339.  
  340. usermessage.Hook("GotArrested", function(msg)
  341. local StartArrested = CurTime()
  342. local ArrestedUntil = msg:ReadFloat()
  343.  
  344. Arrested = function()
  345. if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
  346. draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", Scrw/2, Scrh - Scrh/12, colors.white, 1)
  347. elseif not localplayer:getDarkRPVar("Arrested") then
  348. Arrested = function() end
  349. end
  350. end
  351. end)
  352.  
  353. local AdminTell = function() end
  354.  
  355. usermessage.Hook("AdminTell", function(msg)
  356. timer.Destroy("DarkRP_AdminTell")
  357. local Message = msg:ReadString()
  358.  
  359. AdminTell = function()
  360. draw.RoundedBox(4, 10, 10, Scrw - 20, 110, colors.darkblack)
  361. draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", Scrw / 2 + 10, 10, colors.white, 1)
  362. draw.DrawNonParsedText(Message, "ChatFont", Scrw / 2 + 10, 90, colors.brightred, 1)
  363. end
  364.  
  365. timer.Create("DarkRP_AdminTell", 10, 1, function()
  366. AdminTell = function() end
  367. end)
  368. end)
  369.  
  370. /*---------------------------------------------------------------------------
  371. Drawing the HUD elements such as Health etc.
  372. ---------------------------------------------------------------------------*/
  373. local function DrawHUD()
  374. localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
  375. if not IsValid(localplayer) then return end
  376.  
  377. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")
  378. if shouldDraw == false then return end
  379.  
  380. Scrw, Scrh = ScrW(), ScrH()
  381. RelativeX, RelativeY = 0, Scrh
  382.  
  383. shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LocalPlayerHUD")
  384. shouldDraw = shouldDraw ~= false and (GAMEMODE.BaseClass.HUDShouldDraw(GAMEMODE, "DarkRP_LocalPlayerHUD") ~= false)
  385. if shouldDraw then
  386. --Background
  387. --draw.RoundedBox(6, 0, Scrh - HUDHeight, HUDWidth, HUDHeight, ConVars.background)
  388. --DrawHealth()
  389. DrawInfo()
  390. GunLicense()
  391. end
  392. --Agenda()
  393. DrawVoiceChat()
  394. LockDown()
  395.  
  396. Arrested()
  397. AdminTell()
  398. end
  399.  
  400. /*---------------------------------------------------------------------------
  401. Entity HUDPaint things
  402. ---------------------------------------------------------------------------*/
  403. -- Draw a player's name, health and/or job above the head
  404. -- This syntax allows for easy overriding
  405. plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self)
  406. local pos = self:EyePos()
  407.  
  408. pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
  409. pos = pos:ToScreen()
  410. if not self:getDarkRPVar("wanted") then
  411. -- Move the text up a few pixels to compensate for the height of the text
  412. pos.y = pos.y - 50
  413. end
  414.  
  415. if GAMEMODE.Config.showname then
  416. local nick, plyTeam = self:Nick(), self:Team()
  417. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  418. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  419. end
  420.  
  421. if GAMEMODE.Config.showhealth then
  422. local health = DarkRP.getPhrase("health", self:Health())
  423. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  424. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  425. end
  426.  
  427. if GAMEMODE.Config.showjob then
  428. local teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
  429. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  430. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  431. end
  432.  
  433. if self:getDarkRPVar("HasGunlicense") then
  434. surface.SetMaterial(Page)
  435. surface.SetDrawColor(255,255,255,255)
  436. surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  437. end
  438. end
  439.  
  440. -- Draw wanted information above a player's head
  441. -- This syntax allows for easy overriding
  442. plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self)
  443. if not self:Alive() then return end
  444.  
  445. local pos = self:EyePos()
  446. if not pos:isInSight({localplayer, self}) then return end
  447.  
  448. pos.z = pos.z + 10
  449. pos = pos:ToScreen()
  450.  
  451. if GAMEMODE.Config.showname then
  452. local nick, plyTeam = self:Nick(), self:Team()
  453. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  454. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  455. end
  456.  
  457. local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))
  458.  
  459. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
  460. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)
  461. end
  462.  
  463. /*---------------------------------------------------------------------------
  464. The Entity display: draw HUD information about entities
  465. ---------------------------------------------------------------------------*/
  466. local function DrawEntityDisplay()
  467. local shouldDraw, players = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay")
  468. if shouldDraw == false then return end
  469.  
  470. local shootPos = localplayer:GetShootPos()
  471. local aimVec = localplayer:GetAimVector()
  472.  
  473. for k, ply in pairs(players or player.GetAll()) do
  474. if ply == localplayer or not ply:Alive() or ply:GetNoDraw() then continue end
  475. local hisPos = ply:GetShootPos()
  476. if ply:getDarkRPVar("wanted") then ply:drawWantedInfo() end
  477.  
  478. if GAMEMODE.Config.globalshow then
  479. ply:drawPlayerInfo()
  480. -- Draw when you're (almost) looking at him
  481. elseif hisPos:DistToSqr(shootPos) < 160000 then
  482. local pos = hisPos - shootPos
  483. local unitPos = pos:GetNormalized()
  484. if unitPos:Dot(aimVec) > 0.95 then
  485. local trace = util.QuickTrace(shootPos, pos, localplayer)
  486. if trace.Hit and trace.Entity ~= ply then return end
  487. ply:drawPlayerInfo()
  488. end
  489. end
  490. end
  491.  
  492. local tr = localplayer:GetEyeTrace()
  493.  
  494. if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(localplayer:GetPos()) < 40000 then
  495. tr.Entity:drawOwnableInfo()
  496. end
  497. end
  498.  
  499. /*---------------------------------------------------------------------------
  500. Drawing death notices
  501. ---------------------------------------------------------------------------*/
  502. function GM:DrawDeathNotice(x, y)
  503. if not GAMEMODE.Config.showdeaths then return end
  504. self.BaseClass:DrawDeathNotice(x, y)
  505. end
  506.  
  507. /*---------------------------------------------------------------------------
  508. Display notifications
  509. ---------------------------------------------------------------------------*/
  510. local function DisplayNotify(msg)
  511. local txt = msg:ReadString()
  512. GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
  513. surface.PlaySound("buttons/lightswitch2.wav")
  514.  
  515. -- Log to client console
  516. MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
  517. end
  518. usermessage.Hook("_Notify", DisplayNotify)
  519.  
  520. /*---------------------------------------------------------------------------
  521. Remove some elements from the HUD in favour of the DarkRP HUD
  522. ---------------------------------------------------------------------------*/
  523. function hidehud(name)
  524. for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo"})do
  525. if name == v then return false end
  526. end
  527. end
  528. hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
  529.  
  530. /*---------------------------------------------------------------------------
  531. Disable players' names popping up when looking at them
  532. ---------------------------------------------------------------------------*/
  533. function GM:HUDDrawTargetID()
  534. return false
  535. end
  536. /*---------------------------------------------------------------------------
  537. Actual HUDPaint hook
  538. ---------------------------------------------------------------------------*/
  539. function GM:HUDPaint()
  540. DrawHUD()
  541. DrawEntityDisplay()
  542. self.BaseClass:HUDPaint()
  543. end
Advertisement
Add Comment
Please, Sign In to add comment