Files

29 lines
887 B
Lua
Raw Permalink Normal View History

---@diagnostic disable: duplicate-set-field
2025-03-04 22:07:34 -05:00
Fuel = Fuel or {}
2025-04-08 19:10:02 -04:00
2025-04-19 14:36:10 -04:00
---@description Returns the name of the active fuel resource.
2025-04-19 14:36:10 -04:00
---@return string
2025-04-28 09:00:45 -04:00
Fuel.GetResourceName = function()
2025-04-19 14:36:10 -04:00
return 'default'
end
2025-09-10 12:27:12 -04:00
---@description Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
2025-03-04 22:07:34 -05:00
Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return GetVehicleFuelLevel(vehicle)
end
---@description Sets the fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@param fuel number The fuel level to assign.
---@param type? string The fuel type, used only in ti_fuel. (default: RON91)
2025-04-08 19:10:02 -04:00
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type)
2025-03-04 22:07:34 -05:00
if not DoesEntityExist(vehicle) then return end
SetVehicleFuelLevel(vehicle, fuel)
end
return Fuel