GTA O Money hud for esx 1.2

I have a money hud that is just like the online hud in GTA its for esx 1.2 , hope you like it. if someone could make it auto update on receiving money without pressing the button, would be great. as of now you have to hit the button to show.
picture : image

3 Likes

nice release! and free? not all heroes wear capes <3

2 Likes

I have no clue how ESX works, but I do use the native HUD all the time.
If ESX has an event that updates a player’s stats, or money, or both. You can add the SetStat values there, kinda like this:

AddEventHandler('esx:Example_Client_Receives_The_Cash', function(totalcash, totalbank)
StatSetInt("BANK_BALANCE", totalcash, true) -- Bank
                StatSetInt("MP0_WALLET_BALANCE", totalbank, true) -- Money
end)

If the value changes in “BANK_BALANCE” or “MP0_WALLET_BALANCE”, then the HUD will appear, with updated values for cash and bank, AAAANNNDD, it will natively show the difference for both.

If the values don’t change, then the HUD will simply not appear.
image

2 Likes

Nice, I will try this out thank you!

Thanks man :smiley: Works perfectly, but I can’t change the key

1 Like

gotta do it in the GTA menu Keybinds for Fivem

1 Like

Just create a client event to refresh the HUD and add the trigger to the addmoney/removemoney functions in ESX. Heres an example of how I’m doing it on a custom framework:

Client Event

RegisterNetEvent('Player:UpdateHudWalletBalance', function(source)
    local walletbalance = TriggerServerCallback('linus-callback:GetAccountBalance', 200, 'wallet')
    SetHUDAccountBalance(source, 'wallet', walletbalance)
end)

Client Function

function SetHUDAccountBalance(source, type, amount)
    if type == 'wallet' then
        local sum = amount
        StatSetInt(GetHashKey("MP0_WALLET_BALANCE"), math.floor(sum), true)
    elseif type == 'bank' then
        local sum = amount
        StatSetInt(GetHashKey("BANK_BALANCE"), math.floor(sum), true)
    else
        print('An unknown error occured while attempting to find this account')
    end
end

Server Sided Remove Money Function

function RemoveAccountMoney(source, identifier, account, amount)
    local wallet = GetBalance(source, identifier, 'wallet')
    local bank = GetBalance(source, identifier, 'bank')
    if account == 'wallet' then 
            local sum = wallet - amount
            local newbalance = SetResourceKvpInt(('users:%s:CharacterData:wallet'):format(identifier), sum)
        TriggerClientEvent('Player:UpdateHudWalletBalance', source)
    elseif account == 'bank' then
            local sum = bank - amount
            local newbalance = SetResourceKvpInt(('users:%s:CharacterData:bank'):format(identifier), sum)
        TriggerClientEvent('Player:UpdateHudBankBalance', source)
    else
        print('Unknown Error: Function RemoveAccountMoney()')
    end
end
2 Likes

Thank you, I didn’t think of looking here :sweat_smile:

1 Like

haha anything man!

1 Like

wish i was smart enough to do this for esx :stuck_out_tongue: lolol

it is not possible to lower the size of that hud?

the font or the display area?

no pretty sure it cant, because its the default money hud in GTA V not a custom one. could be wrong though

If the set value exceeds the maximum value of int, the correct value cannot be displayed. How to deal with it? The maximum value of int can be exceeded online

can someone help me i can’t see the hud i tried so many huds i can’t see nothing up in the right idk how i can make to show up the money hud pls help guys