Skip to content

Commit

Permalink
refactor(setup): prevent error from new qb-inventory data
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Jun 27, 2024
1 parent 9731fd5 commit 2596a30
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions setup/convert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,16 @@ local function ConvertQB()
end
end

Print(('Converting %s user inventories to new data format'):format(count))

if count > 0 then
Print(('Converting %s user inventories to new data format'):format(count))

if not MySQL.transaction.await(parameters) then
return Print('An error occurred while converting player inventories')
end
Wait(100)
end
else
print('literally why are you even running the convert command if you have no inventory data to convert? real 500iq move there')
end

local plates = MySQL.query.await('SELECT plate, citizenid FROM player_vehicles')

Expand All @@ -201,9 +203,9 @@ local function ConvertQB()
plates[plates[i].plate] = plates[i].citizenid
end

local trunk = MySQL.query.await('SELECT plate, items FROM trunkitems')
local oldqbdumpsterfire, trunk = pcall(MySQL.query.await, 'SELECT plate, items FROM trunkitems')

if trunk then
if oldqbdumpsterfire and trunk then
table.wipe(parameters)
count = 0
local vehicles = {}
Expand Down Expand Up @@ -252,7 +254,7 @@ local function ConvertQB()
end
end

local glovebox = MySQL.query.await('SELECT plate, items FROM gloveboxitems')
local glovebox = oldqbdumpsterfire and MySQL.query.await('SELECT plate, items FROM gloveboxitems')

if glovebox then
table.wipe(parameters)
Expand Down

0 comments on commit 2596a30

Please sign in to comment.