Player::putIntoVehicle

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function puts player into vehicle.

Syntax

player.putIntoVehicle(Vehicle vehicle, Number seat)

Seats:

  • -1 - driver seat
  • 0 - passenger seat 1
  • 1 - passenger seat 2
  • 2 - passenger seat 3

In version >1.0 Seats:

  • 0 - driver seat
  • 1 - passenger seat 1
  • 2 - passenger seat 2
  • 3 - passenger seat 3

Examples

Server-Side
// 0.3.7
mp.events.addCommand('veh', (player, vehicle = "T20") => {
  const veh = mp.vehicles.new(mp.joaat(vehicle), player.position, {
    dimension: player.dimension
  });
  player.putIntoVehicle(veh, -1);
});

// 1.0 +
mp.events.addCommand('veh', (player, vehicle = "T20") => {
  const veh = mp.vehicles.new(mp.joaat(vehicle), player.position, {
    dimension: player.dimension
  });
  player.putIntoVehicle(veh, 0);
});

See Also