Getting exactly the same error, hope we can have a feedback on this one.
Error running system event handling function for resource LegacyFuel: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: @LegacyFuel/source/fuel_server.lua:8: attempt to index a nil value (upvalue ‘ESX’)
d to execute thread: @esx_legacyfuel/source/fuel_server.lua:9: attempt to index a nil value (field 'Math')
who can help us out
if Config.UseESX then
local ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('fuel:pay')
AddEventHandler('fuel:pay', function(price)
local xPlayer = ESX.GetPlayerFromId(source)
local amount = ESX.Math.Round(price)
if price > 0 then
xPlayer.removeMoney(amount)
end
end)
end
Does anyone know a fix for the script … i can fuel up my car but it does not remove any money from me even tho it said i owe $40 … nothing was taken out
the server i own atm is having a weird bug, some people can refuel but other cant. i was on 30% fuel in my car so i went to refuel but it said i didnt have enough money yet i had 5k. any idea how i could fix this
How i can change the random fuel ? please i want to put 50% fuel minimum in all car, because right now i pick the car and i often have 31% fuel i want to put 50% minimum…
please thanks you !
function ManageFuelUsage(vehicle)
if not DecorExistOn(vehicle, Config.FuelDecor) then
SetFuel(vehicle, math.random(200, 800) / 10)
elseif not fuelSynced then
SetFuel(vehicle, GetFuel(vehicle))
fuelSynced = true
end
if IsVehicleEngineOn(vehicle) then
SetFuel(vehicle, GetVehicleFuelLevel(vehicle) - Config.FuelUsage[Round(GetVehicleCurrentRpm(vehicle), 1)] * (Config.Classes[GetVehicleClass(vehicle)] or 1.0) / 10)
end
end
Is that i need to change? SetFuel(vehicle, math.random(200, 800) / 10) ???
better late than never. but here.
ESX.Math.Round(price) ESX.Math as far as i can tell does not exist, we dont use it on our server, instead we do math.ceil(price)
find chargeToAdd in the client file, and change to what you need, can be a specific amount or what is done here, a random value between 10 and 20, and divided by 10(so 1.0-2.0 pr percent fuel)
locate fuelToAdd in the client file and change it to what you need, cna be a spcific amount or what is done here, a random value between 10 and 20, and divided by 10(so 1.0-2.0 percent fuel pr tick)
maybe you are using an older version of it… the latest version has it. the other version i have(which we switched from to have the jerrycan working) has a local price = 10 to set. still in the client file… . increase or decrease to preference.