PlayerEnterVehicle: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(Made example look cooler)
Line 8: Line 8:
==Example==
==Example==
This example outputs chat message, when player get into vehicle.
This example outputs chat message, when player get into vehicle.
<div class="header" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0;">
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
<div style="margin: 4px 0px 4px 10px;"><b>Server-side</b></div>
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
</div>
<div class="content" style="background-color: #E4F1FE; color: #4183D7; width: 100%; border: 2px solid #81CFE0; display: flex; justify-content: center; align-items: center;">
<syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;">
<syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;">
function playerEnterVehicleHandler(player, vehicle, seat) {
function playerEnterVehicleHandler(player, vehicle, seat) {

Revision as of 19:56, 18 September 2017

This event is triggered when a player started get into vehicle.

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 get into vehicle.

Server-Side
function playerEnterVehicleHandler(player, vehicle, seat) {
   const playerName = player.name
   const vehicleID = vehicle.id
   const srt = playerName + " tarted to get into the car ID: " + vehicleID + " Seat: " + seat
   mp.players.broadcast(str)
}

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

See also