Skip to content

Commit

Permalink
refactor: refactor esx_joblisting
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Nov 30, 2023
1 parent 399eaba commit 36f403f
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[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
4 changes: 2 additions & 2 deletions server-data/resources/[esx_addons]/esx_joblisting/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
@@ -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',
}
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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',
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
["blip_text"] = "Centro impieghi"
}
Original file line number Diff line number Diff line change
@@ -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"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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',
}
Original file line number Diff line number Diff line change
@@ -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"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Locales['zh-cn'] = {
['new_job'] = '新工作: ~b~%s~s~ !',
['access_job_center'] = '摁下 ~b~[E]~s~ 打开就业中心.',
['job_center'] = '选择工作.',
["blip_text"] = "就业中心"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

0 comments on commit 36f403f

Please sign in to comment.