AttachEntityToEntity: Difference between revisions

From RAGE Multiplayer Wiki
(The function AttachEntityToEntity is deprecated on RAGEMP V.0.3.7 or upper version.)
 
Line 1: Line 1:
Attaches an entity to another one. Can later be detached using [[NAPI.Entity.DetachEntity]]
Attaches an entity to another one. Can later be detached using [[NAPI.Entity.DetachEntity]]


{{ServersideCsFunction}}
The function AttachEntityToEntity is deprecated on RAGEMP V.0.3.7 or upper version.
 
 
{{CSharpContainer|
<pre>
NAPI.Entity.AttachEntityToEntity(NetHandle entity, NetHandle entityTarget, string bone, Vector3 positionOffset, Vector3 rotationOffset);
</pre>
 
{{Parameters}}
* '''entity''': The entity you want to attach
* '''entityTarget''': The entity you want to attach to
* '''bone''': The entity bone you want to attach to
* '''positionOffset''': The position offset of the attached entity.
* '''rotationOffset''': The rotation offset of the attached entity.
 
{{Example}}
<pre>
// Get temporary position to create the model.
var position = NAPI.Entity.GetEntityPosition(player);
// Create drug pack model.
var model = NAPI.Object.CreateObject(-1964997422, position, new Vector3()); // Drug package (prop_drug_package_02).
// Attach created model to the player's hand.
NAPI.Entity.AttachEntityToEntity(model, client, "IK_R_Hand", new Vector3(), new Vector3());
</pre>
}}

Latest revision as of 11:35, 11 May 2020

Attaches an entity to another one. Can later be detached using NAPI.Entity.DetachEntity

The function AttachEntityToEntity is deprecated on RAGEMP V.0.3.7 or upper version.