mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 05:01:35 +00:00
Implemented vehicle extras property support, closes #186
This commit is contained in:
+20
-4
@@ -649,8 +649,16 @@ ESX.Game.GetClosestPed = function(coords, ignoreList)
|
||||
end
|
||||
|
||||
ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
local color1, color2 = GetVehicleColours(vehicle)
|
||||
local color1, color2 = GetVehicleColours(vehicle)
|
||||
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||
local extras = {}
|
||||
|
||||
for id=0, 12 do
|
||||
if DoesExtraExist(vehicle, id) then
|
||||
local state = IsVehicleExtraTurnedOn(vehicle, id) == 1
|
||||
extras[tostring(id)] = state
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
|
||||
@@ -678,9 +686,7 @@ ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
IsVehicleNeonLightEnabled(vehicle, 3)
|
||||
},
|
||||
|
||||
extras = {
|
||||
|
||||
},
|
||||
extras = extras,
|
||||
|
||||
neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)),
|
||||
tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)),
|
||||
@@ -791,6 +797,16 @@ ESX.Game.SetVehicleProperties = function(vehicle, props)
|
||||
SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4])
|
||||
end
|
||||
|
||||
if props.extras ~= nil then
|
||||
for id,enabled in pairs(props.extras) do
|
||||
if enabled then
|
||||
SetVehicleExtra(vehicle, tonumber(id), 0)
|
||||
else
|
||||
SetVehicleExtra(vehicle, tonumber(id), 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if props.neonColor ~= nil then
|
||||
SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user