Koja Scripts

Features

What Koja Multicharacter does: selection scene and cutscenes, character creator, presets, spawn selector, koja-spawnselector integration, spawn protection and relog.

Features

Character selection

The player is moved to a private routing bucket and a scene location from Config.Scene.Locations, with its own time and weather. Each character has a card with a headshot, job and grade, gang (QB), cash and bank, playtime, last played and created date, nationality, height and backstory.

  • Single mode: one character on the mark. Drag to rotate, scroll to zoom.
  • Line-up mode (Config.Scene.Lineup): all characters stand side by side and the camera slides to the selected one.

Cutscenes

  • Opening shot: the camera starts wide and glides in while the first character gestures.
  • Switching: the current character walks out of frame, the next one walks in, plays a gesture (shirt, tie, glasses or thumbs up) and settles into an idle scenario. The camera swings out and back during the switch.

Clicking through characters quickly does not break the scene. Rotating is locked until the character has arrived. Everything is tuned in Config.Scene.Intro and Config.Scene.Transition.

Slots

Every player gets Config.Slots.Default slots. ACE tiers raise that number, and /charslots or the SetSlots / AddSlots exports set a per-account override. Slots above the player's count are shown as locked up to Max, with a link to ShopUrl. On ESX, old esx_multicharacter slot overrides are imported when ImportEsxSlots is on.

Character creator

  1. Identity: first and last name, date of birth, gender, height, nationality and backstory. Every field is validated again on the server.
  2. Appearance: the appearance editor opens with the sections set in Config.Appearance.Menu. With ForceSave it reopens until the player saves.

New characters can start from a saved preset or copy the look of another of their characters.

Deleting

Players delete a character from its card. With Config.Delete.ConfirmName they must type the full name first.

Spawn selector

After selecting a character the player picks where to spawn:

  • Last location (Config.Spawn.LastLocation)
  • Public spots from shared/spawns.lua
  • Job and gang spots, with a minimum grade
  • Spawns from other resources (houses, apartments, motels) through RegisterSpawn or the buildSpawns hook

Each spot can have a cooldown. The sky camera flies over the hovered spot. New characters go to NewCharacterSpawn unless NewCharacterSelector is on.

With koja-spawnselector

When koja-spawnselector runs on the same server and Config.Spawn.UseKojaSpawnSelector is true, its map replaces the built-in spawn screen:

  • Koja Multicharacter still applies the skin, fires the framework spawn events, runs spawn protection and handles the routing bucket.
  • Locations come from the koja-spawnselector config. Spots added with RegisterSpawn are forwarded to the map.
  • beforeSpawn hooks run as access checks, so a location a hook rejects shows as locked.
  • ESC on the map goes back to the character list when AllowBack is on.
  • If koja-spawnselector stops while a player is choosing, the built-in screen opens instead.

Spawn protection

For Config.Spawn.Protection.Duration seconds after spawning the player can be ghosted, invincible, unable to shoot and transparent.

Switching character

/relog sends the player back to the selection without reconnecting. It is blocked:

  • for Config.Relog.Cooldown seconds after spawning
  • for CombatSeconds after dealing or taking damage
  • while dead or in a vehicle (configurable)
  • while another resource blocks it with SetRelogBlocked, for example handcuffs or jail

Admin and logs

Admins can list, lock, unlock and delete characters, set slots and force a relog. See Commands. Create, delete, select and admin actions can be sent to Discord webhooks.

Playtime

Playtime is tracked per character and saved every Config.Playtime.SaveInterval seconds.