[How to] Use JOB HUD

Hi, sorry for my english, I use a translator.

This tutorial is valid only if you use the JobSystem and PayCheck addons!

Start by adding this in your client.lua file for the jobs resource:

RegisterNetEvent(‘jobssystem:updateJob’)
AddEventHandler(‘jobssystem:updateJob’, function(nameJob)
local id = PlayerId()
local playerName = GetPlayerName(id)
SendNUIMessage({
updateJob = true,
job = nameJob,
player = playerName
})
end)

Then in server.lua change:

RegisterServerEvent(‘jobssystem:jobs’)
AddEventHandler(‘jobssystem:jobs’, function(id)
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
local player = user.identifier
local nameJob = nameJob(id)
updatejob(player, id)
TriggerClientEvent(“es_freeroam:notify”, source, “CHAR_MP_STRIPCLUB_PR”, 1, “Mairie”, false, "Votre métier est maintenant : "… nameJob)
end)
end)

By this:

RegisterServerEvent(‘jobssystem:jobs’)
AddEventHandler(‘jobssystem:jobs’, function(id)
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
local player = user.identifier
local nameJob = nameJob(id)
updatejob(player, id)
TriggerClientEvent(“es_freeroam:notify”, source, “CHAR_MP_STRIPCLUB_PR”, 1, “Mairie”, false, "Votre métier est maintenant : "… nameJob)
TriggerClientEvent(“jobssystem:updateJob”, source, nameJob)
end)
end)

AddEventHandler(‘es:playerLoaded’, function(source)
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
local jobName = nameJob(source)
TriggerClientEvent(“jobssystem:updateJob”, source, jobName)
end)
end)

Then add the files from the .rar archive to the inside of the jobs folder:

http://www.sendbox.fr/6f35eb6dda672452/JobDisplay.rar
Created by Zoldac

6 Likes

found a problem here. the player with playerId 1 gets job 1. player with playerId 2 gets job 2 and so on. i log on and im unemployed. i log off and back on and now im a cop. i do it again and now im EMS. The job doesnt change in the DB and the player doesnt get paid the job shown. the HUD just shows the wrong job. Db says 1 and unemployed the gui shows cop but i dont get cop pay.

1 Like

caused by this :

AddEventHandler('es:playerLoaded', function(source)
TriggerEvent('es:getPlayerFromId', source, function(user)
local jobName = nameJob(source)
TriggerClientEvent("jobssystem:updateJob", source, jobName)
end)
end)

i replaced by this :

function getJobId(identifier)
	local executed_query = MySQL:executeQuery("SELECT * FROM users WHERE identifier = '@name'", {['@name'] = identifier})
	local result = MySQL:getResults(executed_query, {'job'})
		return tonumber(result[1].job)
end

AddEventHandler('es:playerLoaded', function(source)
  TriggerEvent('es:getPlayerFromId', source, function(user)
  local jobId = getJobId(user.identifier)
  local jobName = nameJob(jobId)
  TriggerClientEvent("jobssystem:updateJob", source, jobName)
  end)
end)

i can’t test i’m not at home …

3 Likes

Hello

no message: Appuyer sur H pour accéder au menu des métiers
(I cannot choose job)

But the hub seems good

hello i have a problem the job ui is on the money ui so we can’t reed money amount

You can adjust in file “ui.html”

at line 36-37 :


.container {
	margin: 0;
	padding: 0;
	position: absolute;
	top: 50px;
	right: 40px;
	width: 800px;
	height: 200px;
}

change “top” value …

thanks bro you’re the best

Start by adding this in your client.lua file for the jobs resource:

RegisterNetEvent('jobssystem:updateJob')
AddEventHandler('jobssystem:updateJob', function(nameJob)
local id = PlayerId()  <-------------     player(id)    ??????
local playerName = GetPlayerName(id)
SendNUIMessage({
updateJob = true,
job = nameJob,
player = playerName
})
end)

It would not be an error ?

it working, thanks :wink:

Thanks for citation, I don’t know why your post is online lol

When I post it’s automatictly deleted 15 mn past

Can you make some screen ?

Sorry but don’t work for me.

Hello really good script, but why when we disconnect and reconnect we always having a random job on the
corner below the money?

Sorry but not working for me

Hello all i change this

RegisterServerEvent('jobssystem:jobs')
AddEventHandler('jobssystem:jobs', function(id)
TriggerEvent('es:getPlayerFromId', source, function(user)
local playerid = user.identifier
local nameJob = nameJob(id)
updatejob(player, id)
TriggerClientEvent("es_freeroam:notify", source, "CHAR_MP_STRIPCLUB_PR", 1, "Mairie", false, "Votre métier est maintenant : ".. nameJob)
TriggerClientEvent("jobssystem:updateJob", source, nameJob, playerid)  -------------     to past playerid
end)
end)

and this

RegisterNetEvent('jobssystem:updateJob')
AddEventHandler('jobssystem:updateJob', function(nameJob, playerid)
local id = playerid  -------------    insert du player id
local playerName = GetPlayerName(id)
SendNUIMessage({
updateJob = true,
job = nameJob,
player = playerName
})
end)

i thinks its ok

Hello, with this code the job will not change automaticly after disconnect and reconnect?

Hi, I would like to have an icon by JOB know you do? And I have trouble installing can you also explain me thanks

work fine thx for your HOW TO :wink:

Hello, I am not the creator of the script, so I could not give you support

Thank you it works very well. Is it possible to modify the image for each job?