From 232b5da2719f8d349d0fdb62db2bcc9f36c74d58 Mon Sep 17 00:00:00 2001 From: Fezz <43589668+FBFezz@users.noreply.github.com> Date: Sat, 26 Mar 2022 15:08:55 +0000 Subject: [PATCH 1/2] Update fxmanifest.lua --- [esx_addons]/esx_joblisting/fxmanifest.lua | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/[esx_addons]/esx_joblisting/fxmanifest.lua b/[esx_addons]/esx_joblisting/fxmanifest.lua index 16c15c27..e2c73a61 100644 --- a/[esx_addons]/esx_joblisting/fxmanifest.lua +++ b/[esx_addons]/esx_joblisting/fxmanifest.lua @@ -1,5 +1,4 @@ -fx_version 'adamant' - +fx_version 'bodacious' game 'gta5' description 'ESX Job Listing' @@ -9,17 +8,12 @@ version '1.6.5' shared_scripts { '@es_extended/imports.lua', '@es_extended/locale.lua', + 'locales/*.lua', 'config.lua' } -server_scripts { - '@oxmysql/lib/MySQL.lua', - 'locales/*.lua', - 'server/main.lua' -} -client_scripts { - 'locales/*.lua', - 'client/main.lua' -} +server_script 'server/main.lua' + +client_script 'client/main.lua' dependency 'es_extended' From 894668f7c9d4f2e3dfadb4f4f77ab66492698d71 Mon Sep 17 00:00:00 2001 From: Fezz <43589668+FBFezz@users.noreply.github.com> Date: Sat, 26 Mar 2022 15:09:18 +0000 Subject: [PATCH 2/2] Fixed Not Showing Jobs --- [esx_addons]/esx_joblisting/server/main.lua | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/[esx_addons]/esx_joblisting/server/main.lua b/[esx_addons]/esx_joblisting/server/main.lua index 823f10b3..7190ed08 100644 --- a/[esx_addons]/esx_joblisting/server/main.lua +++ b/[esx_addons]/esx_joblisting/server/main.lua @@ -1,14 +1,18 @@ -local availableJobs = {} - -for k,v in pairs(ESX.Jobs) do - print(v.whitelisted) - if v.whitelisted == false then - availableJobs[k] = {label = v.label} +function getJobs() + local jobs = ESX.GetJobs() + local availableJobs = {} + for k,v in pairs(jobs) do + print(v.whitelisted) + if v.whitelisted == false then + availableJobs[k] = {label = v.label} + end end + return availableJobs end ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb) - cb(availableJobs) + local jobs = getJobs() + cb(jobs) end) function IsNearCentre(player) @@ -27,10 +31,12 @@ end RegisterServerEvent('esx_joblisting:setJob') AddEventHandler('esx_joblisting:setJob', function(job) + local source = source local xPlayer = ESX.GetPlayerFromId(source) + local jobs = getJobs() if xPlayer and IsNearCentre(source) then - if availableJobs[job] then + if jobs[job] then xPlayer.setJob(job, 0) end end