PlayerClient1 output

getPlayerTargetEntity

GET_PLAYER_TARGET_ENTITY0x13EDE1A5DBF797C9

The GTA V native GET_PLAYER_TARGET_ENTITY of the PLAYER namespace, as LS:MP client scripts call it: the global function getPlayerTargetEntity, in JavaScript and in Lua.

SignatureJavaScript
getPlayerTargetEntity(player: Player): [ok: boolean, entity: Entity]
SignatureLua
getPlayerTargetEntity(player: Player): boolean, Entity

Usage

JavaScript
const [ok, entity] = getPlayerTargetEntity(player);
Lua
local ok, entity = getPlayerTargetEntity(player)

Parameters

ParameterTypeJavaScriptLua
playerPlayernumberinteger

Returns

2 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1okBOOLbooleanbooleanThe native’s own return value.
2entityEntitynumberintegeroutput

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Assigns the handle of locked-on melee target to *entity that you pass it.
Returns false if no entity found.

Reference

Namespace
Player PLAYER
In the game
BOOL GET_PLAYER_TARGET_ENTITY(Player player, Entity* entity)
Hash
0x13EDE1A5DBF797C9

Open in the interactive natives reference