Advertisement
Djangoantonio3

Untitled

Oct 4th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.72 KB | None | 0 0
  1. local screenW, screenH = guiGetScreenSize()
  2. local x, y = (screenW/1366), (screenH/768)
  3. local components = { "area_name", "radio", "vehicle_name" }
  4.  
  5. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  6. function ()
  7. for _, component in ipairs( components ) do
  8. setPlayerHudComponentVisible( component, false )
  9. end
  10. end)
  11.  
  12. local dxfont1_font = dxCreateFont("files/font/font.ttf", 18)
  13.  
  14. alpha = 0
  15.  
  16. function dxHud1()
  17. local vida1 = math.floor(getElementHealth(getLocalPlayer()))
  18. local oxigenio = math.floor(getPedOxygenLevel ( getLocalPlayer()) )
  19. local vida2 = getPedMaxHealth(getLocalPlayer())
  20. local colete = math.floor(getPedArmor(getLocalPlayer()))
  21. local dinheiro1 = ("%09d"):format(getPlayerMoney(getLocalPlayer()))
  22. local dinheiro2 = tostring(getPlayerMoney(getLocalPlayer())):gsub("-", "#ADFF2F")
  23. local procurado = getPlayerWantedLevel(getLocalPlayer())
  24. local weaponClip = getPedAmmoInClip(getLocalPlayer(), getPedWeaponSlot(getLocalPlayer()))
  25. local weaponAmmo = getPedTotalAmmo(getLocalPlayer()) - getPedAmmoInClip(getLocalPlayer())
  26. local armaId = getPedWeapon(getLocalPlayer())
  27. local arma = getPedWeapon(getLocalPlayer())
  28. local noreloadweapons = {}
  29. noreloadweapons[16] = true
  30. noreloadweapons[17] = true
  31. noreloadweapons[18] = true
  32. noreloadweapons[19] = true
  33. noreloadweapons[25] = true
  34. noreloadweapons[33] = true
  35. noreloadweapons[34] = true
  36. noreloadweapons[35] = true
  37. noreloadweapons[36] = true
  38. noreloadweapons[37] = true
  39. noreloadweapons[38] = true
  40. noreloadweapons[39] = true
  41. noreloadweapons[41] = true
  42. noreloadweapons[42] = true
  43. noreloadweapons[43] = true
  44. local meleespecialweapons = {}
  45. meleespecialweapons[0] = true
  46. meleespecialweapons[1] = true
  47. meleespecialweapons[2] = true
  48. meleespecialweapons[3] = true
  49. meleespecialweapons[4] = true
  50. meleespecialweapons[5] = true
  51. meleespecialweapons[6] = true
  52. meleespecialweapons[7] = true
  53. meleespecialweapons[8] = true
  54. meleespecialweapons[9] = true
  55. meleespecialweapons[10] = true
  56. meleespecialweapons[11] = true
  57. meleespecialweapons[12] = true
  58. meleespecialweapons[13] = true
  59. meleespecialweapons[14] = true
  60. meleespecialweapons[15] = true
  61. meleespecialweapons[40] = true
  62. meleespecialweapons[44] = true
  63. meleespecialweapons[45] = true
  64. meleespecialweapons[46] = true
  65. -- //#Fundo
  66. if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then
  67. dxDrawRectangle(x*1145, y*103, x*150/1000*oxigenio, y*11, tocolor(172, 203, 241, 255), false)
  68. contornoRetangulo(x*1145, y*103, x*150, y*11, tocolor(0, 0, 0, 255), 1)
  69. dxDrawRectangle(x*1145, y*103, x*150, y*11, tocolor(255, 255, 255, 125), false)
  70. end
  71. dxDrawImage(x*1190, y*115, x*60, y*60, "files/img/"..tostring(arma)..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  72. dxDrawRectangle(x*1145, y*68, x*150, y*11, tocolor(255, 255, 255, 125), false)
  73. dxDrawRectangle(x*1145, y*85, x*150, y*11, tocolor(255, 255, 255, 125), false)
  74. dxDrawImage(x*1130, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  75. dxDrawImage(x*1160, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  76. dxDrawImage(x*1190, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  77. dxDrawImage(x*1220, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  78. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  79. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(0, 0, 0, 100), false)
  80.  
  81. -- //#Status Jogador
  82. dxDrawRectangle(x*1145, y*68, x*150/vida2*vida1, y*11, tocolor(173, 255, 47), false)
  83. dxDrawRectangle(x*1145, y*85, x*150/100*colete, y*11, tocolor(255, 255, 255, 255), false)
  84.  
  85. -- //#Nivel Procurado
  86. if procurado == 1 then
  87. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  88. end
  89. if procurado == 2 then
  90. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  91. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  92. end
  93. if procurado == 3 then
  94. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  95. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  96. dxDrawImage(x*1220, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  97. end
  98. if procurado == 4 then
  99. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  100. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  101. dxDrawImage(x*1220, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  102. dxDrawImage(x*1190, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  103. end
  104. if procurado == 5 then
  105. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  106. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  107. dxDrawImage(x*1220, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  108. dxDrawImage(x*1190, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  109. dxDrawImage(x*1160, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  110. end
  111. if procurado == 6 then
  112. dxDrawImage(x*1280, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  113. dxDrawImage(x*1250, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  114. dxDrawImage(x*1220, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  115. dxDrawImage(x*1190, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  116. dxDrawImage(x*1160, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  117. dxDrawImage(x*1130, y*10, x*25, y*25, "files/img/star.png", 0, 0, 0, tocolor(255, 255, 255, alpha), false)
  118. end
  119.  
  120. -- //#Armas
  121. dxDrawText("#ADFF2F"..weaponClip.." #FFFFFF/ #ADFF2F"..weaponAmmo, x*1245, y*311, x*1195, y*50, tocolor(255, 255, 255, 255), x*1.10, "default-bold", "center", "center", false, false, false, true, false)
  122.  
  123. -- //#Dinheiro
  124. if tonumber(dinheiro1) > -1 then
  125. dxDrawText("$ "..dinheiro1, x*1045, y*05, x*1280, y*100, tocolor(255, 255, 255, 255), x*1.00, dxfont1_font, "right", "center", false, false, true, true, false)
  126. dxDrawText(dinheiro2, x*1045, y*05, x*1280, y*100, tocolor(173, 255, 47), x*1.00, dxfont1_font, "right", "center", false, false, true, true, false)
  127. else
  128. dxDrawText("$ "..dinheiro1, x*1045, y*05, x*1280, y*100, tocolor(255, 255, 255, 255), x*1.00, dxfont1_font, "right", "center", false, false, true, true, false)
  129. dxDrawText(dinheiro2, x*1045, y*05, x*1280, y*100, tocolor(173, 255, 47), x*1.00, dxfont1_font, "right", "center", false, false, true, true, false)
  130. end
  131.  
  132. -- //#Contorno Retangulo
  133. contornoRetangulo(x*1145, y*68, x*150, y*11, tocolor(0, 0, 0, 255), 1)
  134. contornoRetangulo(x*1145, y*85, x*150, y*11, tocolor(0, 0, 0, 255), 1)
  135.  
  136. end
  137.  
  138. function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI )
  139. dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  140. dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  141. dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  142. dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  143. dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  144. dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  145. dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  146. dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 155 ), scale, font, alignX, alignY, clip, wordBreak, false )
  147. dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI )
  148. end
  149.  
  150. function renderDxHud()
  151. addEventHandler("onClientRender", getRootElement(), dxHud1)
  152. setPlayerHudComponentVisible("armour", false)
  153. setPlayerHudComponentVisible("wanted", false)
  154. setPlayerHudComponentVisible("weapon", false)
  155. setPlayerHudComponentVisible("money", false)
  156. setPlayerHudComponentVisible("health", false)
  157. setPlayerHudComponentVisible("clock", false)
  158. setPlayerHudComponentVisible("breath", false)
  159. setPlayerHudComponentVisible("ammo", false)
  160. end
  161. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), renderDxHud)
  162.  
  163. function onStop()
  164. setPlayerHudComponentVisible("armour", true)
  165. setPlayerHudComponentVisible("wanted", true)
  166. setPlayerHudComponentVisible("weapon", true)
  167. setPlayerHudComponentVisible("money", true)
  168. setPlayerHudComponentVisible("health", true)
  169. setPlayerHudComponentVisible("clock", true)
  170. setPlayerHudComponentVisible("breath", true)
  171. setPlayerHudComponentVisible("ammo", true)
  172. end
  173. addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), onStop)
  174.  
  175. function toggleRadar()
  176. if isVisible then
  177. addEventHandler("onClientRender", root, dxHud1)
  178. else
  179. removeEventHandler("onClientRender", root, dxHud1)
  180. end
  181. isVisible = not isVisible
  182. end
  183. addCommandHandler ( "hud", toggleRadar )
  184.  
  185. function contornoRetangulo(absX, absY, sizeX, sizeY, color, ancho)
  186. dxDrawRectangle(absX, absY, sizeX, ancho, color)
  187. dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color)
  188. dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color)
  189. dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho*2, color)
  190. end
  191.  
  192. local alphaState = true
  193.  
  194. function alphaFunction()
  195. if alphaState == true then
  196. alpha = alpha + 30
  197. if alpha >= 255 then
  198. alphaState = false
  199. end
  200. end
  201. if alphaState == false then
  202. alpha = alpha - 30
  203. if alpha <= 0 then
  204. alphaState = true
  205. end
  206. end
  207. end
  208. addEventHandler("onClientRender", getRootElement(), alphaFunction)
  209.  
  210. function getPedMaxHealth(ped)
  211. assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]")
  212. local stat = getPedStat(ped, 24)
  213. local maxhealth = 100 + (stat - 569) / 4.31
  214. return math.max(1, maxhealth)
  215. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement