RedM Natives

FIND_FIRST_OBJECT

Hash0xFAA6CB5D
Runtime nameFindFirstObject
NamespaceCFX
SideClient
NameOfficial
Docs

Signature

int FIND_FIRST_OBJECT(Entity* outEntity);

Parameters

NameTypeDescription
outEntityEntity*—

Returns int

Usage

Lua
local retval, outEntity = FindFirstObject(outEntity)

-- always works, by hash
local retval, outEntity = Citizen.InvokeNative(0xfaa6cb5d, Citizen.PointerValueIntInitialized(outEntity), Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const [retval, outEntity] = FindFirstObject(outEntity);

// by hash
const [retval, outEntity] = Citizen.invokeNative('0xfaa6cb5d', Citizen.pointerValueIntInitialized(outEntity), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
var outEntity = new OutputArgument();
int retval = Function.Call<int>((Hash)0xfaa6cb5d, outEntity);
// outEntity.GetResult<int>()
  • The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.

Sources

Cfx.re native reference

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