STG ScriptsDocumentation
Multicharacter

Configuration

Every option in STG Multicharacter config.lua, housing.lua and server_config.lua, from slots, unlock keys and Tebex to spawn, clothing systems, starter items and hooks.

The settings live in three files in stg-multicharacter/config/:

  • config.lua: everything below except housing and Tebex.
  • housing.lua: what happens after a character is chosen or created.
  • server_config.lua: your Tebex secret. It only loads on the server, so players never receive it.

All three files stay editable in the escrow version. Restart the resource after a change.

Language

Config.Language = 'en'

Available: en, de, fr, es, pt, it, nl, pl, sv, no, fi, ar, he, jp, zh. To change a text, edit the matching file in stg-multicharacter/locales/. Server messages are at the top of each file, the screen texts are in its web table.

Theme

Config.Theme = "light"

light or dark. Changes the menu colors and the background screen behind the character.

Character slots

Config.MaxCharacters = 4
Config.FreeSlotAmount = 2

Prop

Type

A player can unlock at most MaxCharacters - FreeSlotAmount extra slots. Unlocked slots belong to the player's Rockstar license, so they are shared by all of their characters. To give everyone the same number of slots with nothing to unlock, set both values to the same number.

Extra slots

Players unlock a locked slot by typing a code in the KEY field and pressing UNLOCK. Each code unlocks one slot. Two kinds of code are accepted.

Unlock keys

Run these commands in the server console (they do nothing in game):

CommandWhat it does
generateKey [amount]Creates 1 to 100 random 8 character keys, saves them in stg_multicharacter_keys and prints them. Without an amount, it makes one key.
listKeysPrints every key that has not been used yet.

A key is deleted from the database as soon as it is used, so it works once. Hand keys out yourself, for example as giveaway prizes.

Tebex

ServerConfig.Tebex = {
    Enabled = true,
    Secret = "SECRET_KEY",
    PackageId = 0000000
}

Prop

Type

When a player enters a transaction ID, the server checks the payment with Tebex using your secret. If the first package of the payment is the one set in PackageId, the slot is unlocked and the transaction ID cannot be used again.

Nationality

Config.DefaultCountry = 'UNITED STATES'

Shown as the nationality in the character details when a character has no nationality saved. ESX does not store a nationality, so on ESX every character shows this value.

ESX prefix

Config.prefixForESX = "char"

The identifier prefix for ESX characters is fixed to char (char1:<license>, char2:<license>, and so on), the same as esx_multicharacter. Leave this line as it is.

First spawn

Config.FirstSpawn = {x = -1035.71, y = -2731.87, z = 12.86, w = 0.0}

Where new characters appear, by default at the airport arrivals. Existing characters also spawn here when no saved position is found. w is the heading.

How players spawn

After a character is chosen or created, the script hands the player over to your spawn or housing script when one is running:

QBCoreQBOXESX
Existing characterps-housing spawn menu, else qb-spawn, else last positionps-housing spawn menu, else qbx_spawn, else last positionLast position
New characterps-housing spawn menu, else Config.FirstSpawnps-housing spawn menu, else Config.FirstSpawnConfig.FirstSpawn

Housing

The housing hand-off lives in config/housing.lua:

Config.Housing.OnCharacterLoaded = function(src, charData)
    if GetResourceState('ps-housing') == 'started' then
        TriggerClientEvent('ps-housing:client:setupSpawnUI', src, charData)
        return true
    end
    return false
end

Config.Housing.OnCharacterCreated = function(src, charData)
    -- ps-housing, then qb-apartments
end

Config.Housing.OnCharacterSpawned = function()
    -- resets the "inside a house" metadata of ps-housing or qb-apartments
end

Prop

Type

To use another housing script, replace the event names with the ones it expects.

Starter items

Config.StarterItems = {
    { item = "bread", amount = 5 },
    { item = "water", amount = 5 },
    { item = "coffee", amount = 5 },
    { item = "sandwich", amount = 5 },
}

Given to every new character 2 seconds after it is created. Each item must exist in your inventory. Leave the table empty to give nothing.

Character hooks

Config.OnCharacterCreated = function(source, identifier, characterData)
    local Player = exports['stg_lib']:getPlayer(source)
    if Player then
        Player.stg_addMoney('cash', 5000)
        Player.stg_addMoney('bank', 25000)
    end
end

Config.OnCharacterLoaded = function(source, identifier, characterData)
end

Both run on the server and are empty by default. The example above gives new characters starting money.

Prop

Type

Clothing system

Config.SkinSystem = 'auto'

Config.SkinAutoDetect = {
    '0r-clothingv2',
    'rcore_clothing',
    'illenium-appearance',
    'fivem-appearance',
    'skinchanger',
    'esx_skin',
}

Prop

Type

How the clothing script is used:

  • Saved looks: on QBOX and ESX, the character's saved look is applied with the matching function in Config.SkinSystems after the character loads. On QBCore, your clothing script loads it by itself.
  • New characters on QBCore and QBOX: the script fires qb-clothes:client:CreateFirstCharacter, which opens the creator of qb-clothing or illenium-appearance.
  • New characters on ESX: the menu in Config.SkinMenus for the detected system opens (esx_skin, skinchanger, rcore_clothing or 0r-clothingv2). When it closes, the look is saved to the character. If the detected system has no entry there, the default freemode look is saved.
  • Character preview: the 3D preview on the selection screen supports rcore_clothing, qb-clothing, qb-appearance, fivem-appearance, illenium-appearance and ESX skinchanger data.
Config.SkinSystems = {
    ['illenium-appearance'] = function(skin, playerPed)
        exports['illenium-appearance']:setPedAppearance(playerPed, skin)
    end,
    -- ...
}

Config.SkinMenus = {
    ['esx_skin'] = function(callback)
        TriggerEvent('esx_skin:openSaveableMenu', function(data)
            if callback then callback(data) end
        end, true)
    end,
    -- ...
}

To support another clothing script, add an entry with its resource name to both tables and to Config.SkinAutoDetect. A SkinMenus entry must call callback with a value when the player finishes, so the look gets saved.

Notifications

Config.Notify = function(type, message)
    lib.notify({
        title = "Multicharacter",
        description = message,
        type = type,
        duration = 5000,
        position = 'center-right'
    })
end

Replace the body to use your own notification system. type is success, error or info.

Debug

Config.Debug = false

Prints loading, slot and spawn steps to the console. Leave it off on a live server.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page