Fix turbo

Adds exceptions for buying turbo because turbos "modNum" is currently a boolean but it is used as an index for an array which gives off a lua error and makes it impossible to purchase it
This commit is contained in:
Lollypop
2018-01-30 00:38:15 +01:00
committed by GitHub
parent feb11f7da4
commit b563cedc66
+7 -4
View File
@@ -78,9 +78,12 @@ function OpenLSMenu(elems, menuname, menutitle, parent)
if isRimMod then
price = math.floor(vehiclePrice * data.current.price / 100)
TriggerServerEvent("esx_lscustom:buyMod", price)
elseif v.modType == 11 or v.modType == 12 or v.modType == 13 or v.modType == 15 or v.modType == 16 or v.modType == 17 then
elseif v.modType == 11 or v.modType == 12 or v.modType == 13 or v.modType == 15 or v.modType == 16 then
price = math.floor(vehiclePrice * v.price[data.current.modNum + 1] / 100)
TriggerServerEvent("esx_lscustom:buyMod", price)
elseif v.modType == 17 then
price = math.floor(vehiclePrice * v.price[1] / 100)
TriggerServerEvent("esx_lscustom:buyMod", price)
else
price = math.floor(vehiclePrice * v.price / 100)
TriggerServerEvent("esx_lscustom:buyMod", price)
@@ -303,10 +306,10 @@ function GetAction(data)
end
elseif v.modType == 17 then -- TURBO
local _label = ''
if currentMods.modTurbo then
if currentMods[k] then
_label = 'Turbo - <span style="color:cornflowerblue;">'.. _U('installed') ..'</span>'
else
_label = 'Turbo - <span style="color:green;">$' .. v.price .. ' </span>'
_label = 'Turbo - <span style="color:green;">$' .. v.price[1] .. ' </span>'
end
table.insert(elements, {label = _label, modType = k, modNum = true})
else
@@ -419,4 +422,4 @@ Citizen.CreateThread(function()
end
end
end)
end)