Skip to content

Commit

Permalink
Merge pull request #4 from JonasDev99/dev
Browse files Browse the repository at this point in the history
fixed armor and turbo option
  • Loading branch information
ItsANoBrainer authored Mar 27, 2022
2 parents 51c63e3 + a8f0f89 commit b849e67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/cl_bennys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function GetCurrentTurboState()
local plyVeh = GetVehiclePedIsIn(plyPed, false)
local isEnabled = IsToggleModOn(plyVeh, 18)

return isEnabled and 1 or 0
return isEnabled and 0 or -1
end

function GetCurrentExtraState(extra)
Expand Down
14 changes: 9 additions & 5 deletions client/cl_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,14 @@ function InitiateMenus(isMotorcycle, vehicleHealth, categories, welcomeLabel)
local _, amountValidMods = CheckValidMods(v.category, v.id)

if amountValidMods > 0 or v.id == 18 then
if (v.id == 11 or v.id == 12 or v.id == 13 or v.id == 15 or v.id == 16) then
if (v.id == 11 or v.id == 12 or v.id == 13 or v.id == 15) then
if categories.mods and maxVehiclePerformanceUpgrades ~= -1 then
populateMenu("mainMenu", v.id, v.category, "none")
end
elseif v.id == 16 then
if categories.armor then
populateMenu("mainMenu", v.id, v.category, "none")
end
elseif v.id == 14 then
if categories.horns then
populateMenu("mainMenu", v.id, v.category, "none")
Expand Down Expand Up @@ -302,8 +306,8 @@ function InitiateMenus(isMotorcycle, vehicleHealth, categories, welcomeLabel)
local currentTurboState = GetCurrentTurboState()
createMenu(v.category:gsub("%s+", "") .. "Menu", v.category .. " Customisation", "Enable or Disable Turbo")

populateMenu(v.category:gsub("%s+", "") .. "Menu", 0, "Disable", "$0")
populateMenu(v.category:gsub("%s+", "") .. "Menu", 1, "Enable", "$" .. vehicleCustomisationPrices.turbo.price)
populateMenu(v.category:gsub("%s+", "") .. "Menu", -1, "Disable", "$0")
populateMenu(v.category:gsub("%s+", "") .. "Menu", 0, "Enable", "$" .. vehicleCustomisationPrices.turbo.prices[2])

updateItem2Text(v.category:gsub("%s+", "") .. "Menu", currentTurboState, "Installed")

Expand Down Expand Up @@ -578,7 +582,7 @@ function MenuManager(state)
if currentMenuItem2 ~= "Installed" then
if isMenuActive("modMenu") then
if currentCategory == 18 then --Turbo
if AttemptPurchase("turbo") then
if AttemptPurchase("turbo", currentMenuItemID) then
ApplyMod(currentCategory, currentMenuItemID)
playSoundEffect("wrench", 0.4)
updateItem2Text(currentMenu, currentMenuItemID, "Installed")
Expand Down Expand Up @@ -956,4 +960,4 @@ RegisterNUICallback("updateItem2", function(data, cb)
currentMenuItem2 = data.item

cb("ok")
end)
end)
2 changes: 1 addition & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vehicleCustomisationPrices = {
cosmetics = {price = 400},
respray = {price = 1000},
performance = {prices = {0, 3250, 5500, 10450, 15250, 20500}},
turbo = {price = 15000},
turbo = {prices = {0, 15000}},
wheels = {price = 400},
customwheels = {price = 600},
wheelsmoke = {price = 400},
Expand Down
2 changes: 1 addition & 1 deletion server/sv_bennys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RegisterNetEvent('qb-customs:server:attemptPurchase', function(type, upgradeLeve
else
TriggerClientEvent('qb-customs:client:purchaseFailed', source)
end
elseif type == "performance" then
elseif type == "performance" or type == "turbo" then
if balance >= vehicleCustomisationPrices[type].prices[upgradeLevel] then
TriggerClientEvent('qb-customs:client:purchaseSuccessful', source)
Player.Functions.RemoveMoney(moneyType, vehicleCustomisationPrices[type].prices[upgradeLevel], "bennys")
Expand Down

0 comments on commit b849e67

Please sign in to comment.