Koja Scripts

Database

The koja_spawnselector table: last location and remembered choice per character, and the framework position fallback.

Database

Koja Spawn Selector uses one table. It is created when the resource starts; sql/koja_spawnselector.sql has the same statement if you prefer to import it.

sql/koja_spawnselector.sql
CREATE TABLE IF NOT EXISTS `koja_spawnselector` (
    `identifier` VARCHAR(80) NOT NULL,
    `x` FLOAT NOT NULL DEFAULT 0,
    `y` FLOAT NOT NULL DEFAULT 0,
    `z` FLOAT NOT NULL DEFAULT 0,
    `heading` FLOAT NOT NULL DEFAULT 0,
    `last_choice` VARCHAR(80) NULL DEFAULT NULL,
    `updated_at` INT NOT NULL DEFAULT 0,
    PRIMARY KEY (`identifier`)
);
ColumnWhat it holds
identifierCharacter identifier from koja-lib: ESX identifier (with the char1: prefix on multicharacter), QBCore citizenid
x, y, z, headingLast saved position
last_choiceId of the location picked last time, for Config.Open.RememberChoice
updated_atUnix time of the last position save; 0 = no position yet

Framework fallback

A character without a saved position (first start after installing) gets "Last location" from the framework when Config.LastLocation.FrameworkFallback is on:

FrameworkRead from
ESXusers.position
QBCore / QBoxplayers.position

Nothing is ever written to the framework tables.

Resetting

-- one character
DELETE FROM `koja_spawnselector` WHERE `identifier` = 'char1:abc123';
-- everyone back to the default view
TRUNCATE `koja_spawnselector`;