OnPlayerBeginConnect

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

This type of event is used for handling code at client connection initiation with the server, this event happens before onPlayerConnected

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.onPlayerBeginConnect += OnPlayerBeginConnectHandler;
   }

Usage example(s)

   private void OnPlayerBeginConnectHandler(Client player, CancelEventArgs e)
   {
      API.sendChatMessageToAll(player.name + " has joined the server.");
   }

Warnings

Do not use setEntityData or similar functions in this event as the entity is not yet created.

References