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)

#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]