Native referenceRedM

_STAT_ID_INCREMENT_INT

0x6A0184E904CDF25E STATS
FUNCTION SIGNATURE
void _STAT_ID_INCREMENT_INT(Any* statId, int amount);
Property Value
Native Name _STAT_ID_INCREMENT_INT
Hash 0x6A0184E904CDF25E
Return Type void
Build 1207
Parameters statId (Any*), amount (int)

Description: Increments an integer stat by the supplied amount. statId is not a raw stat hash; it is a stat-id buffer/struct in the same format used by STAT_ID_IS_VALID. In common usage this is an 8-byte buffer with the stat hash written as int32 at offset 0 and 0 written as int32 at offset 4. Use this for counter-style stats, for example incrementing FISH_ESCAPED by 1. The first argument is not a plain integer stat hash; it is a stat-id buffer.

Usage

Lua (Direct):

StatIdIncrementInt(statId, amount)

Lua (Hash):

Citizen.InvokeNative(0x6A0184E904CDF25E, statId, amount)

Examples

local function createStatIdBuffer(statHash)
    local view = DataView.ArrayBuffer(8)
    view:SetInt32(0, statHash, true)
    view:SetInt32(4, 0, true)
    return view
end

local statId = createStatIdBuffer(GetHashKey("FISH_ESCAPED"))
Citizen.InvokeNative(0x6A0184E904CDF25E, statId:Buffer(), 1)
Back to STATS