How to have 2 jobs?

Hi, I’m going crazy trying to get double jobs on my server but with no results.
Anyone knows if there is a tutorial or a ready resource somewhere?

1 Like
1 Like

I’ve seen this but i don’t understand if I only have to download the DBG_LesterJobs script or I have to do other things… can you explain a little bit?

DBG_LesterJobs is quite identic to esx_joblisting. At this time it was faster for me to use DBG_LesterJobs and just remplace the job variable to job2.

You have different possibilities:

  • Inlcude inside esx_joblisting the possibility to get a job2
  • copy paste esx_joblisting and remplace job variable to job2
  • Use DBG_LesterJobs and remplace job variable to job2

BR

2 Likes

So if I want to use esx_joblisting I have to duplicate the script and rename job to job2?
And I don’t understand why I have to rename a job like ‘unemployed’ in ‘unemployed2’? Can you tell me that please?

Hi,

So if I want to use esx_joblisting I have to duplicate the script and rename job to job2?

No, you can duplicate job functions and rename them job2, so esx_joblisting would manage job1 and job2

(server side)

RegisterServerEvent('esx_joblisting:setJob')
AddEventHandler('esx_joblisting:setJob', function(job)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	xPlayer.setJob(job, 0)
end)

RegisterServerEvent('esx_joblisting:setJob2')
AddEventHandler('esx_joblisting:setJob2', function(job)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	xPlayer.setJob2(job, 0)
end)

(client side)

RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function (job)
  PlayerData.job = job
end)
RegisterNetEvent('esx:setJob2')
AddEventHandler('esx:setJob2', function (job2)
  PlayerData.job2 = job2
end)

 [..........]

            elseif data.current.value == 'nojob' then
				TriggerServerEvent('esx_joblisting:setJob', 'unemployed')
				ESX.ShowNotification(_U('new_job'))
				menu.close()					
			elseif data.current.value == 'nojob2' then
				TriggerServerEvent('esx_joblisting:setJob2', 'unemployed2')  -- or unemployed
				ESX.ShowNotification(_U('new_job'))
				menu.close()
			end
[ ..........]

And I don’t understand why I have to rename a job like ‘unemployed’ in ‘unemployed2’? Can you tell me that please?

You don’t have to, you can use unemployed, has you would use the police job for job1 and job2 and not create a new police2 job and grades.
I did that to get seperate unemployed jobs for paychecks

unemployed 5$ /15 minutes
unemployed2 2$ /15 minutes

But you could also detect the unemployed job for the job2 and allow a special paycheck:

if  xPlayer.job2.grade_name == 'rsa' then -- unemployed job 
					xPlayer.addAccountMoney('bank', 2) --2$ for unemployed as job2
				
					TriggerEvent('esx_addonaccount:getSharedAccount', 'society_president', function (account)
					account.removeMoney(2)
					end)
end

Instead of

if  xPlayer.job2.grade_name == 'rsa' then -- unemployed job 
				if xPlayer.job2.grade_salary > 0 then
					xPlayer.addAccountMoney('bank', xPlayer.job2.grade_salary) --2$ for unemployed as job2
				
					TriggerEvent('esx_addonaccount:getSharedAccount', 'society_president', function (account)
					account.removeMoney(xPlayer.job2.grade_salary)
					end)
                 end
end

BR

4 Likes

Ok,very thank you for the explaination, I understood some things but the code that you show me is different from mine in esx_joblisting. I tried but yet not working, it don’t show me at top-right the name of the second job but I don’t find the function where this is handled… Do you know where I have to look?

1 Like

what if i use esx_society

Is there anyone else using that and with what success ?

Tomtom please can u sand somewhere it because i want to make it same like you but when i download esx_joblisting i have different then you

Do u get that ?
If u already do that please help me

I want that too pleaseee

hello can you help to make work in esx_joblisting can receive for money , and go to the level above for money

anyone has an archive of this post?

Hello,
You can use this :stuck_out_tongue:

search this on github Petris15/FiveM-ESX-DoubleJob