RedM Natives

STAT_ID_SET_FLOAT

Hash0x481BDF6A10C5EF68
Runtime nameStatIdSetFloat
NamespaceSTATS
SideClient
NameOfficial
Docs
Since build1207

Signature

BOOL STAT_ID_SET_FLOAT(Any* statId, float value, BOOL p2);

Parameters

NameTypeDescription
statIdAny*—
valuefloat—
p2BOOL—

Returns BOOL

Description

statId: see STAT_ID_IS_VALID

Usage

Lua
local retval, statId = StatIdSetFloat(value, p2)

-- always works, by hash
local retval, statId = Citizen.InvokeNative(0x481BDF6A10C5EF68, Citizen.PointerValueInt(), value, p2, Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, statId] = StatIdSetFloat(value, p2);

// by hash
const [retval, statId] = Citizen.invokeNative('0x481BDF6A10C5EF68', Citizen.pointerValueInt(), value + 0.0000001, p2, Citizen.returnResultAnyway());
C#
var statId = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0x481BDF6A10C5EF68, statId, value, p2);
// statId.GetResult<int>()
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.
  • 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.

Sources

alloc8or RDR3 NativeDB

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