mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
Add RGB support and fixed liveries
Add RGB support and fixed liveries
This commit is contained in:
@@ -573,6 +573,19 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
if DoesEntityExist(vehicle) then
|
||||
local colorPrimary, colorSecondary = GetVehicleColours(vehicle)
|
||||
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
|
||||
local hasCustomPrimaryColor = GetIsVehiclePrimaryColourCustom(vehicle)
|
||||
local customPrimaryColor = nil
|
||||
if hasCustomPrimaryColor then
|
||||
local r, g, b = GetVehicleCustomPrimaryColour(vehicle)
|
||||
customPrimaryColor = { r, g, b }
|
||||
end
|
||||
|
||||
local hasCustomSecondaryColor = GetIsVehicleSecondaryColourCustom(vehicle)
|
||||
local customSecondaryColor = nil
|
||||
if hasCustomSecondaryColor then
|
||||
local r, g, b = GetVehicleCustomSecondaryColour(vehicle)
|
||||
customSecondaryColor = { r, g, b }
|
||||
end
|
||||
local extras = {}
|
||||
|
||||
for extraId=0, 12 do
|
||||
@@ -596,6 +609,8 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
dirtLevel = ESX.Math.Round(GetVehicleDirtLevel(vehicle), 1),
|
||||
color1 = colorPrimary,
|
||||
color2 = colorSecondary,
|
||||
customPrimaryColor = customPrimaryColor,
|
||||
customSecondaryColor = customSecondaryColor,
|
||||
|
||||
pearlescentColor = pearlescentColor,
|
||||
wheelColor = wheelColor,
|
||||
@@ -662,8 +677,9 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
modAerials = GetVehicleMod(vehicle, 43),
|
||||
modTrimB = GetVehicleMod(vehicle, 44),
|
||||
modTank = GetVehicleMod(vehicle, 45),
|
||||
modWindows = GetVehicleMod(vehicle, 46),
|
||||
modLivery = GetVehicleLivery(vehicle)
|
||||
modDoorR = GetVehicleMod(vehicle, 47),
|
||||
modLivery = GetVehicleMod(vehicle, 48),
|
||||
modLightbar = GetVehicleMod(vehicle, 49),
|
||||
}
|
||||
else
|
||||
return
|
||||
@@ -683,6 +699,8 @@ function ESX.Game.SetVehicleProperties(vehicle, props)
|
||||
if props.tankHealth then SetVehiclePetrolTankHealth(vehicle, props.tankHealth + 0.0) end
|
||||
if props.fuelLevel then SetVehicleFuelLevel(vehicle, props.fuelLevel + 0.0) end
|
||||
if props.dirtLevel then SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0) end
|
||||
if props.customPrimaryColor then SetVehicleCustomPrimaryColour(vehicle, props.customPrimaryColor[1], props.customPrimaryColor[2], props.customPrimaryColor[3]) end
|
||||
if props.customSecondaryColor then SetVehicleCustomSecondaryColour(vehicle, props.customSecondaryColor[1], props.customSecondaryColor[2], props.customSecondaryColor[3]) end
|
||||
if props.color1 then SetVehicleColours(vehicle, props.color1, colorSecondary) end
|
||||
if props.color2 then SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2) end
|
||||
if props.pearlescentColor then SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) end
|
||||
@@ -757,7 +775,6 @@ function ESX.Game.SetVehicleProperties(vehicle, props)
|
||||
|
||||
if props.modLivery then
|
||||
SetVehicleMod(vehicle, 48, props.modLivery, false)
|
||||
SetVehicleLivery(vehicle, props.modLivery)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user