RedM Natives

GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH

Gets the number of instances of the specified script is currently running.

Hash0x8E34C953364A76DD
Runtime nameGetNumberOfThreadsRunningTheScriptWithThisHash
NamespaceSCRIPT
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x2C83A9DA6BFFC4F9

Signature

int GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(Hash scriptHash);

Parameters

NameTypeDescription
scriptHashHash—

Returns int

Description

Gets the number of instances of the specified script is currently running.

Actually returns numRefs - 1.
if (program)
v3 = rage::scrProgram::GetNumRefs(program) - 1;
return v3;

Old name: _GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH

Usage

Lua
local retval = GetNumberOfThreadsRunningTheScriptWithThisHash(scriptHash)

-- always works, by hash
local retval = Citizen.InvokeNative(0x8E34C953364A76DD, scriptHash, Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const retval = GetNumberOfThreadsRunningTheScriptWithThisHash(scriptHash);

// by hash
const retval = Citizen.invokeNative('0x8E34C953364A76DD', scriptHash, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
int retval = Function.Call<int>((Hash)0x8E34C953364A76DD, scriptHash);
  • Hash parameters: the named function also accepts a string and hashes it for you; Citizen.InvokeNative needs the number — pass joaat("name") or a backtick literal like `name`.

Sources

alloc8or RDR3 NativeDB

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