From 28ce131fb7e4cc9cb5b7e7375ba07cf41944fc8c Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 9 Mar 2019 18:37:01 +0100 Subject: [PATCH] Implemented vehicle extras property support, closes #186 --- client/functions.lua | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index 5f77d9de..5ad1d095 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -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