feat(esx_lscustom): headlights colors

This commit is contained in:
hmmehdi
2022-11-03 10:49:17 +01:00
parent 52c70c6264
commit d2a20347aa
2 changed files with 49 additions and 2 deletions
+20 -1
View File
@@ -163,6 +163,14 @@ function UpdateMods(data)
props['modSmokeEnabled'] = true
ESX.Game.SetVehicleProperties(vehicle, props)
props = {}
elseif data.modType == 'xenonColor' then
if data.modNum then
props['modXenon'] = true
else
props['modXenon'] = false
end
ESX.Game.SetVehicleProperties(vehicle, props)
props = {}
end
props[data.modType] = data.modNum
@@ -211,7 +219,7 @@ function GetAction(data)
if v.modType then
if v.modType == 22 then
if v.modType == 22 or v.modType == 'xenonColor' then
table.insert(elements, {
label = " " .. TranslateCap('by_default'),
modType = k,
@@ -290,6 +298,17 @@ function GetAction(data)
modType = k,
modNum = true
})
elseif v.modType == 'xenonColor' then -- XENON COLOR
local xenonColors = GetXenonColors()
price = math.floor(vehiclePrice * v.price / 100)
for i = 1, #xenonColors, 1 do
print(xenonColors[i].label, xenonColors[i].index)
table.insert(elements, {
label = xenonColors[i].label .. ' - <span style="color:green;">$' .. price .. '</span>',
modType = k,
modNum = xenonColors[i].index
})
end
elseif v.modType == 'neonColor' or v.modType == 'tyreSmokeColor' then -- NEON & SMOKE COLOR
local neons = GetNeons()
price = math.floor(vehiclePrice * v.price / 100)
+29 -1
View File
@@ -425,6 +425,27 @@ function GetNeons()
return neons
end
function GetXenonColors()
local xenonColors = {
{label = TranslateCap('neon'), index = -1},
{label = TranslateCap('white'), index = 0},
{label = TranslateCap('blue'), index = 1},
{label = "Electric Blue", index = 2},
{label = "Mint Green", index = 3},
{label = "Lime Green", index = 4},
{label = TranslateCap('yellow'), index = 5},
{label = "Golden Shower", index = 6},
{label = TranslateCap('orange'), index = 7},
{label = TranslateCap('red'), index = 8},
{label = "Pony Pink", index = 9},
{label = "Hot Pink", index = 10},
{label = TranslateCap('purple'), index = 11},
{label = "Blacklight", index = 11},
}
return xenonColors
end
function GetPlatesName(index)
if (index == 0) then
return TranslateCap('blue_on_white_1')
@@ -500,7 +521,8 @@ Config.Menus = {
modHorns = TranslateCap('horns'),
neonColor = TranslateCap('neons'),
resprays = TranslateCap('respray'),
modXenon = TranslateCap('headlights'),
-- modXenon = TranslateCap('headlights'),
xenonColor = TranslateCap('headlights'),
plateIndex = TranslateCap('licenseplates'),
wheels = TranslateCap('wheels'),
modPlateHolder = TranslateCap('modplateholder'),
@@ -801,6 +823,12 @@ Config.Menus = {
modType = 22,
price = 3.72
},
xenonColor = {
label = TranslateCap('headlights'),
parent = 'cosmetics',
modType = 'xenonColor',
price = 3.72
},
bodyparts = {
label = TranslateCap('bodyparts'),
parent = 'cosmetics',