GetEntityFromHandle

From GTA Network Wiki
Jump to: navigation, search

GetEntityFromHandle
Server-Side Function

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

Gets an Entity object from the given NetHandle. For example, you can use this to get a Vehicle object from a NetHandle.

Syntax

T NAPI.Entity.GetEntityFromHandle<T>(NetHandle handle);

Required Arguments

  • handle: parameter input should be in NetHandle type.

NOTE: This function returns data in T type, which can for example be a Vehicle or Client.

Entity types

Vehicle
Client
Object
Blip
Pickup
TextLabel
Ped
ParticleEffect
Marker

Usage example(s)

Vehicle veh = NAPI.Entity.GetEntityFromHandle<Vehicle>(someHandle);
if (veh == null) {
  // The handle was not a vehicle!
} else {
  veh.primaryColor = 16;
}

Changelog

Version Description
1.0 Release.

References