refactor(fuel): more consistency, now SetFuel doesnt return and every SetFuel as type, that will be used only by ti_fuel
This commit is contained in:
1 parent
718214d135
commit
3289711297
14 files changed
+145
-118
No files matched your search
@@ -2,26 +2,28 @@
|
||||
Fuel = Fuel or {}
|
||||
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---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
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
return SetVehicleFuelLevel(vehicle, fuel)
|
||||
SetVehicleFuelLevel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,25 +3,27 @@ local resourceName = "BigDaddy-Fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['BigDaddy-Fuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
exports['BigDaddy-Fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
@@ -3,27 +3,29 @@ local resourceName = "cdn-fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['cdn-fuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
return exports['cdn-fuel']:SetFuel(vehicle, fuel)
|
||||
exports['cdn-fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,25 +3,27 @@ local resourceName = "esx-sna-fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['esx-sna-fuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
exports['esx-sna-fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
@@ -3,27 +3,29 @@ local resourceName = "lc_fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports["lc_fuel"]:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports["lc_fuel"]:SetFuel(vehicle, fuel)
|
||||
exports["lc_fuel"]:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -4,27 +4,29 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
if GetResourceState("qb-fuel") == 'started' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['LegacyFuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports['LegacyFuel']:SetFuel(vehicle, fuel)
|
||||
exports['LegacyFuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,27 +3,29 @@ local resourceName = "okokGasStation"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['okokGasStation']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports['okokGasStation']:SetFuel(vehicle, fuel)
|
||||
exports['okokGasStation']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,29 +3,30 @@ local resourceName = "ox_fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 Entity(vehicle).state.fuel
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
local currentFuel = Entity(vehicle).state.fuel
|
||||
Entity(vehicle).state.fuel = currentFuel and currentFuel + fuel or fuel
|
||||
return Entity(vehicle).state.fuel
|
||||
local state = Entity(vehicle).state
|
||||
state.fuel = (state.fuel or 0) + fuel
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,27 +3,29 @@ local resourceName = "ps-fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports["ps-fuel"]:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports["ps-fuel"]:SetFuel(vehicle, fuel)
|
||||
exports["ps-fuel"]:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,27 +3,29 @@ local resourceName = "qb-fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['qb-fuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports['qb-fuel']:SetFuel(vehicle, fuel)
|
||||
exports['qb-fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,27 +3,29 @@ local resourceName = "qs-fuelstations"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['qs-fuelstations']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
return exports['qs-fuelstations']:SetFuel(vehicle, fuel)
|
||||
exports['qs-fuelstations']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,27 +3,29 @@ local resourceName = "Renewed-Fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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 exports['Renewed-Fuel']:GetFuel(vehicle)
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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
|
||||
return exports['Renewed-Fuel']:SetFuel(vehicle, fuel)
|
||||
exports['Renewed-Fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,28 +3,30 @@ local resourceName = "ti_fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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
|
||||
local level, _ = exports["ti_fuel"]:getFuel(vehicle)
|
||||
return level
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
return exports['ti_fuel']:setFuel(vehicle, fuel, "RON91")
|
||||
exports['ti_fuel']:setFuel(vehicle, fuel, type or "RON91")
|
||||
end
|
||||
|
||||
return Fuel
|
||||
@@ -3,26 +3,28 @@ local resourceName = "x-fuel"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
Fuel = Fuel or {}
|
||||
|
||||
---This will get the name of the Fuel being used (if a supported Fuel).
|
||||
---Returns the name of the active fuel resource.
|
||||
---If no supported resource is found, "default" will be returned.
|
||||
---@return string
|
||||
Fuel.GetResourceName = function()
|
||||
return resourceName
|
||||
end
|
||||
|
||||
---This will get the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@return number fuel The fuel level of the vehicle.
|
||||
---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
|
||||
local level, _ = exports["x-fuel"]:getFuel(vehicle)
|
||||
return level
|
||||
end
|
||||
|
||||
---This will set the fuel level of the vehicle.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param fuel number The fuel level to set.
|
||||
---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)
|
||||
Fuel.SetFuel = function(vehicle, fuel, type)
|
||||
if not DoesEntityExist(vehicle) then return end
|
||||
return exports['x-fuel']:SetFuel(vehicle, fuel)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user