Guest User

Untitled

a guest
Sep 11th, 2019
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. @project: Avenis
  3. @author: Savsky
  4. @contact:
  5. discord project: https://discord.gg/3pxDCJm
  6. discord: Savsky#9441
  7. ]]
  8.  
  9. local sx,sy = guiGetScreenSize() -- pobieramy rozdzielczość gracza który widzi gui
  10. local px,py = (sx/1366),(sy/768) -- dzielimy rozdzielczość gracza który widzi gui przez rozdzielczość na której było robione
  11.  
  12.  
  13. -- settings
  14. local ui = {
  15. fonts = {
  16. normal = dxCreateFont(':av-hud/assets/fonts/normal.ttf', 11) or 'default-bold',
  17. bold = dxCreateFont(':av-hud/assets/fonts/bold.ttf', 14) or 'default-bold',
  18. },
  19. gui = {
  20. bar = dxCreateTexture("assets/gui/bar.png"),
  21. fbar = dxCreateTexture("assets/gui/fuelbar.png")
  22. },
  23. positions = {
  24. bar = {x = 16*px, y = 546*py, w = 314*px, h = 44*py},
  25. fuelbar = {x = 333*px, y = 546*py, w = 19*px, h = 199*py},
  26. speedo = {x = 24*px, y = 552*py, w = 159*px, h = 583*py},
  27. km = {x = 188*px, y = 552*py, w = 323*px, h = 583*py},
  28. fuel = {x = 335*px + 0.60*px, y = 566*py, w = 14*px, h = 177*py},
  29. }
  30. }
  31.  
  32.  
  33. addEventHandler("onClientRender", root, function()
  34. local vehicle = getPlayerOccupiedVehicle(localPlayer)
  35. if vehicle then
  36. local vx, vy, vz = getElementVelocity(vehicle)
  37. local predkosc = math.ceil((vx^2+vy^2+vz^2) ^ (0.5) * 161)
  38. local przebieg = 1000
  39. dxDrawImage(ui.positions.bar.x, ui.positions.bar.y, ui.positions.bar.w, ui.positions.bar.h, ui.gui.bar)
  40. dxDrawImage(ui.positions.fuelbar.x, ui.positions.fuelbar.y, ui.positions.fuelbar.w, ui.positions.fuelbar.h, ui.gui.fbar)
  41. dxDrawText(string.format('%03d', predkosc).. " km/h", ui.positions.speedo.x, ui.positions.speedo.y, ui.positions.speedo.w, ui.positions.speedo.h, tocolor(255, 255, 255, 255), 1.00, ui.fonts.bold, "left", "center", false, false, false, false, false)
  42. dxDrawText(string.format('%06d', przebieg).." km", ui.positions.km.x, ui.positions.km.y, ui.positions.km.w, ui.positions.km.h, tocolor(255, 255, 255, 255), 1.00, ui.fonts.bold, "right", "center", false, false, false, false, false)
  43. dxDrawRectangle(ui.positions.fuel.x, ui.positions.fuel.y, ui.positions.fuel.w, ui.positions.fuel.h, tocolor(48, 171, 189, 255))
  44. end
  45. end)
RAW Paste Data