From 36f403f3dc9c97b72f0d3a04072571f5bd8ff7e1 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 30 Nov 2023 19:58:26 +0100 Subject: [PATCH] refactor: refactor esx_joblisting --- .github/CHANGELOG.md | 3 ++- .../resources/[esx_addons]/esx_joblisting/LICENSE | 4 ++-- .../[esx_addons]/esx_joblisting/client/main.lua | 2 +- .../[esx_addons]/esx_joblisting/fxmanifest.lua | 2 +- .../[esx_addons]/esx_joblisting/locales/br.lua | 5 ----- .../[esx_addons]/esx_joblisting/locales/de.lua | 7 ++++--- .../[esx_addons]/esx_joblisting/locales/es.lua | 1 + .../[esx_addons]/esx_joblisting/locales/fi.lua | 6 +++--- .../[esx_addons]/esx_joblisting/locales/fr.lua | 7 ++++--- .../[esx_addons]/esx_joblisting/locales/hu.lua | 2 +- .../[esx_addons]/esx_joblisting/locales/it.lua | 4 ++-- .../[esx_addons]/esx_joblisting/locales/nl.lua | 6 ++++++ .../[esx_addons]/esx_joblisting/locales/si.lua | 5 ----- .../[esx_addons]/esx_joblisting/locales/sl.lua | 8 ++++++++ .../[esx_addons]/esx_joblisting/locales/sr.lua | 6 ++++++ .../[esx_addons]/esx_joblisting/locales/sv.lua | 5 ----- .../[esx_addons]/esx_joblisting/locales/zh-cn.lua | 6 ++++++ .../[esx_addons]/esx_joblisting/server/main.lua | 10 +++++++++- 18 files changed, 56 insertions(+), 33 deletions(-) delete mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/br.lua create mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua delete mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/si.lua create mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua create mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua delete mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/sv.lua create mode 100644 server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 9cdabe2a6..530674275 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -65,4 +65,5 @@ fix lint error: unused argument last; accessing undefined variable Invoke; unuse 39. [esx_taxijob]: refactor: Remove cb, use playerdata obj + fix formatting @bitpredator 40. [workflows]: delete: remove stale.yml + greetings.yml @bitpredator 41. [ox_inventory\data\shops.lua]: chore: the possibility of purchasing the radio has been added @bitpredator - [ox_inventory\data\stashes.lua]: fix: removed the inventory for the taxi job as it was included in the esx_taxijob resource @bitpredator \ No newline at end of file + [ox_inventory\data\stashes.lua]: fix: removed the inventory for the taxi job as it was included in the esx_taxijob resource @bitpredator +42. [esx_joblisting]: refactor: correct the good year for the license + varius fix \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_joblisting/LICENSE b/server-data/resources/[esx_addons]/esx_joblisting/LICENSE index 428c413b5..505256b55 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/LICENSE +++ b/server-data/resources/[esx_addons]/esx_joblisting/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. esx_joblisting - Copyright (C) 2015-2022 Jérémie N'gadi + Copyright (C) 2015-2023 Jérémie N'gadi This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - esx_joblisting Copyright (C) 2015-2022 Jérémie N'gadi + esx_joblisting Copyright (C) 2015-2023 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua b/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua index 01a8729e7..5e958e133 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/client/main.lua @@ -9,7 +9,7 @@ function ShowJobListingMenu() elements[#elements + 1] = {title = jobs[i].label, name = jobs[i].name} end - ESX.OpenContext("right", elements, function(_, SelectJob) + ESX.OpenContext("right", elements, function(menu, SelectJob) TriggerServerEvent('esx_joblisting:setJob', SelectJob.name) ESX.CloseContext() ESX.ShowNotification(_U('new_job', SelectJob.title), "success") diff --git a/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua index f45efde57..0eff08bf1 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/fxmanifest.lua @@ -3,7 +3,7 @@ game 'gta5' description 'ESX Job Listing' lua54 'yes' -version '0.0.4' +version '1.0.0' shared_scripts { '@es_extended/imports.lua', diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/br.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/br.lua deleted file mode 100644 index 26f317fbd..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/br.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['br'] = { - ['new_job'] = 'Você agora tem um novo emprego!', - ['access_job_center'] = 'Pressione ~INPUT_PICKUP~ para acessar a Lista de Empregos.', - ['job_center'] = 'Agência de Empregos', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua index 63098cdbf..9de572907 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/de.lua @@ -1,5 +1,6 @@ Locales['de'] = { - ['new_job'] = 'Du hast einen neuen Job!', - ['access_job_center'] = 'Drücke ~INPUT_PICKUP~ um das Arbeitsamt zu öffnen.', - ['job_center'] = 'Arbeitsamt', + ['new_job'] = 'Neuer Job: ~b~%s~s~ !', + ['access_job_center'] = 'Drücke ~b~[E]~s~ um die Jobauswahl zu öffnen!', + ['job_center'] = 'Wähle einen Job aus.', + ["blip_text"] = "Arbeitsamt" } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua index 95afec8a0..119c90cfe 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/es.lua @@ -2,4 +2,5 @@ Locales['es'] = { ['new_job'] = '¡Tienes un trabajo nuevo!', ['access_job_center'] = 'Pulsa ~INPUT_PICKUP~ para entrar a la Oficina de Empleo.', ['job_center'] = 'Oficina de Empleo', + ["blip_text"] = "Oficina de Empleo" } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua index 1e37abdd0..8cd2cd514 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/fi.lua @@ -1,5 +1,5 @@ Locales['fi'] = { - ['new_job'] = 'Sinulla on nyt uusi työ !', - ['access_job_center'] = 'paina ~INPUT_PICKUP~ vaihtaaksesi työtä työkeskuksessa.', - ['job_center'] = 'työkeskus', + ['new_job'] = 'Sinulla on nyt uusi työ!', + ['access_job_center'] = 'Paina ~INPUT_PICKUP~ vaihtaaksesi työtä.', + ['job_center'] = 'Työkeskus', } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua index 7ac0a78b5..f989e05c8 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/fr.lua @@ -1,5 +1,6 @@ Locales['fr'] = { - ['new_job'] = 'vous avez un nouveau job !', - ['access_job_center'] = 'appuyez sur ~INPUT_PICKUP~ pour \naccéder au Pôle Emploi.', - ['job_center'] = 'pôle-Emploi', + ['new_job'] = 'Vous avez un nouveau métier: ~b~%s~s~ !', + ['access_job_center'] = 'Appuyez sur ~b~[E]~s~ pour ouvrir le sélécteur de métiers.', + ['job_center'] = 'Séléctionnez un métier.', + ["blip_text"] = "Pôle emploi" } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua index 0c23eecd6..36cb83656 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/hu.lua @@ -1,5 +1,5 @@ Locales['hu'] = { ['new_job'] = 'Felvetted a munkát!', - ['access_job_center'] = 'Nyomj ~INPUT_PICKUP~ hogy megnézd a munkákat', + ['access_job_center'] = 'Nyomj ~b~[E]~s~ hogy megnézd a munkákat', ['job_center'] = 'Munkaügyi központ', } diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua index 489ee2009..fdbb54444 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/it.lua @@ -2,5 +2,5 @@ Locales['it'] = { ['new_job'] = 'Nuovo lavoro: ~b~%s~s~ !', ['access_job_center'] = 'Premi ~b~[E]~s~ per aprire la scelta dei lavori.', ['job_center'] = 'Seleziona un lavoro.', - ["blip_text"] = "Centro lavori" -} \ No newline at end of file + ["blip_text"] = "Centro impieghi" +} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua new file mode 100644 index 000000000..7152f0266 --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/nl.lua @@ -0,0 +1,6 @@ +Locales['nl'] = { + ['new_job'] = 'Nieuwe baan: ~b~%s~s~ !', + ['access_job_center'] = 'Klik op ~b~[E]~s~ om het uitzendbureau te openen.', + ['job_center'] = 'Selecteer een baan.', + ["blip_text"] = "Uitzendbureau" +} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/si.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/si.lua deleted file mode 100644 index 76c5b6dd7..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/si.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['si'] = { - ['new_job'] = 'imaš novo službo!', - ['access_job_center'] = 'pritisnite ~INPUT_PICKUP~ za dostop do job center.', - ['job_center'] = 'center za delovna mesta', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua new file mode 100644 index 000000000..4e909d2fe --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/sl.lua @@ -0,0 +1,8 @@ +Locales['sl'] = { + ['new_job'] = 'imaš novo službo!', + ['access_job_center'] = 'pritisnite ~INPUT_PICKUP~ za dostop do job center.', + ['job_center'] = 'center za delovna mesta', + ['new_job'] = 'Imate novo Službo!', + ['access_job_center'] = 'Pritisni ~INPUT_PICKUP~ za dostop do Borze.', + ['job_center'] = 'Center za Zaposlovanje', +} \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua new file mode 100644 index 000000000..bdc5869bf --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/sr.lua @@ -0,0 +1,6 @@ +Locales['sr'] = { + ['new_job'] = 'Novi Posao: ~b~%s~s~ !', + ['access_job_center'] = 'Pritisnite ~b~[E]~s~ da biste otvorili centar za zapošljavanje.', + ['job_center'] = 'Izaberite posao.', + ["blip_text"] = "Centar za Zapošljavanje" +} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/sv.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/sv.lua deleted file mode 100644 index b718af6c1..000000000 --- a/server-data/resources/[esx_addons]/esx_joblisting/locales/sv.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales['sv'] = { - ['new_job'] = 'du har ett nytt jobb! Tips: kolla kartan för nya blips.', - ['access_job_center'] = 'tryck ~INPUT_PICKUP~ för att öppna arbetsförmedlingen', - ['job_center'] = 'arbetsförmedlingen', -} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua b/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua new file mode 100644 index 000000000..cf9657c9f --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_joblisting/locales/zh-cn.lua @@ -0,0 +1,6 @@ +Locales['zh-cn'] = { + ['new_job'] = '新工作: ~b~%s~s~ !', + ['access_job_center'] = '摁下 ~b~[E]~s~ 打开就业中心.', + ['job_center'] = '选择工作.', + ["blip_text"] = "就业中心" +} diff --git a/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua b/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua index c0cddab49..181e02f93 100644 --- a/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_joblisting/server/main.lua @@ -14,6 +14,12 @@ ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb) cb(jobs) end) +function IsJobAvailable(job) + local jobs = ESX.GetJobs() + local JobToCheck = jobs[job] + return not JobToCheck.whitelisted +end + function IsNearCentre(player) local Ped = GetPlayerPed(player) local PedCoords = GetEntityCoords(Ped) @@ -37,11 +43,13 @@ AddEventHandler('esx_joblisting:setJob', function(job) local xPlayer = ESX.GetPlayerFromId(source) local jobs = getJobs() - if xPlayer and IsNearCentre(source) then + if xPlayer and IsNearCentre(source) and IsJobAvailable(job) then if ESX.DoesJobExist(job, 0) then xPlayer.setJob(job, 0) else print("[^1ERROR^7] Tried Setting User ^5".. source .. "^7 To Invalid Job - ^5"..job .."^7!") end + else + print("[^3WARNING^7] User ^5".. source .. "^7 Attempted to Exploit ^5`esx_joblisting:setJob`^7!") end end) \ No newline at end of file