RedM Natives

_STAT_ID_INCREMENT_INT

Increments an integer stat by the supplied amount.

Hash0x6A0184E904CDF25E
Runtime nameStatIdIncrementInt
NamespaceSTATS
SideClient
NameCommunity guess
Docs
Since build1207

Signature

void _STAT_ID_INCREMENT_INT(Any* statId, int value);

Parameters

NameTypeDescription
statIdAny*—
valueint—

Returns void

Description

VORPCORE RDR3natives

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
local statId = StatIdIncrementInt(value)

-- always works, by hash
local statId = Citizen.InvokeNative(0x6A0184E904CDF25E, Citizen.PointerValueInt(), value)
JavaScript and C#
JavaScript
const statId = StatIdIncrementInt(value);

// by hash
const statId = Citizen.invokeNative('0x6A0184E904CDF25E', Citizen.pointerValueInt(), value);
C#
var statId = new OutputArgument();
Function.Call((Hash)0x6A0184E904CDF25E, statId, value);
// statId.GetResult<int>()
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
  • Any* arguments are often structs. Build them with a DataView buffer and pass it with :Buffer() — see the examples and notes below.
  • The name is a community guess and may change. If the named call is missing in your client build, use InvokeNative with the hash — it always works.

Examples

LUA · VORPCORE RDR3natives
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)

Sources

alloc8or RDR3 NativeDB · VORPCORE RDR3natives

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.