RedM Natives

REGISTER_RESOURCE_ASSET

Registers a cached resource asset with the resource system, similar to the automatic scanning of the stream/ folder.

Hash0x9862B266
Runtime nameRegisterResourceAsset
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

char* REGISTER_RESOURCE_ASSET(char* resourceName, char* fileName);

Parameters

NameTypeDescription
resourceNamechar*

The resource to add the asset to.

fileNamechar*

A file name in the resource.

Returns char* — A cache string to pass to `REGISTER_STREAMING_FILE_FROM_CACHE` on the client.

Description

Cfx.re native reference

Experimental: This native may be altered or removed in future versions of CitizenFX without warning.

Registers a cached resource asset with the resource system, similar to the automatic scanning of the stream/ folder.

Usage

Lua
local retval = RegisterResourceAsset(resourceName, fileName)

-- always works, by hash
local retval = Citizen.InvokeNative(0x9862b266, resourceName, fileName, Citizen.ResultAsString())
JavaScript and C#
JavaScript
const retval = RegisterResourceAsset(resourceName, fileName);

// by hash
const retval = Citizen.invokeNative('0x9862b266', resourceName, fileName, Citizen.returnResultAnyway(), Citizen.resultAsString());
C#
string retval = Function.Call<string>((Hash)0x9862b266, resourceName, fileName);

Sources

Cfx.re native reference

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