RedM Natives

SAVE_RESOURCE_FILE

Writes the specified data to a file in the specified resource.

Hash0xA09E7E7B
Runtime nameSaveResourceFile
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

BOOL SAVE_RESOURCE_FILE(char* resourceName, char* fileName, char* data, int dataLength);

Parameters

NameTypeDescription
resourceNamechar*

The name of the resource.

fileNamechar*

The name of the file.

datachar*

The data to write to the file.

dataLengthint

The length of the written data.

Returns BOOL — A value indicating if the write succeeded.

Description

Cfx.re native reference

Writes the specified data to a file in the specified resource. Using a length of -1 will automatically detect the length assuming the data is a C string.

Usage

Lua
local retval = SaveResourceFile(resourceName, fileName, data, dataLength)

-- always works, by hash
local retval = Citizen.InvokeNative(0xa09e7e7b, resourceName, fileName, data, dataLength, Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const retval = SaveResourceFile(resourceName, fileName, data, dataLength);

// by hash
const retval = Citizen.invokeNative('0xa09e7e7b', resourceName, fileName, data, dataLength, Citizen.returnResultAnyway());
C#
bool retval = Function.Call<bool>((Hash)0xa09e7e7b, resourceName, fileName, data, dataLength);

See also

Sources

Cfx.re native reference

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