OnPlayerChangeVehicleSeat

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

This type event is called when a player changes his vehicle seat.

Syntax & Examples

In C#
Server-Side Function

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.onPlayerChangeVehicleSeat+= onPlayerChangeVehicleSeatHandler;
   }

And then you can implement the event function:

   private void onPlayerChangeVehicleSeatHandler(Client player, NetHandle vehicle, int oldSeat, int newSeat)
    {
        API.sendChatMessageToPlayer(player, "Your seat has changed from " + oldSeat + " to: " + newSeat);
    }

In Javascript
Client-Side Function

API.onPlayerChangeVehicleSeat.connect(function(LocalHandle vehicleEntity, int oldSeat, int newSeat) {
    API.sendNotification("Your seat has changed from " + oldSeat + " to: " + newSeat);
});

References