vehicleRespawnRequest
Asks your gamemode before one of its vehicles (vehicles.create) goes back to
where you created it: 10 seconds after it is destroyed, or respawnDelaySeconds after it was left empty.
Renamed in 0.28 from vehicleRespawn; see renamed names.
Signature
Section titled “Signature”server.on("vehicleRespawnRequest", ({ vehicleId, isWrecked }) => boolean | void | Promise<boolean | void>)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
vehicleId |
number |
The vehicle’s ID. |
isWrecked |
boolean |
true when it is destroyed; false when it was left empty. |
Returns
Section titled “Returns”false keeps it where it is; you are asked again after the same delay. Anything else puts it back. See how decisions work.
Example
Section titled “Example”Keep wrecks where they burnt out until your tow job clears them.
import { server } from "nativemp";
const towed = new Set<number>();server.on("vehicleRespawnRequest", ({ vehicleId, isWrecked }) => { if (isWrecked && !towed.has(vehicleId)) return false;});Related
Section titled “Related”vehicles.create:respawnDelaySecondsvehicles.respawn: put it back yourself