Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. function drawGUI()
  2. local vehicle = getPedOccupiedVehicle(localPlayer);
  3. if vehicle then
  4. local x,y = guiGetScreenSize();
  5. if getVehicleType(vehicle) ~= 'Automobile' and getVehicleType(vehicle) ~= 'Bike' and getVehicleType(vehicle) ~= 'Monster Truck' and getVehicleType(vehicle) ~= 'Quad' then return end
  6. local driver = getVehicleController(vehicle);
  7. if driver ~= localPlayer then return end --###
  8. if getVehicleEngineState(vehicle) == false then return end --###
  9. dxDrawRectangle(x-53,(y/2)-75,40,142,0x66224466);
  10. local maxFuel = carFuel[0];
  11. local curFuel = getElementData(vehicle,'fuel');
  12. local carHealth = getElementHealth(vehicle)/10
  13. if curFuel == false then return end
  14. if carFuel[getElementModel(vehicle)] then maxFuel = carFuel[getElementModel(vehicle)]; end
  15. local fuel = (curFuel/maxFuel)*100;
  16. local colour = nil;
  17. if fuel > 90 then
  18. colour = 0x9922CC33;
  19. dxDrawRectangle(x-30,(y/2)-71,16,21,colour);
  20. end
  21. if fuel > 75 then
  22. if colour == nil then
  23. colour = 0x99009900;
  24. end
  25. dxDrawRectangle(x-30,(y/2)-48,16,21,colour);
  26. end
  27. if fuel > 60 then
  28. if colour == nil then
  29. colour = 0x99339900;
  30. end
  31. dxDrawRectangle(x-30,(y/2)-25,16,21,colour);
  32. end
  33. if fuel > 45 then
  34. if colour == nil then
  35. colour = 0x99999900;
  36. end
  37. dxDrawRectangle(x-30,(y/2)-2,16,21,colour);
  38. end
  39. if fuel > 30 then
  40. if colour == nil then
  41. colour = 0x99996600;
  42. end
  43. dxDrawRectangle(x-30,(y/2)+21,16,21,colour);
  44. end
  45. if colour == nil then
  46. if fuel > 15 then
  47. colour = 0x99993300;
  48. else
  49. colour = 0x99990000;
  50. end
  51. end
  52. dxDrawRectangle(x-30,(y/2)+44,16,21,colour);
  53. local HealthHeight = ((136/100)*carHealth);
  54. local yOffset = HealthHeight-136
  55. dxDrawRectangle(x-50,(y/2)-71-yOffset,16,stan,0x99990000);
  56.  
  57. dxDrawText(tostring(HealthHeight-36)..'%',x-105,y-65);
  58. dxDrawText(tostring(fuel)..'%',x-105,y-50);
  59. end
  60. end
  61. addEventHandler("onClientRender",getRootElement(),drawGUI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement