Hey, So Im looking to have a command and or a control key pressed to remove the job title as well as the money bank and dirty money at the top right currently I’ve ran into an issue where its not fully working the way as intended when I do it nothing is happening I’ve located what I believe to be the source of showing the Hud ect… if someone can assist in having this hide that would be great!
local GUI = {}
GUI.Time = 0
local LoadoutLoaded = false
local IsPaused = false
local PlayerSpawned = false
local LastLoadout = {}
local Pickups = {}
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerLoaded = true
ESX.PlayerData = xPlayer
for i=1, #xPlayer.accounts, 1 do
local accountTpl = '<div><img src="img/accounts/' .. xPlayer.accounts[i].name .. '.png"/> {{money}}</div>'
ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, {
money = 0
})
ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, {
money = xPlayer.accounts[i].money
})
end
local jobTpl = '<div>{{job_label}} - {{grade_label}}</div>'
if xPlayer.job.grade_label == '' then
jobTpl = '<div>{{job_label}}</div>'
end
ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, {
job_label = '',
grade_label = ''
})
ESX.UI.HUD.UpdateElement('job', {
job_label = xPlayer.job.label,
grade_label = xPlayer.job.grade_label
})
end)
I don’t use esx or know lua but I checked esx real quick on the github and I find that they update their HUD in Javascript
ESX.refreshHUD = function(){
$('#hud').html('');
for(let i=0; i<ESX.HUDElements.length; i++){
let html = Mustache.render(ESX.HUDElements[i].html, ESX.HUDElements[i].data);
$('#hud').append(html);
}
—edit----
if you look at their NUI stuff:
window.onData = (data) => {
switch(data.action){
case 'setHUDDisplay' : {
ESX.setHUDDisplay(data.opacity);
break;
}
you should be able to send a NUIMessage SetHUDDisplay to on or off whenever you want.
It is a part of code that I made sometimes ago. I use it with nb_menuperso but I extracted it and made it a resource.
(Please be cool since I’ve just created the github only for this and it is my first “release”)
Hello Lucifer, may i have more informations about the CSS app.css file ? Im trying since yesterday to put on line all the HUD and i fuckd up again i suppose ! Ty for your help
Hi, @Caesar, could you tell me what to change, so it’s hidden natively from the start of the client? I am bit lost in here and every try messed up the script
@Caesar I’ve been attempting to make the additions and changes indicated in your release on github, but each time I get onto the server after having made the changes, it doesn’t work. Upon troubleshooting, I realized that the files are reverting back to their local original files of both main.lua and client.lua somewhere between disconnecting from filezillla and connecting to the server. Any tips on trying to make the changes stick?