SetPlayerIntoVehicle

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

Places a player into the given vehicle and seat.


Syntax

In C#
Server-Side Function

API.setPlayerIntoVehicle(Client player, NetHandle vehicle, int seat);
Icon-info.png
In case you want to set a player directly into the vehicle after creating it with API.createVehicle() you will have to use waitForSynchronization() to make sure it's known for the client. (Version 0.1.7)


  • player: The player to place into the vehicle. Parameter input should be in Client type.
  • vehicle: The vehicle to place the player in. Parameter input should be in NetHandle type.
  • seat: The seat ID. Use -1 for driver seat and 0+ for passenger seats. Parameter input should be in int type.

In Javascript
Client-Side Function

API.setPlayerIntoVehicle(LocalHandle vehicle, int seat);
  • vehicle: The vehicle to place the player in. Parameter input should be in NetHandle type.
  • seat: The seat ID. Use -1 for driver seat and 0+ for passenger seats. Parameter input should be in int type.

Usage example(s)

This will set the player into the driver seat of the hVehicle NetHandle:

In C#
Server-Side Function

API.setPlayerIntoVehicle(player, hVehicle, -1);


References