playerExitedVehicle
Tells your gamemode that a player got out of a vehicle.
Coming from SA-MP or open.mp: OnPlayerExitVehicle comes when a player starts to get out; this event comes once
they are out. OnPlayerEnterVehicle is playerEnterVehicleRequest.
Renamed in 0.28 from exitVehicle; see renamed names.
Moving the player out with players.setPosition, or into another vehicle
with players.putInVehicle, sends it too, before the new entry. With
setPosition’s includeVehicle the player stays in the vehicle and nothing is sent.
Signature
Section titled “Signature”server.on("playerExitedVehicle", ({ player, vehicleId, seat }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player. |
vehicleId |
number |
The vehicle. |
seat |
number |
0 for the driver’s seat, 1 to 3 passenger seats. |
Example
Section titled “Example”import { chat, server } from "nativemp";
server.on("playerExitedVehicle", ({ player, seat }) => { chat.sendServerMessage(seat === 0 ? "Out of the driver seat." : "Thanks for riding.", player);});Related
Section titled “Related”playerEnterVehicleRequest: deny getting inplayerChangedVehicleSeat: moving seatsplayerEnteredVehicle: the other way