Advertisement
Guest User

client.lua

a guest
Sep 17th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. mojeW,mojeH = 1360, 768
  2. sW,sH = guiGetScreenSize()
  3. w, h = (sW/mojeW), (sH/mojeH)
  4.  
  5. bar = guiCreateProgressBar(370*w, 552.6*h, 600*w, 43*h, false)
  6. guiSetVisible(bar,false)
  7.  
  8. label = guiCreateLabel(50*w, 10*h, 460*w, 23*h, "Paliwo : 100 % | Spacja : Tankowanie", false, bar)
  9. guiLabelSetColor(label, 00, 90, 255)
  10. guiLabelSetHorizontalAlign(label, "center", false)
  11. guiLabelSetVerticalAlign(label, "center")
  12.  
  13. --x0,y0,z0 = getElementPosition(m100)
  14.  
  15. --[[addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()),
  16. function()
  17. exports.customblips:createCustomBlip( -2029.65,156.79,28.84, 56, "49.png" )
  18. exports.customblips:createCustomBlip( -2416.11,975.36,45.30, 56, "49.png" )
  19. exports.customblips:createCustomBlip( 2149.53,2748.28,10.50, 56, "49.png" )
  20. exports.customblips:createCustomBlip( 2202.44,2475.09,10.82, 56, "49.png" )
  21. exports.customblips:createCustomBlip( 2114.87,919.88,10.50, 56, "49.png" )
  22. exports.customblips:createCustomBlip( 2640.27,1106.91,10.51, 56, "49.png" )
  23. exports.customblips:createCustomBlip( 611.97,1694.90,6.99, 56, "49.png" )
  24. exports.customblips:createCustomBlip( -1328.90,2677.17,49.74, 56, "49.png" )
  25. exports.customblips:createCustomBlip( -1470.59,1863.39,32.31, 56, "49.png" )
  26. exports.customblips:createCustomBlip( 1381.37,458.11,19.65, 56, "49.png" )
  27. exports.customblips:createCustomBlip( 655.36, -565.28, 16.34, 56, "49.png" )
  28. exports.customblips:createCustomBlip( -1676.75,413.22,7.18, 56, "49.png" )
  29. end
  30. )--]]
  31.  
  32. local stacje={
  33. {-2029.65,156.79,28.84}, -- |-|
  34. {-2416.11,975.36,45.30}, -- |-|
  35. {2149.53,2748.28,10.50}, -- |-|
  36. --{2199.98,2474.98,10.50},
  37. {2202.44,2475.09,10.82}, -- |-|
  38. {2114.87,919.88,10.50}, -- |-|
  39. {2640.27,1106.91,10.51}, -- |-|
  40. {611.97,1694.90,6.99}, -- |-|
  41. {-1328.90,2677.17,49.74}, -- |-|
  42. {-1470.59,1863.39,32.31}, -- |-|
  43. {1381.37,458.11,19.65}, -- |-|
  44. {655.36, -565.28, 16.34}, -- |-|
  45. --{-177.61,1023.25,19.95},
  46. --{1110.43,1828.47,10.85},
  47. {-1676.75,413.22,7.18}, -- |-|
  48. }
  49.  
  50.  
  51. for _,v in ipairs(stacje)do
  52. local marker=createMarker(v[1],v[2],v[3]-3.5,"cylinder",4,0,150,200,165)
  53. local x,y,z = getElementPosition(marker)
  54. setElementData(marker,"stacja",true)
  55. createBlipAttachedTo(marker, 38,2,255,0,0,255,1,500)
  56. --exports.customblips:createCustomBlip( x, y, 20, 20, "49.png" )
  57. end
  58.  
  59.  
  60.  
  61. addEventHandler("onClientMarkerHit",resourceRoot,function(e)
  62. if e==localPlayer then
  63. if getElementData(source,"stacja") then
  64. if getElementType(e)=="player" then
  65. if getPedOccupiedVehicle(e) then
  66. if getElementData(getPedOccupiedVehicle(e),"vehicle:fuel") then
  67. guiSetVisible(bar,true)
  68. guiSetVisible(barr,true)
  69. guiSetText(label,"Paliwo : "..getElementData(getPedOccupiedVehicle(e),"vehicle:fuel").." L | Spacja : Tankowanie")
  70. guiProgressBarSetProgress(bar,getElementData(getPedOccupiedVehicle(e),"vehicle:fuel"))
  71. bindKey("space","down",tankuj)
  72. end
  73. end
  74. end
  75. end
  76. end
  77. end)
  78.  
  79. addEventHandler("onClientMarkerLeave",resourceRoot,function(e)
  80. if e==localPlayer then
  81. if getElementData(source,"stacja") then
  82. unbindKey("space","down",tankuj)
  83. guiSetVisible(bar,false)
  84. guiSetVisible(barr,false)
  85. end
  86. end
  87. end)
  88.  
  89. function tankuj()
  90. if getPedOccupiedVehicle(localPlayer) then
  91. if getElementData(getPedOccupiedVehicle(localPlayer),"vehicle:fuel")>= 100 then return end
  92. triggerServerEvent("TANKUJ",localPlayer)
  93. end
  94. end
  95.  
  96.  
  97. addEvent("TANKUJ",true)
  98. addEventHandler("TANKUJ",root,function()
  99. if source==localPlayer then
  100. local fuel=getElementData(getPedOccupiedVehicle(source),"vehicle:fuel")
  101. setElementData(getPedOccupiedVehicle(source),"vehicle:fuel",fuel+1)
  102. guiSetText(label,"Paliwo : "..getElementData(getPedOccupiedVehicle(source),"vehicle:fuel").." L | Spacja : Tankowanie")
  103. guiProgressBarSetProgress(bar,getElementData(getPedOccupiedVehicle(source),"vehicle:fuel"))
  104. end
  105. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement