Casino chips hud/stats

Hello,

I’am trying to display the Casino chips like in online (in the top right corner like cash and bank balance).
For the cash and bank balance, these values can be set using:
StatSetInt(‘MP0_WALLET_BALANCE’, Money, true)
StatSetInt(‘BANK_BALANCE’, Money, true)

However, I can’t find the stat name for the Casino chips, does anyone know? I’ve already checked the ‘mpstatssetup.xml’ and ‘spstatssetup.xml’ in the DLC pack and main game files.

The hud looks like:
https://static.wikia.nocookie.net/gtawiki/images/c/ca/Chipscounter-GTAO.png/revision/latest/scale-to-width-down/640?cb=20190812111642

Thanks in advance!

The chips are drawn in a little unusual way using a scripted HUD component, and aren’t directly tied to a stat. I don’t have any code at hand for this at the time, sadly.

1 Like

I just thought about this while adding them myself. Here is the logic that I came up with.

local chips = 0 --chips counter. can be replaced with the stat.
function ShowChips(_chips)
    local scale = RequestScaleformScriptHudMovie(21)
    while not HasScaleformScriptHudMovieLoaded(21) do
        print('wait for scaleform')
        Citizen.Wait(0)
    end
    BeginScaleformScriptHudMovieMethod(21, "SET_PLAYER_CHIPS")
    ScaleformMovieMethodAddParamInt(_chips)
    EndScaleformMovieMethod()
    if _chips ~= chips then --if new chips value is different, show chip change HUD
        local bool = true
        local change = _chips - chips
        if _chips < chips then
            bool = false
            change = change*-1
        end
        local scale = RequestScaleformScriptHudMovie(22)
        while not HasScaleformScriptHudMovieLoaded(22) do
            print('wait for scaleform')
            Citizen.Wait(0)
        end
        BeginScaleformScriptHudMovieMethod(22, "SET_PLAYER_CHIP_CHANGE")
        ScaleformMovieMethodAddParamInt(change)
        ScaleformMovieMethodAddParamBool(bool)
        EndScaleformMovieMethod()
    end
    Citizen.Wait(4000) --display time for chips HUD, in ms
    RemoveScaleformScriptHudMovie(21)
    RemoveScaleformScriptHudMovie(22)
    chips = _chips
end

You can run the SetChips(oldValue + changeValue) function whenever you have to change chips.

edit: also, chips stat is “MP0_CASINO_CHIPS” (I think)

1 Like

You guys are the best, this totally works. I didn’t expect any replies on the matter :slight_smile:

any idea how i can use this to show casino chips in my top right? im not sure where to put in any function in FiveM