Advertisement
pogh10

Untitled

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