From 8cc7e2807f472619e5ba5c5b4e39b2a15cfe8410 Mon Sep 17 00:00:00 2001 From: Phelps <94879374+NotPhelps@users.noreply.github.com> Date: Thu, 23 Apr 2026 03:40:48 -0400 Subject: [PATCH 1/2] Update sv_main.lua qbox support --- server/sv_main.lua | 136 ++++++++++++++++++++++++++++++++------------- 1 file changed, 97 insertions(+), 39 deletions(-) diff --git a/server/sv_main.lua b/server/sv_main.lua index d58cd8b..3d4e9d7 100644 --- a/server/sv_main.lua +++ b/server/sv_main.lua @@ -196,51 +196,109 @@ QBCore.Commands.Add('addjob', 'Add Multi Job (Admin Only)', { { name = 'id', hel end, 'admin') QBCore.Functions.CreateCallback("ps-multijob:getJobs", function(source, cb) - local Player = QBCore.Functions.GetPlayer(source) - local jobs = GetJobs(Player.PlayerData.citizenid) - local multijobs = {} - local whitelistedjobs = {} - local civjobs = {} - local active = {} - local getjobs = {} - local Players = QBCore.Functions.GetPlayers() - - for i = 1, #Players, 1 do - local xPlayer = QBCore.Functions.GetPlayer(Players[i]) - active[xPlayer.PlayerData.job.name] = 0 - if active[xPlayer.PlayerData.job.name] and xPlayer.PlayerData.job.onduty then - active[xPlayer.PlayerData.job.name] = active[xPlayer.PlayerData.job.name] + 1 + if Config.Core == 'qbox' then + local Player = QBCore.Functions.GetPlayer(source) + if not Player then return cb({ whitelist = {}, civilian = {} }) end + + local jobs = GetJobs(Player.PlayerData.citizenid) + local multijobs = { + whitelist = {}, + civilian = {} + } + local active = {} + + local Players = QBCore.Functions.GetPlayers() + for _, playerId in pairs(Players) do + local xPlayer = QBCore.Functions.GetPlayer(playerId) + if xPlayer then + local jobName = xPlayer.PlayerData.job.name + if not active[jobName] then + active[jobName] = 0 + end + if xPlayer.PlayerData.job.onduty then + active[jobName] = active[jobName] + 1 + end + end end - end - for job, grade in pairs(jobs) do - if QBCore.Shared.Jobs[job] == nil then - print("The job '" .. job .. "' has been removed and is not present in your QBCore jobs. Remove it from the multijob SQL or add it back to your qbcore jobs.lua.") - else - local online = active[job] or 0 - getjobs = { - name = job, - grade = grade, - description = Config.Descriptions[job], - icon = Config.FontAwesomeIcons[job], - label = QBCore.Shared.Jobs[job].label, - gradeLabel = QBCore.Shared.Jobs[job].grades[tostring(grade)].name, - salary = QBCore.Shared.Jobs[job].grades[tostring(grade)].payment, - active = online, - } - if Config.WhitelistJobs[job] then - whitelistedjobs[#whitelistedjobs+1] = getjobs + for job, grade in pairs(jobs) do + local jobData = QBCore.Shared.Jobs[job] + if not jobData then + print("^1[ps-multijob] The job '" .. job .. "' is missing from Shared.Jobs. Remove it from the multijob SQL or add it back to jobs.lua.^0") else - civjobs[#civjobs+1] = getjobs + local jobGrade = jobData.grades[tostring(grade)] or jobData.grades[grade] + -- local jobGrade = jobData.grades[tostring(grade)] + if jobGrade then + local jobInfo = { + name = job, + grade = grade, + description = Config.Descriptions[job] or "", + icon = Config.FontAwesomeIcons[job] or "", + label = jobData.label or job, + gradeLabel = jobGrade.name or "Unknown", + salary = jobGrade.payment or 0, + active = active[job] or 0, + } + + if Config.WhitelistJobs[job] then + table.insert(multijobs.whitelist, jobInfo) + else + table.insert(multijobs.civilian, jobInfo) + end + else + print("^1[ps-multijob] Grade " .. grade .. " not found for job '" .. job .. "'.^0") + end end end - end - multijobs = { - whitelist = whitelistedjobs, - civilian = civjobs, - } - cb(multijobs) + cb(multijobs) + elseif Config.Core == 'qb-core' then + local Player = QBCore.Functions.GetPlayer(source) + local jobs = GetJobs(Player.PlayerData.citizenid) + local multijobs = {} + local whitelistedjobs = {} + local civjobs = {} + local active = {} + local getjobs = {} + local Players = QBCore.Functions.GetPlayers() + + for i = 1, #Players, 1 do + local xPlayer = QBCore.Functions.GetPlayer(Players[i]) + active[xPlayer.PlayerData.job.name] = 0 + if active[xPlayer.PlayerData.job.name] and xPlayer.PlayerData.job.onduty then + active[xPlayer.PlayerData.job.name] = active[xPlayer.PlayerData.job.name] + 1 + end + end + + for job, grade in pairs(jobs) do + if QBCore.Shared.Jobs[job] == nil then + print("The job '" .. job .. "' has been removed and is not present in your QBCore jobs. Remove it from the multijob SQL or add it back to your qbcore jobs.lua.") + else + local online = active[job] or 0 + getjobs = { + name = job, + grade = grade, + description = Config.Descriptions[job], + icon = Config.FontAwesomeIcons[job], + label = QBCore.Shared.Jobs[job].label, + gradeLabel = QBCore.Shared.Jobs[job].grades[tostring(grade)].name, + salary = QBCore.Shared.Jobs[job].grades[tostring(grade)].payment, + active = online, + } + if Config.WhitelistJobs[job] then + whitelistedjobs[#whitelistedjobs+1] = getjobs + else + civjobs[#civjobs+1] = getjobs + end + end + end + + multijobs = { + whitelist = whitelistedjobs, + civilian = civjobs, + } + cb(multijobs) + end end) RegisterNetEvent("ps-multijob:changeJob",function(cjob, cgrade) From 5217bd494d8bff7a1e4c62c800e69e12de4c27ea Mon Sep 17 00:00:00 2001 From: Phelps <94879374+NotPhelps@users.noreply.github.com> Date: Thu, 23 Apr 2026 03:41:37 -0400 Subject: [PATCH 2/2] Update config.lua qbox support --- config.lua | 78 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/config.lua b/config.lua index 91a1d2d..10d64a2 100644 --- a/config.lua +++ b/config.lua @@ -3,58 +3,60 @@ Config = Config or {} -- Side of the screen where you want the ui to be on. Can either be "left" or "right" Config.Side = "right" +Config.Core = 'qbox' -- qbox or qb-core + Config.MaxJobs = 3 Config.IgnoredJobs = { - ["unemployed"] = true, + ["unemployed"] = true, } Config.DenyDuty = { - ["ambulance"] = true, - ["police"] = true, + ["ambulance"] = true, + ["police"] = true, } Config.WhitelistJobs = { - ["police"] = true, - ["ambulance"] = true, - ["mechanic"] = true, - ["judge"] = true, - ["lawyer"] = true, + ["police"] = true, + ["ambulance"] = true, + ["mechanic"] = true, + ["judge"] = true, + ["lawyer"] = true, } Config.Descriptions = { - ["police"] = "Shoot some criminals or maybe be a good cop and arrest them", - ["ambulance"] = "Fix the bullet holes", - ["mechanic"] = "Fix the bullet holes", - ["tow"] = "Pickup the tow truck and steal some vehicles", - ["taxi"] = "Pickup people around the city and drive them to their destination", - ["bus"] = "Pickup multiple people around the city and drive them to their destination", - ["realestate"] = "Sell houses or something", - ["cardealer"] = "Sell cars or something", - ["judge"] = "Decide if people are guilty", - ["lawyer"] = "Help the good or the bad", - ["reporter"] = "Lowkey useless", - ["trucker"] = "Drive a truck", - ["garbage"] = "Drive a garbage truck", - ["vineyard"] = "Get them vines", - ["hotdog"] = "Sell them glizzys", + ["police"] = "Shoot some criminals or maybe be a good cop and arrest them", + ["ambulance"] = "Fix the bullet holes", + ["mechanic"] = "Fix the bullet holes", + ["tow"] = "Pickup the tow truck and steal some vehicles", + ["taxi"] = "Pickup people around the city and drive them to their destination", + ["bus"] = "Pickup multiple people around the city and drive them to their destination", + ["realestate"] = "Sell houses or something", + ["cardealer"] = "Sell cars or something", + ["judge"] = "Decide if people are guilty", + ["lawyer"] = "Help the good or the bad", + ["reporter"] = "Lowkey useless", + ["trucker"] = "Drive a truck", + ["garbage"] = "Drive a garbage truck", + ["vineyard"] = "Get them vines", + ["hotdog"] = "Sell them glizzys", } -- Change the icons to any free font awesome icon, also add other jobs your server might have to the list -- List: https://fontawesome.com/search?o=r&s=solid Config.FontAwesomeIcons = { - ["police"] = "fa-solid fa-handcuffs", - ["ambulance"] = "fa-solid fa-user-doctor", - ["mechanic"] = "fa-solid fa-wrench", - ["tow"] = "fa-solid fa-truck-tow", - ["taxi"] = "fa-solid fa-taxi", - ["bus"] = "fa-solid fa-bus", - ["realestate"] = "fa-solid fa-sign-hanging", - ["cardealer"] = "fa-solid fa-cards", - ["judge"] = "fa-solid fa-gave", - ["lawyer"] = "fa-solid fa-gavel", - ["reporter"] = "fa-solid fa-microphone", - ["trucker"] = "fa-solid fa-truck-front", - ["garbage"] = "fa-solid fa-trash-can", - ["vineyard"] = "fa-solid fa-wine-bottle", - ["hotdog"] = "fa-solid fa-hotdog", + ["police"] = "fa-solid fa-handcuffs", + ["ambulance"] = "fa-solid fa-user-doctor", + ["mechanic"] = "fa-solid fa-wrench", + ["tow"] = "fa-solid fa-truck-tow", + ["taxi"] = "fa-solid fa-taxi", + ["bus"] = "fa-solid fa-bus", + ["realestate"] = "fa-solid fa-sign-hanging", + ["cardealer"] = "fa-solid fa-cards", + ["judge"] = "fa-solid fa-gave", + ["lawyer"] = "fa-solid fa-gavel", + ["reporter"] = "fa-solid fa-microphone", + ["trucker"] = "fa-solid fa-truck-front", + ["garbage"] = "fa-solid fa-trash-can", + ["vineyard"] = "fa-solid fa-wine-bottle", + ["hotdog"] = "fa-solid fa-hotdog", }