Skip to content

Commit

Permalink
fixed being charged money when removing turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasDev17 committed Mar 27, 2022
1 parent 1672d2a commit a8f0f89
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 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
6 changes: 3 additions & 3 deletions client/cl_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -306,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 @@ -582,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
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 a8f0f89

Please sign in to comment.