Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(1)
- local ped = PlayerPedId()
- if not isFueling and ((isNearPump and GetEntityHealth(isNearPump) > 0) or (GetSelectedPedWeapon(ped) == 883325847 and not isNearPump)) then
- if IsPedInAnyVehicle(ped) and GetPedInVehicleSeat(GetVehiclePedIsIn(ped), -1) == ped then
- local pumpCoords = GetEntityCoords(isNearPump)
- DrawText3Ds(pumpCoords.x, pumpCoords.y, pumpCoords.z + 1.2, Config.Strings.ExitVehicle)
- else
- local vehicle = GetPlayersLastVehicle()
- local vehicleCoords = GetEntityCoords(vehicle)
- if DoesEntityExist(vehicle) and GetDistanceBetweenCoords(GetEntityCoords(ped), vehicleCoords) < 2.5 then
- if not DoesEntityExist(GetPedInVehicleSeat(vehicle, -1)) then
- local stringCoords = GetEntityCoords(isNearPump)
- local canFuel = true
- if GetSelectedPedWeapon(ped) == 883325847 then
- stringCoords = vehicleCoords
- if GetAmmoInPedWeapon(ped, 883325847) < 100 then
- canFuel = false
- end
- end
- if GetVehicleFuelLevel(vehicle) < 95 and canFuel then
- if currentCash > 0 then
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.EToRefuel)
- if IsControlJustReleased(0, 38) then
- isFueling = true
- TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
- LoadAnimDict("timetable@gardener@filling_can")
- end
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCash)
- end
- elseif not canFuel then
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.JerryCanEmpty)
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.FullTank)
- end
- end
- elseif isNearPump then
- local stringCoords = GetEntityCoords(isNearPump)
- if currentCash >= Config.JerryCanCost then
- if not HasPedGotWeapon(ped, 883325847) then
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.PurchaseJerryCan)
- if IsControlJustReleased(0, 38) then
- GiveWeaponToPed(ped, 883325847, 4500, false, true)
- TriggerServerEvent('fuel:pay', Config.JerryCanCost)
- currentCash = ESX.GetPlayerData().money
- end
- else
- if Config.UseESX then
- local refillCost = Round(Config.RefillCost * (1 - GetAmmoInPedWeapon(ped, 883325847) / 4500))
- if refillCost > 0 then
- if currentCash >= refillCost then
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.RefillJerryCan .. refillCost)
- if IsControlJustReleased(0, 38) then
- TriggerServerEvent('fuel:pay', refillCost)
- SetPedAmmo(ped, 883325847, 4500)
- end
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCashJerryCan)
- end
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.JerryCanFull)
- end
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.RefillJerryCan)
- if IsControlJustReleased(0, 38) then
- SetPedAmmo(ped, 883325847, 4500)
- end
- end
- end
- else
- DrawText3Ds(stringCoords.x, stringCoords.y, stringCoords.z + 1.2, Config.Strings.NotEnoughCash)
- end
- else
- Citizen.Wait(250)
- end
- end
- else
- Citizen.Wait(250)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement