InZidiuZ / LegacyFuel

A simple, lightweight fuel script for FiveM
GNU General Public License v3.0
78 stars 217 forks source link

Export issue #70

Open kristianm1 opened 3 years ago

kristianm1 commented 3 years ago

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 commented 3 years ago

Any help?

nonstopjoker commented 3 years ago

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.

InZidiuZ commented 2 years ago

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.