The fuel system for missions ensures that vehicles used during missions consume fuel faster. This encourages players to use specific transport vehicles, such as the flatbed, for towing or transporting. The configuration supports integration with popular fuel systems like qs-fuelstations or LegacyFuel, and includes fallback mechanisms for custom setups.
How to Use
To activate this feature, enable the fuel system in the configuration and set the time for the fuel to empty. The script will handle fuel levels using supported fuel systems or your custom fuel logic.
Config.MissionFuel =true-- Mission vehicles lose fuel quickly to enforce transport vehicle usageConfig.TimeToEmpty =.40-- Time (in minutes) to empty the fuel. 0.4 = 40 seconds, 1 = 1 minuteConfig.SetVehicleFuel=function(vehicle,fuelLevel)ifGetResourceState('qs-fuelstations') =='started' then exports['qs-fuelstations']:SetFuel(vehicle, fuelLevel)elseifGetResourceState('LegacyFuel') =='started' then exports["LegacyFuel"]:SetFuel(vehicle, fuelLevel)elseErrorPrint("Fuel System not found, please add qs-fuelstations or LegacyFuel to your resources or configure custom functions")SetVehicleFuelLevel(vehicle, fuelLevel)endendConfig.GetVehicleFuel=function(vehicle)local fuelLevel =100ifGetResourceState('qs-fuelstations') =='started' then fuelLevel = exports['qs-fuelstations']:GetFuel(vehicle)elseifGetResourceState('LegacyFuel') =='started' then fuelLevel = exports["LegacyFuel"]:GetFuel(vehicle)else fuelLevel =GetVehicleFuelLevel(vehicle)endreturn fuelLevelend