From 2596a30809df5b5827542162ea01600f38e8206b Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:18:52 +1000 Subject: [PATCH] refactor(setup): prevent error from new qb-inventory data --- setup/convert.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/setup/convert.lua b/setup/convert.lua index 7e327e3eed..bc19911bce 100644 --- a/setup/convert.lua +++ b/setup/convert.lua @@ -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') @@ -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 = {} @@ -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)