From 2e4fcff33343004e819009f5a584c1329cbdcb71 Mon Sep 17 00:00:00 2001 From: jimathy Date: Mon, 25 Apr 2022 10:01:51 +0100 Subject: [PATCH 1/2] Debug for missing jobs in config --- server.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.lua b/server.lua index 6568ea8..35812f5 100644 --- a/server.lua +++ b/server.lua @@ -11,6 +11,10 @@ local function cv(amount) return formatted end +AddEventHandler('onResourceStart', function(resource) + if GetCurrentResourceName() == resource then for k, v in pairs(Config.Jobs) do if not QBCore.Shared.Jobs[k] then print("Jim-Payments: Config.Jobs searched for job '"..k.."' and couldn't find it in the Shared") end end end +end) + --QBCore.Commands.Add("cashregister", "Use mobile cash register", {}, false, function(source) TriggerClientEvent("jim-payments:client:Charge", source, true) end) RegisterServerEvent('jim-payments:Tickets:Give', function(data, biller) @@ -142,4 +146,4 @@ QBCore.Functions.CreateCallback('jim-payments:MakePlayerList', function(source, onlineList[#onlineList+1] = { value = tonumber(v), text = "["..v.."] - "..P.PlayerData.charinfo.firstname..' '..P.PlayerData.charinfo.lastname } end cb(onlineList) -end) \ No newline at end of file +end) From 8af82e6d137f08eb15ee6d09186c3a4ff801f6da Mon Sep 17 00:00:00 2001 From: jimathy Date: Mon, 25 Apr 2022 10:04:56 +0100 Subject: [PATCH 2/2] Don't break if job isn't found --- atms.lua | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/atms.lua b/atms.lua index 31d76db..d3d4097 100644 --- a/atms.lua +++ b/atms.lua @@ -71,25 +71,29 @@ CreateThread(function() end if Config.useATM or Config.useBanks then for k, v in pairs(QBCore.Shared.Jobs) do ---Grabs the list of jobs - for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades - if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss - if bossroles[tostring(k)] ~= nil then -- checks if the line exists - if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the - else bossroles[tostring(k)] = tonumber(l) + if QBCore.Shared.Jobs[tostring(k)] then + for l, b in pairs(QBCore.Shared.Jobs[tostring(k)].grades) do -- Grabs the list of grades + if QBCore.Shared.Jobs[tostring(k)].grades[l].isboss == true then -- Checks the grade if is boss + if bossroles[tostring(k)] ~= nil then -- checks if the line exists + if bossroles[tostring(k)] > tonumber(l) then bossroles[tostring(k)] = tonumber(l) end -- the + else bossroles[tostring(k)] = tonumber(l) + end end end end end for k, v in pairs(QBCore.Shared.Gangs) do - for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do - if tostring(k) ~= "none" then - if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then - if gangroles[tostring(k)] ~= nil then - if gangroles[tostring(k)] > tonumber(l) then gangroles[tostring(k)] = tonumber(l) end - else gangroles[tostring(k)] = tonumber(l) + if QBCore.Shared.Gangs[tostring(k)] then + for l, b in pairs(QBCore.Shared.Gangs[tostring(k)].grades) do + if tostring(k) ~= "none" then + if QBCore.Shared.Gangs[tostring(k)].grades[l].isboss == true then + if gangroles[tostring(k)] ~= nil then + if gangroles[tostring(k)] > tonumber(l) then gangroles[tostring(k)] = tonumber(l) end + else gangroles[tostring(k)] = tonumber(l) + end end - end - end + end + end end end end