RedM Natives

REQUEST_RESOURCE_FILE_SET

Requests a resource file set with the specified name to be downloaded and mounted on top of the current resource.

Hash0xE7490533
Runtime nameRequestResourceFileSet
NamespaceCFX
SideClient
NameOfficial
Docs

Signature

BOOL REQUEST_RESOURCE_FILE_SET(char* setName);

Parameters

NameTypeDescription
setNamechar*

The name of the file set as specified in fxmanifest.lua.

Returns BOOL — `TRUE` if the set is mounted, `FALSE` if the request is still pending.

Description

Cfx.re native reference

Requests a resource file set with the specified name to be downloaded and mounted on top of the current resource.

Resource file sets are specified in fxmanifest.lua with the following syntax:

file_set 'addon_ui' {
    'ui/addon/index.html',
    'ui/addon/**.js',
}

This command will trigger a script error if the request failed.

Usage

Lua
local retval = RequestResourceFileSet(setName)

-- always works, by hash
local retval = Citizen.InvokeNative(0xe7490533, setName, Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const retval = RequestResourceFileSet(setName);

// by hash
const retval = Citizen.invokeNative('0xe7490533', setName, Citizen.returnResultAnyway());
C#
bool retval = Function.Call<bool>((Hash)0xe7490533, setName);

Examples

LUA · Cfx.re native reference
-- fxmanifest.lua
file_set 'dummies' {
    'dummy/**.txt',
    'potato.txt',
}

-- main script
local function PrintTest()
    local tests = { 'potato.txt', 'dummy/1.txt', 'dummy/b/2.txt' }

    for _, v in ipairs(tests) do
        local data = LoadResourceFile(GetCurrentResourceName(), v)
        print(v, data)
    end
end

RegisterCommand('fileset', function()
    PrintTest()

    while not RequestResourceFileSet('dummies') do
        Wait(100)
    end

    PrintTest()
end)

Sources

Cfx.re native reference

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