LegacyFuel icon indicating copy to clipboard operation
LegacyFuel copied to clipboard

Export issue

Open kristianm1 opened this issue 4 years ago • 3 comments

Using esx_eden_garage, and with this code: function StoreVehicleInGarage(vehicle) local plate = GetVehicleNumberPlateText(vehicle) local fuelLevel = exports["LegacyFuel"]:GetFuel(vehicle)

TriggerServerEvent('vehiclesStored', plate, fuel)

end

I cant seem to save the fuel when putting in garage. Where is this code going to be added?

kristianm1 avatar Feb 28 '21 01:02 kristianm1

Any help?

kristianm1 avatar Mar 04 '21 21:03 kristianm1

Kinda late, but for anyone else having the same issue, here's the solution... Instead of using the export, use GetVehicleFuelLevel(vehicle) To set the fuel, use SetVehicleFuelLevel(vehicle, 100.0) Both are FiveM client natives.

nonstopjoker avatar Jun 23 '21 09:06 nonstopjoker

Instead of using the export, use GetVehicleFuelLevel(vehicle) To set the fuel, use SetVehicleFuelLevel(vehicle, 100.0) Both are FiveM client natives.

With the current version of this script (I will rewrite it soon), this is not how you should be doing it. Rather you should use the provided exports as that uses the decors which will (or should - it's poorly written so there are probably a lot of issues) always return the correct fuel level of the vehicle.

For the OP: what does the 'vehiclesStored' event do? You also put a parameter into the 'vehiclesStored' event called 'fuel' even though that is never defined in the code snippet you posted.

InZidiuZ avatar Jan 07 '22 21:01 InZidiuZ