OnEntityEnterColShape

From GT-MP
Jump to: navigation, search
OnEntityEnterColShape
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

This type of event is used for handling code when the player enters a ColShape.

Requirements

First of all, it should be defined in your Main constructor for it to be called, otherwise it wouldn't be initiated at all!

public Main()
{
    API.onEntityEnterColShape += OnEntityEnterColShapeHandler;
}

Usage example(s)

private void OnEntityEnterColShapeHandler(ColShape shape, NetHandle entity)
{
     if (API.getEntityType(entity) == EntityType.Player){
         // It's a Player
         Client player = API.getPlayerFromHandle(entity); // Fetch the Client
         API.sendNotificationToPlayer(player, "You have entered a ColShape");
     }
}

References

SendNotificationToPlayer

GetPlayerFromHandle

GetEntityType