PlayerEnterVehicle: Difference between revisions
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
* '''player''' - player, which sits down. | * '''player''' - player, which sits down. | ||
* '''vehicle''' - vehicle in which the player sits. | * '''vehicle''' - vehicle in which the player sits. | ||
* '''seat''' - the place where he sits down. | |||
==Example== | ==Example== | ||
| Line 10: | Line 11: | ||
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | <div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div> | ||
<syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;"> | <syntaxhighlight lang="javascript" style="width: 98%; background-color: #E4F1FE;"> | ||
function playerEnterVehicleHandler(player, vehicle) { | function playerEnterVehicleHandler(player, vehicle, seat) { | ||
const playerName = player.name; | const playerName = player.name; | ||
const vehicleID = vehicle.id; | const vehicleID = vehicle.id; | ||
Revision as of 21:46, 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}`);
}
mp.events.add("playerEnterVehicle", playerEnterVehicleHandler);
See also
Checkpoint
Colshape
Entity
Player
- playerChat
- playerCommand
- playerDamage
- playerDeath
- playerJoin
- playerQuit
- playerReady
- playerSpawn
- playerWeaponChange
Streaming
Vehicle
- playerStartEnterVehicle
- playerEnterVehicle
- playerStartExitVehicle
- playerExitVehicle
- trailerAttached
- vehicleDamage
- vehicleDeath
- vehicleHornToggle
- vehicleSirenToggle