[Help] Fuel code

I seem to have a problem with getting the car to fill up after it’s been fixed, I am creating a repair garage what will also top the car up even if the car gets to 0 heal or 0 fuel so tow trucks can take a user to one of these grages and the user can pay for it’s fix

RegisterNetEvent('dufx_garages:fixCurrentVehicle')
AddEventHandler('dufx_garages:fixCurrentVehicle', function()
	vehid = GetVehiclePedIsIn(GetPlayerPed(-1), false);
    SetVehicleFixed(vehid);
	SetVehicleFuelLevel(vehid, math.floor(1));
	SetVehicleEngineOn(vehid, true, true, true);
end)

The cara is fixed but the fuel is not set and the engine don’t turn on

1 Like

Another note is it I have the fuel and engine options there the car spits sparks out of the back and the car moves little backwords like it does when the car is out of fuel in some fuel mods.

Fuel level should be 60.0 afaik. To fill it up completely, you’re setting it to 1 (which is pretty much completely empty). Though depending on whatever fuel script you use, this may need a different approach all together.

I was hoping to have it working without a 3ed part script needed so in other words working with all fuel scripts I will try the 60.0 thanks

1 Like
	RegisterNetEvent('dufx_garages:actionfix')
	AddEventHandler('dufx_garages:actionfix', function()
		vehid = GetVehiclePedIsIn(GetPlayerPed(-1), false);
		SetVehicleFixed(vehid);
		SetVehicleFuelLevel(vehid, 60);
		PriceSet = getPrice();
	end)

The car spaze out the fuel part still does not work I missing something for sure lol

Updated to this for now, so I can turn it on and off in a config

	RegisterNetEvent('dufx_garages:actionfix')
	AddEventHandler('dufx_garages:actionfix', function()
		vehid = GetVehiclePedIsIn(GetPlayerPed(-1), false);
		SetVehicleFixed(vehid);
		if FoxFix.Fuel then
			SetVehicleUndriveable(veh, true)
			SetVehicleEngineOn(veh, false, false, false)
			SetVehicleFuelLevel(vehid, 60);
			Wait(100);
			SetVehicleEngineOn(veh, true, false, false)
			SetVehicleUndriveable(veh, false)
		end
		PriceSet = getPrice();
	end)
1 Like

fuel should be 60.0, not 60.

I have this code now:

	RegisterNetEvent('dufx_garages:actionfix')
	AddEventHandler('dufx_garages:actionfix', function()
		vehid = GetVehiclePedIsIn(GetPlayerPed(-1), false);
		SetVehicleFixed(vehid);
		if FoxFix.Fuel then
			SetVehicleUndriveable(vehid, true)
			SetVehicleEngineOn(vehid, false, false, false)
			SetVehicleFuelLevel(vehid, 60.0);
			SetVehicleEngineOn(vehid, true, false, false)
			SetVehicleUndriveable(vehid, false)
		end
		PriceSet = getPrice();
	end)

Am I calling the vehicle wrong for the fuel command? It’s fixing the the car fine, it’s stopped the spitting now the car I was testing only had 29 fuel, I have looked at Adv fuel and they use the same command but I can’t seem to get it to trigger I have no idea what I getting wrong.

Maybe it’s my resource_manifest_version I am using the most up to date one I found
resource_manifest_version ‘44febabe-d386-4d18-afbe-5e627f4af937’

I changed it to the most up to date one and it’s not working, the car get’s fixed then the car turns off, waits as I added a small wait but does not refuel then it starts back up, I am missing something I am sure of it lol

do you have the code / fuel?