From cbf20f52d70fe09af2af8b8e6e2ef845fdb6b4fe Mon Sep 17 00:00:00 2001 From: Michael Biddle <556637+mbiddle@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:07:54 -0800 Subject: [PATCH 1/3] Me again. Looks like I wasn't the only person who was unaware of QBCore.Shared.Round. --- client/main.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index a2b110b..97e4c73 100644 --- a/client/main.lua +++ b/client/main.lua @@ -7,10 +7,6 @@ local listenForKey = false -- Functions -local function round(num, numDecimalPlaces) - return tonumber(string.format('%.' .. (numDecimalPlaces or 0) .. 'f', num)) -end - local function CheckPlayers(vehicle) for i = -1, 5, 1 do local seat = GetPedInVehicleSeat(vehicle, i) @@ -27,8 +23,8 @@ local function OpenGarageMenu(data) if result == nil then return QBCore.Functions.Notify(Lang:t('error.no_vehicles'), 'error', 5000) end local formattedVehicles = {} for _, v in pairs(result) do - local enginePercent = round(v.engine, 0) - local bodyPercent = round(v.body, 0) + local enginePercent = QBCore.Shared.Round(v.engine, 0) + local bodyPercent = QBCore.Shared.Round(v.body, 0) local vname = nil pcall(function() vname = QBCore.Shared.Vehicles[v.vehicle].name From 32c40aca0e2afff3a854dbc94277a0a42cb2f8cb Mon Sep 17 00:00:00 2001 From: Michael Biddle <556637+mbiddle@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:57:40 -0800 Subject: [PATCH 2/3] Fixed Issue #366 where garage needed to be ensured again in order to deposit vehicles into houses. The variable house wasn't defined previously. --- client/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/main.lua b/client/main.lua index 97e4c73..273bed1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -409,11 +409,11 @@ RegisterNetEvent('qb-garages:client:setHouseGarage', function(house, hasKey) -- end) RegisterNetEvent('qb-garages:client:houseGarageConfig', function(houseGarages) - for _, garageConfig in pairs(houseGarages) do + for houseName, garageConfig in pairs(houseGarages) do local formattedHouseName = string.gsub(string.lower(garageConfig.label), ' ', '') if garageConfig.takeVehicle and garageConfig.takeVehicle.x and garageConfig.takeVehicle.y and garageConfig.takeVehicle.z and garageConfig.takeVehicle.w then Config.Garages[formattedHouseName] = { - houseName = house, + houseName = houseName, takeVehicle = vector3(garageConfig.takeVehicle.x, garageConfig.takeVehicle.y, garageConfig.takeVehicle.z), spawnPoint = { vector4(garageConfig.takeVehicle.x, garageConfig.takeVehicle.y, garageConfig.takeVehicle.z, garageConfig.takeVehicle.w) From 5031cfe835e6fc13df9a2fada96fc4a9c5ad0098 Mon Sep 17 00:00:00 2001 From: Michael Biddle <556637+mbiddle@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:10:13 -0800 Subject: [PATCH 3/3] Removed unused loop variable from lint report --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 273bed1..be2e3c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -203,7 +203,7 @@ function GetSpawnPoint(garage) local location = nil if #garage.spawnPoint > 1 then local maxTries = #garage.spawnPoint - for i = 1, maxTries do + for _ = 1, maxTries do local randomIndex = math.random(1, #garage.spawnPoint) local chosenSpawnPoint = garage.spawnPoint[randomIndex] local isOccupied = IsPositionOccupied(