RedM Natives

GET_PLAYER_TARGET_ENTITY

Hash0xAE663DDD99C8A670
Runtime nameGetPlayerTargetEntity
NamespacePLAYER
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x13EDE1A5DBF797C9

Signature

BOOL GET_PLAYER_TARGET_ENTITY(Player player, Entity* entity);

Parameters

NameTypeDescription
playerPlayer—
entityEntity*—

Returns BOOL

Usage

Lua
local retval, entity = GetPlayerTargetEntity(player, entity)

-- always works, by hash
local retval, entity = Citizen.InvokeNative(0xAE663DDD99C8A670, player, Citizen.PointerValueIntInitialized(entity), Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, entity] = GetPlayerTargetEntity(player, entity);

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

Sources

alloc8or RDR3 NativeDB

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