EntityClient

getEntityOfTypeAttachedToEntity

GET_ENTITY_OF_TYPE_ATTACHED_TO_ENTITY0x1F922734E259BD26

The GTA V native GET_ENTITY_OF_TYPE_ATTACHED_TO_ENTITY of the ENTITY namespace, as LS:MP client scripts call it: the global function getEntityOfTypeAttachedToEntity, in JavaScript and in Lua.

SignatureJavaScript
getEntityOfTypeAttachedToEntity(entity: Entity, modelHash: Hash): Entity
SignatureLua
getEntityOfTypeAttachedToEntity(entity: Entity, modelHash: Hash): Entity

Usage

JavaScript
const result = getEntityOfTypeAttachedToEntity(entity, modelHash);
Lua
local result = getEntityOfTypeAttachedToEntity(entity, modelHash)

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
modelHashHashnumberinteger

Returns

Entity JavaScript number, Lua integer

Game handle of an entity: a ped, a vehicle or an object. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.

Notes

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

Gets the handle of an entity with a specific model hash attached to another entity, such as an object attached to a ped.
This native does not appear to have anything to do with pickups as in scripts it is used with objects.

Example from fm_mission_controller_2020.c:

iVar8 = getEntityOfTypeAttachedToEntity(bParam0->f_9, joaat("p_cs_clipboard"));

Reference

Namespace
Entity ENTITY
In the game
Entity GET_ENTITY_OF_TYPE_ATTACHED_TO_ENTITY(Entity entity, Hash modelHash)
Hash
0x1F922734E259BD26
Introduced
Game build 1180 legacy numbering
Formerly
_GET_ENTITY_ATTACHED_TO_WITH_HASH

Open in the interactive natives reference