AttachEntityToEntity

From GTA Network Wiki
Jump to: navigation, search

AttachEntityToEntity
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

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

Syntax

void NAPI.Entity.AttachEntityToEntity(NetHandle entity, NetHandle entityTarget, string bone, Vector3 positionOffset, Vector3 rotationOffset);

Required Arguments

  • entity: parameter input should be in NetHandle type.
  • entityTarget: parameter input should be in NetHandle type.
  • bone: parameter input should be in string type.
  • positionOffset: parameter input should be in Vector3 type.
  • rotationOffset: parameter input should be in Vector3 type.

Usage example(s)

// 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());

Special note: To attach an Entity to an Object, use "0" as the bone value.

Changelog

Version Description
1.0 Release.

References