playerCarjackRequest
Asks your gamemode when a player is at the driver’s door of a car another player drives.
Renamed in 0.28 from jackRequest; see renamed names.
Signature
Section titled “Signature”server.on("playerCarjackRequest", ({ player, driver, vehicleId }) => boolean | void | Promise<boolean | void>)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player at the door. |
driver |
PlayerSnapshot or null |
The driver. |
vehicleId |
number |
The vehicle. |
Returns
Section titled “Returns”false keeps the driver in. Anything else lets the player pull them out. The first false stops the handlers after
it. See how decisions work.
Example
Section titled “Example”Only police may jack.
import { server } from "nativemp";
const police = new Set<number>();server.on("playerCarjackRequest", ({ player }) => police.has(player.id));Related
Section titled “Related”playerEnterVehicleRequest: getting into a car with an NPC driver or none