Hide ESX Hud Top Right (Detailed)


#1

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"/>&nbsp;{{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)

[HELP] Hide hud and chat and how to disable background chat?
Es_extended disable money hud's
vMenu v1.2.1 - A server-sided menu including (almost) full permissions support
#2

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.

#3

Hmmm just trying to figure out here how we can go about this


#4

Well I can’t help you with the actual coding since I don’t know lua, I only know c#.


#5

Well I seriously appreciate you pointing me the right direction :slight_smile:


#6

Still having issues with this Hmm…anyone else have any luck?


#7

Try this and let me know:

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”)

Feel free to modify it and do whatever you want.


#8

I have question, where i can change Hud logation?


#9

CSS file

[20 Characters]


#10

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


#11

It will be in the CSS file, I haven’t done it since ESX is horrible, so just mess with some of the values.


#12

Ok np i’ll keep working on and trying, thx a lot for your help :frowning:


#13

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 :slight_smile:

Edit.: SOLVED by changing line 25

“local interface = true” to false


#14

Exactly! Sorry I couldn’t reply earlier :slightly_frowning_face: