GetEntityFromHandle

From GT-MP
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

API.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 = API.getEntityFromHandle<Vehicle>(someHandle);
if (veh == null) {
  // The handle was not a vehicle!
} else {
  veh.primaryColor = 16;
}

Changelog

Version Description
1.0 Release.


References