RedM Natives

LOAD_RESOURCE_FILE

Reads the contents of a text file in a specified resource.

Hash0x76A9EE1F
Runtime nameLoadResourceFile
NamespaceCFX
SideClient + server
NameOfficial
Docs

Signature

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

Parameters

NameTypeDescription
resourceNamechar*

The resource name.

fileNamechar*

The file in the resource.

Returns char* — The file contents

Description

Cfx.re native reference

Reads the contents of a text file in a specified resource. If executed on the client, this file has to be included in files in the resource manifest. Example: local data = LoadResourceFile("devtools", "data.json")

Usage

Lua
local retval = LoadResourceFile(resourceName, fileName)

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

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

See also

Sources

Cfx.re native reference

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