Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2019
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.96 KB | None | 0 0
  1. -----------------------------------------------------------------------------------------------------------------------------------------
  2. -- Frk👑 - np_hud
  3. -----------------------------------------------------------------------------------------------------------------------------------------
  4.  
  5. local dir = { [0] = 'N', [90] = 'W', [180] = 'S', [270] = 'E', [360] = 'N'}
  6. local Period = "AM"
  7. local Hours = nil
  8. local Minutes = nil
  9. local ped = PlayerPedId()
  10. local pos = GetEntityCoords(ped)
  11. local rua, cross = GetStreetNameAtCoord(pos.x, pos.y, pos.z)
  12. local Zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))
  13.  
  14. Citizen.CreateThread(function()
  15. while true do
  16. CheckClock()
  17. Citizen.Wait(1000)
  18. end
  19. end)
  20.  
  21. Citizen.CreateThread(function()
  22. while true do
  23. CheckPlayerPosition()
  24. Citizen.Wait(1000)
  25. end
  26. end)
  27.  
  28. Citizen.CreateThread(function()
  29. while true do
  30. Citizen.Wait(1)
  31. local UI = GetMinimapAnchor()
  32. local HP = GetEntityHealth(ped) / 200.0
  33. local Armor = GetPedArmour(ped) / 100.0
  34. if Armor > 1.0 then Armor = 1.0 end
  35.  
  36. drawRct(UI.Left_x, UI.Bottom_y - 0.017, UI.Width, 0.028, 0, 0, 0, 255) -- Black background
  37. drawRct(UI.Left_x + 0.001 , UI.Bottom_y - 0.015, UI.Width - 0.002 , 0.009, 88, 88, 88, 200) -- HP background
  38. drawRct(UI.Left_x + 0.001 , UI.Bottom_y - 0.015, (UI.Width -0.002) * HP , 0.009, 88, 155, 0, 200) -- HP bar
  39. drawRct(UI.Left_x + 0.001 , UI.Bottom_y - 0.002, UI.Width - 0.002 , 0.009, 88, 88, 88, 200) -- Armor background
  40. drawRct(UI.Left_x + 0.001 , UI.Bottom_y - 0.002, (UI.Width - 0.002) * Armor , 0.009, 51, 171, 249, 200) -- Armor bar
  41.  
  42. if IsPedInAnyVehicle(ped, false) then
  43. local speed = math.floor(GetEntitySpeed(GetVehiclePedIsIn(ped, false)) * 2.236936)
  44. DisplayRadar(true) -- Activates minimap
  45. drawRct(UI.Left_x, UI.Bottom_y - 0.248 , UI.Width, 0.073, 0, 0, 0, 55)
  46. drawTxt(UI.Left_x + 0.001 , UI.Bottom_y - 0.249, 0.55, Hours .. ":" .. Minutes .. " " .. Period, 255, 255, 255, 255, 8) -- Clock
  47. drawTxt(UI.Left_x + 0.001 , UI.Bottom_y - 0.217 , 0.58, heading, 250, 218, 94, 255, 8) -- Heading
  48. drawTxt(UI.Left_x + 0.023 , UI.Bottom_y - 0.216 , 0.3, GetStreetNameFromHashKey(rua), 255, 255, 255, 255, 8) -- Street
  49. drawTxt(UI.Left_x + 0.023 , UI.Bottom_y - 0.199 , 0.25, Zone, 255, 255, 255, 255, 8) -- Area
  50.  
  51. drawTxt(UI.Left_x + 0.003 , UI.Bottom_y - 0.045 , 0.4, speed .. " MPH", 255, 255, 255, 255, 4) -- Speed
  52. drawRct(UI.Left_x, UI.Bottom_y - 0.045 , UI.Width, 0.073, 0, 0, 0, 55)
  53. else
  54. DisplayRadar(false) -- Deactivates minimap
  55. drawRct(UI.Left_x, UI.Bottom_y - 0.088 , UI.Width, 0.073, 0, 0, 0, 55) -- Background
  56. drawTxt(UI.Left_x + 0.001 , UI.Bottom_y - 0.09 , 0.55, Hours .. ":" .. Minutes .. " " .. Period, 255, 255, 255, 255, 8) -- Clock
  57. drawTxt(UI.Left_x + 0.001 , UI.Bottom_y - 0.058 , 0.58, heading, 250, 218, 94, 255, 8) -- Heading
  58. drawTxt(UI.Left_x + 0.023 , UI.Bottom_y - 0.057 , 0.3, GetStreetNameFromHashKey(rua), 255, 255, 255, 255, 8) -- Street
  59. drawTxt(UI.Left_x + 0.023 , UI.Bottom_y - 0.04 , 0.25, Zone, 255, 255, 255, 255, 8) -- Area
  60. end
  61.  
  62. end
  63. end)
  64.  
  65. function CheckClock()
  66. Hours = GetClockHours()
  67. if Hours > 12 then
  68. Hours = Hours - 12
  69. Period = "PM"
  70. else
  71. Period = "AM"
  72. end
  73. if Hours < 10 then Hours = "0" .. Hours end
  74. Minutes = GetClockMinutes()
  75. if Minutes < 10 then Minutes = "0" .. Minutes end
  76. for k,v in pairs(dir)do
  77. heading = GetEntityHeading(ped)
  78. if(math.abs(heading - k) < 45)then
  79. heading = v
  80. break
  81. end
  82. end
  83. end
  84.  
  85. function CheckPlayerPosition()
  86. pos = GetEntityCoords(ped)
  87. rua, cross = GetStreetNameAtCoord(pos.x, pos.y, pos.z)
  88. Zone = GetLabelText(GetNameOfZone(pos.x, pos.y, pos.z))
  89. end
  90.  
  91. function drawRct(x,y,Width,height,r,g,b,a)
  92. DrawRect(x+Width/2,y+height/2,Width,height,r,g,b,a)
  93. end
  94.  
  95. function drawTxt(x,y,scale,text,r,g,b,a,font)
  96. SetTextFont(font)
  97. SetTextScale(scale,scale)
  98. SetTextColour(r,g,b,a)
  99. SetTextOutline()
  100. SetTextEntry("STRING")
  101. AddTextComponentString(text)
  102. DrawText(x,y)
  103. end
  104.  
  105. function disableHud()
  106. HideHudComponentThisFrame(6)
  107. HideHudComponentThisFrame(7)
  108. HideHudComponentThisFrame(8)
  109. HideHudComponentThisFrame(9)
  110. end
  111.  
  112. function GetMinimapAnchor()
  113. local safezone = GetSafeZoneSize()
  114. local safezone_x = 1.0 / 20.0
  115. local safezone_y = 1.0 / 20.0
  116. local aspect_ratio = GetAspectRatio(0)
  117. local res_x, res_y = GetActiveScreenResolution()
  118. local xscale = 1.0 / res_x
  119. local yscale = 1.0 / res_y
  120. local Minimap = {}
  121. Minimap.Width = xscale * (res_x / (4 * aspect_ratio))
  122. Minimap.height = yscale * (res_y / 5.674)
  123. Minimap.Left_x = xscale * (res_x * (safezone_x * ((math.abs(safezone - 1.0)) * 10)))
  124. Minimap.Bottom_y = 1.0 - yscale * (res_y * (safezone_y * ((math.abs(safezone - 1.0)) * 10)))
  125. Minimap.right_x = Minimap.Left_x + Minimap.Width
  126. Minimap.top_y = Minimap.Bottom_y - Minimap.height
  127. Minimap.x = Minimap.Left_x
  128. Minimap.y = Minimap.top_y
  129. Minimap.xunit = xscale
  130. Minimap.yunit = yscale
  131. return Minimap
  132. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement