Skip to content

Commit

Permalink
fix: modules invalidly returning more than one value
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID committed Sep 24, 2024
1 parent fb85b39 commit 2b3f6c2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local config = require 'config.client'
local sharedConfig = require 'config.shared'
local vehiclesMenu, vehiclesMenuCount = require 'client.vehicles'
local vehiclesMenu = require 'client.vehicles'
local VEHICLES = exports.qbx_core:GetVehiclesByName()
local VEHICLES_HASH = exports.qbx_core:GetVehiclesByHash()
local testDriveVeh = 0
Expand Down Expand Up @@ -185,8 +185,8 @@ end
local function openVehCatsMenu(category, targetVehicle)

local categoryMenu = {}
for i = 1, vehiclesMenuCount do
local vehicle = vehiclesMenu[i]
for i = 1, vehiclesMenu.count do
local vehicle = vehiclesMenu.vehicles[i]
if vehicle.category == category and vehicle.shopType == insideShop then
vehicle.args.closestShop = insideShop
vehicle.args.targetVehicle = targetVehicle
Expand Down
5 changes: 4 additions & 1 deletion client/vehicles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ table.sort(vehicles, function(a, b)
return aName < bName
end)

return vehicles, count
return {
vehicles = vehicles,
count = count,
}
6 changes: 3 additions & 3 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ assert(lib.checkDependency('qbx_vehicles', '1.4.1'), 'qbx_vehicles v1.4.1 or hig
local config = require 'config.server'
local sharedConfig = require 'config.shared'
local finance = require 'server.finance'
local allowedVehicles, allowedVehiclesCount = require 'server.vehicles'
local allowedVehicles = require 'server.vehicles'
local financeTimer = {}
local coreVehicles = exports.qbx_core:GetVehiclesByName()
local shopZones = {}
Expand Down Expand Up @@ -121,8 +121,8 @@ end)
---@param shop string? Shop name to check if vehicle is allowed in that shop
---@return boolean
local function checkVehicleList(vehicle, shop)
for i = 1, allowedVehiclesCount do
local allowedVeh = allowedVehicles[i]
for i = 1, allowedVehicles.count do
local allowedVeh = allowedVehicles.vehicles[i]
if allowedVeh.model == vehicle then
if shop and allowedVeh.shopType == shop then
return true
Expand Down
5 changes: 4 additions & 1 deletion server/vehicles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ for k, vehicle in pairs(VEHICLES) do
end
end

return vehicles, count
return {
vehicles = vehicles,
count = count,
}

0 comments on commit 2b3f6c2

Please sign in to comment.