RedM Natives

GET_RESOURCE_BY_FIND_INDEX

Hash0x387246B7
Runtime nameGetResourceByFindIndex
NamespaceCFX
SideClient + server
NameOfficial
Docs

Signature

char* GET_RESOURCE_BY_FIND_INDEX(int findIndex);

Parameters

NameTypeDescription
findIndexint

The index of the resource (starting at 0)

Returns char* — The resource name as a `string`

Usage

Lua
local retval = GetResourceByFindIndex(findIndex)

-- always works, by hash
local retval = Citizen.InvokeNative(0x387246b7, findIndex, Citizen.ResultAsString())
JavaScript and C#
JavaScript
const retval = GetResourceByFindIndex(findIndex);

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

Examples

LUA · Cfx.re native reference
local resourceList = {}
for i = 0, GetNumResources(), 1 do
  local resource_name = GetResourceByFindIndex(i)
  if resource_name and GetResourceState(resource_name) == "started" then
    table.insert(resourceList, resource_name)
  end
end
print(table.unpack(resourceList))

Sources

Cfx.re native reference

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