Slots and shop
How many characters each player can create: free slots, VIP by ACE, bonuses by command or Tebex, and the store button on locked slots.
The calculation
Each time the selection opens, a player’s number of slots is:
Config.Slots.Default(1 by default);- plus the bonus of every ACE from
ServerConfig.Slots.Acesthey have; - plus the slots they bought, stored in the database;
- at least the value of
ServerConfig.Slots.Identifiersif they are listed; - at most
Config.Slots.Max(4 by default).
Example: 1 free, VIP (+2) and 1 bought makes 4 slots. With 3 bought, they would still have 4 because of the maximum.
The grid shows Config.Slots.Max cards: characters, free slots, then locked slots.
VIP by ACE permission
By default, the multicharacter.slots.vip ACE gives 2 more slots:
ServerConfig.Slots.Aces = {
['multicharacter.slots.vip'] = 2
}
Grant it to a group in server.cfg:
add_ace group.vip multicharacter.slots.vip allow
add_principal identifier.license:1a2b3c… group.vip
Several tiers are possible, their bonuses add up. A player who loses their group loses the slots at their next selection.
Console command
multichar_slots adds bought slots to a player. It works from the server console, txAdmin, RCON or Tebex, not in game.
multichar_slots 12 1
multichar_slots license:1a2b3c4d5e… 2
multichar_slots 12 0 set
12is the server ID of a connected player. Otherwise, use their Rockstar licence.- The number is added to the current bonus; a negative number removes some.
- With
set, the bonus is replaced (0removes everything).
Tebex delivery
In your Tebex package, add a command run on your server:
multichar_slots {sid} 1
Totals per identifier
ServerConfig.Slots.Identifiers guarantees a minimum to some accounts, for instance staff:
ServerConfig.Slots.Identifiers = {
['license:1a2b3c4d5e…'] = 4,
['discord:123456789012345678'] = 3
}
Every FiveM identifier works: license:, discord:, fivem:, steam:…
From your scripts
exports.mrpoulpi_multicharacter:AddSlots(source, 1)
exports.mrpoulpi_multicharacter:SetSlots('license:1a2b3c…', 0)
local total = exports.mrpoulpi_multicharacter:GetSlots(source)
Details in API and hooks.
Extra characters
A player has 3 characters and drops back to 1 slot (VIP ended, for example):
- with
Config.Slots.LockExcessCharacters = false, their 3 characters stay playable, they just cannot create more; - with
true, the characters on slots 2 and 3 are locked until they get their slots back.
Store button
Every locked slot shows “Visit store”. The button opens a window with the offers of Config.Shop.Packages, then the chosen page in the player’s browser.
Config.Shop = {
Enabled = true,
Url = 'https://my-store.tebex.io',
Packages = {
{
id = 'vip',
title = 'VIP pack',
description = '2 slots included + perks',
icon = 'crown',
url = 'https://my-store.tebex.io/package/1234567'
}
}
}
| Field | Role |
|---|---|
id |
Free identifier. |
title, description |
Offer texts. |
icon |
Icon (see the list). |
url |
Page to open. Without url, it is Config.Shop.Url. |
slot or slots |
Reserves the offer for one slot (slot = 2) or several (slots = { 3, 4 }). |
To offer something different per slot:
Packages = {
{ slot = 2, id = 'slot2', title = 'Second character', description = 'Unlocks slot 2', url = 'https://my-store.tebex.io/package/111' },
{ slots = { 3, 4 }, id = 'slot34', title = 'Family pack', description = 'Unlocks slots 3 and 4', url = 'https://my-store.tebex.io/package/222' },
}
Addresses must start with https://. While the example address votre-boutique.tebex.io is in place, the player sees “Store not configured”. To hide the button: Config.Shop.Enabled = false.