GetEntityType

From GT-MP
Jump to: navigation, search
GetEntityType
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

This function returns the type of the given NetHandle / LocalHandle.


Syntax

API.getEntityType(NetHandle handle);

Required Arguments

  • handle: parameter input should be in NetHandle type.

NOTE: This function returns data in EntityType type. See Entity Types.

Usage example(s)

// Simple server-side example
EntityType myType = API.getEntityType(myHandle);
if(myType == (EntityType)6)
{
    // type of this nethandle is "player"
    Client user = API.getEntityFromHandle<Client>(myHandle);
    API.sendChatMessageToPlayer(user, "Hey!");
}

References