Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. Citizen.CreateThread(function()
  2. while true do
  3. Citizen.Wait(1)
  4.  
  5. local ped = PlayerPedId()
  6.  
  7. if not isFueling and ((isNearPump and GetEntityHealth(isNearPump) > 0) or (GetSelectedPedWeapon(ped) == 883325847 and not isNearPump)) then
  8. if IsPedInAnyVehicle(ped) and GetPedInVehicleSeat(GetVehiclePedIsIn(ped), -1) == ped then
  9. local pumpCoords = GetEntityCoords(isNearPump)
  10.  
  11. DrawText3Ds(pumpCoords.x, pumpCoords.y, pumpCoords.z + 1.2, Config.Strings.ExitVehicle)
  12. else
  13. local vehicle = GetPlayersLastVehicle()
  14. local vehicleCoords = GetEntityCoords(vehicle)
  15.  
  16. if DoesEntityExist(vehicle) and GetDistanceBetweenCoords(GetEntityCoords(ped), vehicleCoords) < 2.5 then
  17. if not DoesEntityExist(GetPedInVehicleSeat(vehicle, -1)) then
  18. local stringCoords = GetEntityCoords(isNearPump)
  19. local canFuel = true
  20.  
  21. if GetSelectedPedWeapon(ped) == 883325847 then
  22. stringCoords = vehicleCoords
  23.  
  24. if GetAmmoInPedWeapon(ped, 883325847) < 100 then
  25. canFuel = false
  26. end
  27. end
  28.  
  29. if GetVehicleFuelLevel(vehicle) < 95 and canFuel then
  30. if currentCash > 0 then
  31. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.EToRefuel)
  32.  
  33. if IsControlJustReleased(0, 38) then
  34. isFueling = true
  35.  
  36. TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
  37. LoadAnimDict("timetable@gardener@filling_can")
  38. end
  39. else
  40. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCash)
  41. end
  42. elseif not canFuel then
  43. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.JerryCanEmpty)
  44. else
  45. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.FullTank)
  46. end
  47. end
  48. elseif isNearPump then
  49. local stringCoords = GetEntityCoords(isNearPump)
  50.  
  51. if currentCash >= Config.JerryCanCost then
  52. if not HasPedGotWeapon(ped, 883325847) then
  53. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.PurchaseJerryCan)
  54.  
  55. if IsControlJustReleased(0, 38) then
  56. GiveWeaponToPed(ped, 883325847, 4500, false, true)
  57.  
  58. TriggerServerEvent('fuel:pay', Config.JerryCanCost)
  59.  
  60. currentCash = ESX.GetPlayerData().money
  61. end
  62. else
  63. if Config.UseESX then
  64. local refillCost = Round(Config.RefillCost * (1 - GetAmmoInPedWeapon(ped, 883325847) / 4500))
  65.  
  66. if refillCost > 0 then
  67. if currentCash >= refillCost then
  68. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.RefillJerryCan .. refillCost)
  69.  
  70. if IsControlJustReleased(0, 38) then
  71. TriggerServerEvent('fuel:pay', refillCost)
  72.  
  73. SetPedAmmo(ped, 883325847, 4500)
  74. end
  75. else
  76. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCashJerryCan)
  77. end
  78. else
  79. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.JerryCanFull)
  80. end
  81. else
  82. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.RefillJerryCan)
  83.  
  84. if IsControlJustReleased(0, 38) then
  85. SetPedAmmo(ped, 883325847, 4500)
  86. end
  87. end
  88. end
  89. else
  90. DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCash)
  91. end
  92. else
  93. Citizen.Wait(250)
  94. end
  95. end
  96. else
  97. Citizen.Wait(250)
  98. end
  99. end
  100. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement