[How to] Use JOB HUD


#1

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


How to create a HUD JOB
[HELP] Jobs HUD
#2

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.


#3

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 …


#4

Hello

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

But the hub seems good


#5

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


#6

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 …


#7

thanks bro you’re the best


#8

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 ?


#9

it working, thanks :wink:


#11

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

When I post it’s automatictly deleted 15 mn past


#12

Can you make some screen ?


#13

Sorry but don’t work for me.


#14

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


#15

Sorry but not working for me


#16

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


#17

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


#18

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


#19

work fine thx for your HOW TO :wink:


#20

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


#21

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


[Help] [How To] Help me to insert image on job