PlayerEnterVehicle: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 15: Line 15:
   const vehicleID = vehicle.id;
   const vehicleID = vehicle.id;


   mp.players.broadcast(`${playerName} got into the car with ID: ${vehicleID}`);
   mp.players.broadcast(`${playerName} got into the car with ID: ${vehicleID}. Seat: ${seat}`);
}
}



Revision as of 21:51, 18 December 2017

This event is triggered when a player is in the car.

Parameters

  • player - player, which sits down.
  • vehicle - vehicle in which the player sits.
  • seat - the place where he sits down.

Example

This example outputs chat message, when player is in the car.

Server-Side
function playerEnterVehicleHandler(player, vehicle, seat) {
   const playerName = player.name;
   const vehicleID = vehicle.id;

   mp.players.broadcast(`${playerName} got into the car with ID: ${vehicleID}. Seat: ${seat}`);
}

mp.events.add("playerEnterVehicle", playerEnterVehicleHandler);

See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint