Skip to content

Spawn Points & Bays

Spawn Points & Bays

BUPA Rental's spawning is built around one goal: rented cars should appear in believable parking bays, one per bay, and never on top of each other. This page explains exactly how that works and how to configure it.

Parking bays

Config.SpawnPoints is a list of vector4 bays (position + heading). Add as many as you like — the more you add, the more simultaneous rentals your lot can absorb.

config.lua
Config.SpawnPoints = {
    vector4(-17.9, -1090.6, 26.7, 71.0),
    vector4(-21.7, -1088.3, 26.7, 71.0),
    vector4(-25.6, -1085.9, 26.7, 71.0),
}

Free-bay selection

When a rental is confirmed, the server claims the first bay that isn't currently held and assigns it to that rental. The exact bay is sent to the client, which spawns the car there. A local proximity check is kept only as a fallback for older payloads.

The order of operations matters for fairness:

  1. The server reserves a free bay before charging.
  2. Only then is the player's money taken.
  3. If no bay is free, the request returns err_no_spawn and no money is charged.

If players report "no free spawn" errors during busy periods, add more entries to Config.SpawnPoints. A full lot refuses new rentals rather than stacking cars — this is by design.

Bay holds — why cars never overlap

After a car spawns in a bay, that bay is held for a short window so the next rental takes a different one, giving the renter time to walk over and drive off before the bay recycles.

config.lua
-- A bay is reserved after a car spawns there, then frees automatically after
-- this many seconds. If every bay is held, the rental is refused (no charge).
Config.SpawnHoldSeconds = 60

The hold is released automatically after Config.SpawnHoldSeconds, and also immediately when that rental ends (returned or expired), freeing the bay for reuse.

Walk-to-car routing

Rather than teleporting the player into the seat, the car is left in its bay and the player collects it on foot.

config.lua
-- Draw a GPS route + blip to the freshly spawned car so the renter can find it.
Config.RouteToSpawnedCar = true

With this enabled, a route blip is attached to the spawned vehicle. The client watches the player's distance and removes the blip once they get within a few metres of the car (or after a safety timeout), so the map never keeps a stale route.

Return points

Drop-off locations are separate from spawn bays:

config.lua
Config.ReturnPoints = {
    vector4(-30.0, -1083.0, 26.7, 71.0),
}
Config.ReturnDistance = 4.0   -- how close the player must be to return here

Keep spawn and return areas close together so the lot reads as a single rental depot, but give returns their own coordinates so drop-offs don't collide with fresh spawns.