Koja Scripts

Features

What Koja Spawn Selector does: 3D map with time and weather, live preview, routes, favourites and search, locks, last location, vehicles, sounds, camera flight and integrations.

Features

The 3D map

The map is the same 3D layer as the Koja Dispatcher: GTA V radar tiles with level of detail, terrain from the in-game heightmap and extruded buildings, graded in the warm Koja Appearance colours. Up close it streams sharper tiles from the Rockstar map CDN (Config.Map.OnlineDetail).

ControlAction
Left dragMove the map
Right dragRotate and tilt the camera
ScrollZoom at the cursor
+ / − / crosshair (right dock)Zoom in, zoom out, back to the selected spot
Click a pinSelect it. Click the selected pin again to spawn

When the map opens, the camera starts high above the island and glides down to the preselected spot. A pulsing ring and a light beam in the accent colour mark the selected location.

Time and weather

The map follows the server: it gets darker and bluer at night, warm at dusk, grey and foggy in bad weather, and shows rain or snow falling (Config.Map.ShowWorld). The badge in the top right shows the game time and the weather.

Route from the last location

When the player has a last location, the map draws the road route from there to the selected spot with its length ("1.8 km from last location"). It uses the koja-dispatch road graph (data/roads.json) and an A* search on the server (Config.Roads).

Blips

Spawns can use GTA blip icons (blip = 'radar_police_station'), and game blips of the sprites in Config.Map.GameBlips.Sprites (police stations, hospitals, shops...) are shown on the map for orientation.

Live view

Live view on the location card (or the V key) swaps the 3D map for the game itself: a scripted camera circles the selected spot and fills the whole area next to the panel, so the player sees the real place — the time of day, the weather, the cars and people there. Browsing the list moves the camera to the next spot; Back to map (or V again) returns to the map. Turn it off or tune the camera in Config.LivePreview (Distance, Height, Fov, Orbit degrees per second).

The location panel

  • Header — position in the list (03 / 08) and the server name.
  • Banners — why the list is restricted (jail, hospital) or why the last location is locked.
  • Card — the photo from the editor or the map around the spot, category, description, street, how long ago the last location was saved, the time left of an event, "With vehicle" and the Live view button.
  • Search — filters by name, description, street and zone.
  • Favourites — the star on each row; favourites are listed first and get their own toolbar filter. Saved on the player's PC.
  • List — every location grouped by category. Locked spots show a lock and their label ("Police only").
  • Toolbar — at the top of the map, filters the list and the pins by category.
  • Footer — Spawn here, and an exit button when cancelling is allowed.
KeyAction
↑ / ↓ or W / S, mouse wheel over the listBrowse
EnterSpawn at the selected spot
VLive view on / off
EscClose, when cancelling is allowed
+ / -Zoom

Locks

Locks are decided on the server when the list is built:

  1. jobs (with minimum grade and onDuty)
  2. gangs
  3. ace
  4. ServerEditable.CanAccess
  5. Every check added with AddAccessCheck
  6. Restrictions and last location rules

The first one that says no locks the spot, and its reason becomes the label. When the player confirms, the server looks the spot up in the list it sent and refuses locked or unknown ids, so a modified UI cannot spawn anywhere else.

Last location

The position of every spawned player is saved every SaveInterval seconds, on logout, on disconnect and when the resource stops. Positions in a routing bucket other than 0 are skipped when IgnoreBuckets is on. Tracking starts only after the player landed. Combat logouts and deaths lock it — see Anti combat log.

Spawn in a vehicle

A spawn with vehicle = 'sultan' (or { model, plate, props, fuel, keys }) puts the player in the driver seat. The vehicle is created when the camera reaches the street, the last camera move frames the car, keys are given through koja-lib and fuel is set. ClientEditable.OnVehicleSpawned runs afterwards.

Sounds

All sounds are synthesised in the browser, so there are no audio files: a soft ambient pad while the selector is open, ticks when browsing, a chime on confirm and a whoosh for the flight. Config.Sound sets the volume, turns the ambient off, or plays your own Music URL instead.

The camera flight

  1. The ped is placed and frozen, streaming starts around the spot.
  2. A top-down shot from Height metres.
  3. A descent to a shot behind and above the ped.
  4. The game waits for collision and the scene (up to LoadTimeout), then the ped (and vehicle) appears.
  5. A last move over the shoulder and a blend into the gameplay camera.

A letterbox and a "Spawning into" card are shown over the flight. Set Config.Cinematic.Enabled = false or cinematic = false on a spawn for a plain fade.

Integrations

WithWhat happens
ESXOpens on esx:playerLoaded. New characters skip it unless Config.NewCharacter.UseSelector is on
QBCore / QBox (qb-multicharacter)Replaces qb-spawn. New characters with qb-apartments pick a starter apartment
Koja MulticharacterOpens this map after character selection
HousingOwned properties are listed under Property for qb-houses, qs-housing, ps-housing, esx_property (database table or the properties.json of version 1.13 / 2.0), nolag_properties and bcs_housing (Config.Housing)
Jail / ambulanceQB injail / isdead, ESX users.jail_time, users.jail, users.is_dead
screenshot-basicPhotos in the location editor
No locations at allThe player gets a message and spawns at Config.Fallback