Implemented vehicle extras property support, closes #186

This commit is contained in:
ElPumpo
2019-03-09 18:37:01 +01:00
parent cd9383a56f
commit 28ce131fb7
+20 -4
View File
@@ -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