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

This type of event is used for handling code when the player exits any type of vehicle.


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.onPlayerExitVehicle += OnPlayerExitVehicleHandler;

Usage example(s)

Before we start, myAwesomeVeh variable is of NetHandle type defined somewhere in the script, if missing, it will output an error

   private void OnPlayerExitVehicleHandler(Client player, NetHandle vehicle, int fromSeat)
      if (vehicle == myAwesomeVeh)
         API.sendChatMessageToPlayer(player, "You've left that awesome vehicle!");


API.onPlayerExitVehicle.connect(function(veh, fromSeat) {
    // do things..