How to create a key that removes and resets the HUD

Hi guys,

I would like to create a key that can remove and reset the HUD money. And I do not know how to do, with you ideas?

Thanks You,

Should not be that hard…

Citizen.CreateThread(function()
   while true do

      if IsControlPressed(0, 38) -- E key then
         local playerPed = GetPlayerPed()
         SetPedMoney(playerPed, 0)
      end

      Citizen.Wait(1)

   end
end)

Should reset the money of the player when pressing the E key.

Use the wiki to see which controls are available:
https://wiki.fivem.net/wiki/Controls

1 Like

Thank you, are you sure that it removes the hud? and how to do it with dirty money and money in the bank. Otherwise Thanks men

If you don’t want to reset the money but remove (hide) the money element form the HUD instead, try this:

HideHudCompomentThisFrame(3) -- HUD_CASH = 3
HideHudCompomentThisFrame(4) -- HUD_MP_CASH = 4

To make it reappear use this:

ShowHudCompomentThisFrame(3) -- HUD_CASH = 3
ShowHudCompomentThisFrame(4) -- HUD_MP_CASH = 4

Otherwise just use what @Syntasu suggested.

Thanks You for a help men.

I have another question can I answer?

1 Like

Sure, Just fire away :slight_smile:

I put her but her does not work

Citizen.CreateThread(function()
   while true do

      if IsControlPressed(0, 38) -- E key then
         local playerPed = GetPlayerPed()
         HideHudCompomentThisFrame(3) -- HUD_CASH = 3
         HideHudCompomentThisFrame(4) -- HUD_MP_CASH = 4
      end

      Citizen.Wait(1)

   end
end)

I would like to create an item that can handle or otherwise make an item that performs a function.

Pretty sure you need to call HideHudComponentThisFrame continuously, changing your code to something like this would probably work: (not tested it)

var isMoneyHidden = false
Citizen.CreateThread(function()
    while true do
        if IsControlJustReleased(0, 38) then  -- E key
            isMoneyHidden = not isMoneyHidden
        end
        if isMoneyHidden then
            HideHudCompomentThisFrame(3) -- HUD_CASH = 3
            HideHudCompomentThisFrame(4) -- HUD_MP_CASH = 4
        end
        Citizen.Wait(0)
    end
end)

I’ll test her Thanks. And you do not know how I can make to create an item that you buy and that can handcuff?
Thank you.

where is this hud folder?