Skip to content

carGeneratorSpawnRequest

Asks your gamemode before the server brings one of the story’s parked vehicles: the cars, bikes, boats and planes GTA:SA’s story parks around the map (its car generators), 182 spots, as a finished story has them. Allowed, the game of the player nearest the spot makes the vehicle, and every player sees it. Once a player takes it, by driving it or moving it off its spot, the vehicle is theirs to keep. A minute later the server asks again for a new one.

Renamed in 0.28 from carGeneratorSpawn; see renamed names.

server.on("carGeneratorSpawnRequest", ({ generatorIndex, vehicleModel, position, facingAngleDegrees, isRespawn }) =>
boolean | { vehicleModel: number } | void | Promise<boolean | { vehicleModel: number } | void>)
Name Type Description
generatorIndex number The spot, 0 to 181: its place in the server’s table.
vehicleModel number The vehicle the story parks there (a vehicle model, 400 to 611), or -1: any car the making player’s game has loaded, the game’s own rule.
position Vector3 The spot as the story gives it. The vehicle stands on the ground below it, a boat on the water.
facingAngleDegrees number The direction it faces, in degrees.
isRespawn boolean true when a player took the last one; false the first time.

false keeps the spot empty for now; the server asks again a minute later. { vehicleModel } with a vehicle model from 400 to 611 makes that vehicle instead. Anything else makes the story’s vehicle. See how decisions work.

No airliner at the airports, and a Rustler where the Hydra stands.

gamemodes/my-mode.ts
import { server } from "nativemp";
server.on("carGeneratorSpawnRequest", ({ vehicleModel }) => {
if (vehicleModel === 577) return false; // AT-400
if (vehicleModel === 520) return { vehicleModel: 476 }; // Hydra -> Rustler
});