Files
community_bridge/modules/fuel/_default/client.lua
T
MrNewb 90c65dc55e Add GetResourceName function to all modules
Introduces a standardized GetResourceName function to banking, clothing, dispatch, doorlock, framework, fuel, helptext, housing, and other modules. This function returns the name of the in-use resource, improving resource identification and interoperability across the codebase.
2025-09-10 12:27:12 -04:00

30 lines
914 B
Lua

---@diagnostic disable: duplicate-set-field
Fuel = Fuel or {}
---Returns the name of the active fuel resource.
---If no supported resource is found, "default" will be returned.
---@return string
Fuel.GetResourceName = function()
return 'default'
end
---Returns the current fuel level of a vehicle.
---@param vehicle number The vehicle entity handle.
---@return number The vehicle fuel level.
Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return GetVehicleFuelLevel(vehicle)
end
---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)
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end
SetVehicleFuelLevel(vehicle, fuel)
end
return Fuel