Merge pull request #141 from XenoS-ITA/refactor-fuel-and-vehiclekey
Refactor fuel and vehiclekey
This commit is contained in:
30 files changed
+442
-199
No files matched your search
@@ -27,27 +27,6 @@
|
||||
|
||||
---
|
||||
|
||||
### dirk\_lib
|
||||
|
||||
**Purpose:** Vehicle fuel and vehicle key bridging systems
|
||||
**Repository:** [dirk\_lib](https://github.com/DirkDigglerz/dirk_lib)
|
||||
|
||||
<details>
|
||||
<summary>Implementation Details</summary>
|
||||
|
||||
**Code we use:**
|
||||
|
||||
* Client-side vehicle fuel management
|
||||
* Vehicle key bridging functionality
|
||||
|
||||
**Modifications made:**
|
||||
|
||||
* None - code used as-is with full credit to original author
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
### ox\_lib
|
||||
|
||||
**Purpose:** External compatibility and architectural inspiration
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,15 +1,39 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "F_RealCarKeysSystem"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent('F_RealCarKeysSystem:generateVehicleKeys', plate)
|
||||
end
|
||||
|
||||
-- TODO: Test, documentation of the script is missing
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
return true
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent('F_RealCarKeysSystem:removeVehicleKeysByPlate', plate)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,13 +4,33 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
return exports.MrNewbVehicleKeys:GiveKeysByPlate(plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate)
|
||||
end
|
||||
|
||||
|
||||
@@ -4,13 +4,33 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
return exports['Renewed-Vehiclekeys']:addKey(plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
return exports['Renewed-Vehiclekeys']:removeKey(plate)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---This will give keys to the specifed vehicle/plate.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param plate string The plate of the vehicle.
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
return true, Prints.Error("There Is No Vehicle Key System Installed")
|
||||
Prints.Info("There is no compatible vehicle key resource.")
|
||||
end
|
||||
|
||||
---This will remove keys from the specifed vehicle/plate.
|
||||
---@param vehicle number The vehicle entity ID.
|
||||
---@param plate string The plate of the vehicle.
|
||||
---@return boolean | nil
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
return true, Prints.Error("There Is No Vehicle Key System Installed")
|
||||
Prints.Info("There is no compatible vehicle key resource.")
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,13 +4,27 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerEvent('cd_garage:AddKeys', plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
return true
|
||||
Prints.Info("cd_garage doesnt support removing keys.")
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,14 +4,34 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
return TriggerServerEvent("vehicles_keys:selfGiveVehicleKeys", plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent("vehicles_keys:selfGiveVehicleKeys", plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
return TriggerServerEvent("vehicles_keys:selfRemoveKeys", plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent("vehicles_keys:selfRemoveKeys", plate)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -0,0 +1,26 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "mVehicle"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
exports.mVehicle:AddTemporalVehicleClient(vehicle)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
Prints.Info("mVehicle doesnt support removing keys.")
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -1,16 +1,29 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "mk_vehiclekeys"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not vehicle and not DoesEntityExist(vehicle) then return false end
|
||||
return exports["mk_vehiclekeys"]:AddKey(vehicle)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
exports["mk_vehiclekeys"]:AddKey(vehicle)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not vehicle and not DoesEntityExist(vehicle) then return false end
|
||||
return exports["mk_vehiclekeys"]:RemoveKey(vehicle)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
exports["mk_vehiclekeys"]:RemoveKey(vehicle)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -1,16 +0,0 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
local resourceName = "mono_carkeys"
|
||||
if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
TriggerServerEvent('mono_carkeys:CreateKey', plate)
|
||||
end
|
||||
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
TriggerServerEvent('mono_carkeys:DeleteKey', 1, plate)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,13 +4,35 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent('okokGarage:GiveKeys', plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
return true
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
local source = GetPlayerServerId(PlayerId())
|
||||
TriggerServerEvent("okokGarage:RemoveKeys", plate, source)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,13 +4,33 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent("qb-vehiclekeys:server:AcquireVehicleKeys", plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerEvent("qb-vehiclekeys:client:RemoveKeys", plate)
|
||||
end
|
||||
|
||||
|
||||
@@ -4,13 +4,34 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate then return false end
|
||||
TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerServerEvent("qb-vehiclekeys:server:AcquireVehicleKeys", plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
return true
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
TriggerEvent("qb-vehiclekeys:client:RemoveKeys", plate)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,18 +4,36 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not vehicle then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
|
||||
local verifiedPlate = GetVehicleNumberPlateText(vehicle)
|
||||
return exports['qs-vehiclekeys']:GiveKeys(verifiedPlate, model, true)
|
||||
return exports['qs-vehiclekeys']:GiveKeys(plate, model, true)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not vehicle then return false end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
|
||||
local verifiedPlate = GetVehicleNumberPlateText(vehicle)
|
||||
return exports['qs-vehiclekeys']:RemoveKeys(verifiedPlate, model)
|
||||
return exports['qs-vehiclekeys']:RemoveKeys(plate, model)
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,14 +4,28 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not DoesEntityExist(vehicle) then return false end
|
||||
local vehicle_display_name = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
|
||||
return exports['t1ger_keys']:GiveTemporaryKeys(plate, vehicle_display_name, 'some_keys')
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
|
||||
return exports['t1ger_keys']:GiveTemporaryKeys(plate, model, '')
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
|
||||
Prints.Info("t1ger_keys doesnt support removing keys.")
|
||||
end
|
||||
|
||||
return VehicleKey
|
||||
@@ -4,13 +4,33 @@ if GetResourceState(resourceName) == 'missing' then return end
|
||||
|
||||
VehicleKey = VehicleKey or {}
|
||||
|
||||
---Gives the player (self) the keys of the specified vehicle.
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.GiveKeys = function(vehicle, plate)
|
||||
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
exports.wasabi_carlock:GiveKey(plate)
|
||||
end
|
||||
|
||||
---Removes the keys of the specified vehicle from the player (self).
|
||||
---@param vehicle number The vehicle entity handle.
|
||||
---@param plate? string The plate of the vehicle.
|
||||
---@return nil
|
||||
VehicleKey.RemoveKeys = function(vehicle, plate)
|
||||
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end
|
||||
assert(vehicle, "vehicle is nil")
|
||||
assert(DoesEntityExist(vehicle), "vehicle does not exist")
|
||||
|
||||
if not plate then
|
||||
plate = GetVehicleNumberPlateText(vehicle)
|
||||
end
|
||||
|
||||
exports.wasabi_carlock:RemoveKey(plate)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user