Skip to content

Character Slotes

Configure how players receive additional character slots through Discord roles, Tebex purchases, or custom licenses.

๐Ÿ“Š Slot Calculation#

A player's total slots are calculated as:

text
Total Slots = Default + Database + Discord + Custom License
SourceDescription
DefaultConfig.DefaultCharacterSlots value
DatabaseSlots stored in 0r_multicharacterv3 table
DiscordBonus slots from Discord roles
Custom LicenseBonus slots from specific license IDs

๐Ÿ”ข Default Slots#

Set the base slot count for all players:

lua
Config.DefaultCharacterSlots = 1  -- Everyone starts with 1 slot

๐ŸŽฎ Discord Role Slots#

Grant bonus slots based on Discord roles:

lua
Config.CharacterSlots = {
    Discord = {
        status = false,  -- Enable Discord slot system
        roles = {
            {
                id = 1234567890123456,  -- Discord Role ID
                slot = 1,               -- Bonus slots
            },
            {
                id = 9876543210987654,  -- VIP Role
                slot = 3,               -- +3 bonus slots
            },
        }
    },
    -- ...
}

Setup Requirements#

  1. Install a Discord bot/integration that provides role checking
  2. Configure your Discord guild ID
  3. Add role IDs and corresponding slot bonuses

How to Get Role IDs#

  1. Enable Developer Mode in Discord (Settings โ†’ Advanced)
  2. Right-click the role โ†’ Copy ID

Players receive slots from their highest applicable role, not cumulative.


๐Ÿ’ณ Tebex Integration#

Sell character slots through your Tebex store:

lua
Config.CharacterSlots = {
    Tebex = {
        status = false,  -- Enable Tebex integration
        packages = {
            {
                id = 1,      -- Tebex package ID
                slot = 1,    -- Slots to grant
            },
            {
                id = 2,      -- Premium package
                slot = 5,    -- +5 slots
            },
        }
    },
    -- ...
}

Tebex Setup#

  1. Create a package in your Tebex store
  2. Note the package ID
  3. Add it to the packages list
  4. Configure Tebex API in server/tebex.lua

How Players Redeem#

  1. Player purchases package on Tebex
  2. Tebex provides a redemption code
  3. Player enters code in the character selection UI
  4. Slots are added to their account

๐Ÿ”‘ Custom License Slots#

Grant slots to specific license identifiers (useful for staff/VIPs):

lua
Config.CharacterSlots = {
    Custom = {
        status = false,  -- Enable custom license system
        licenses = {
            {
                id = 'license:abc123def456',  -- Full license identifier
                slot = 5,                      -- Bonus slots
            },
            {
                id = 'license:xyz789ghi012',  -- Another player
                slot = 10,                     -- Staff gets 10 extra
            },
        }
    },
}

How to Get License IDs#

In-game, run:

lua
print(GetPlayerIdentifierByType(source, 'license'))

Or check your database players table.


๐ŸŽŸ๏ธ Redeemable Codes#

Create one-time use codes that grant slots:

Adding Codes via Database#

sql
INSERT INTO 0r_multicharacterv3_code (code, slot) VALUES 
('WELCOME2024', 1),
('VIPBONUS', 3),
('STREAMER5', 5);

Adding Codes via Command#

Create a command in server/commands.lua:

lua
lib.addCommand('addslotcode', {
    help = 'Add a slot redemption code',
    params = {
        { name = 'code', help = 'The code', type = 'string' },
        { name = 'slots', help = 'Number of slots', type = 'number' },
    },
    restricted = 'group.admin',
}, function(source, args)
    MySQL.insert('INSERT INTO 0r_multicharacterv3_code (code, slot) VALUES (?, ?)', {
        args.code, args.slots
    })
    print('Code created: ' .. args.code .. ' (' .. args.slots .. ' slots)')
end)

๐Ÿ“‹ Complete Configuration Example#

lua
Config.DefaultCharacterSlots = 2

Config.CharacterSlots = {
    -- Tebex Store Integration
    Tebex = {
        status = true,
        packages = {
            { id = 12345, slot = 1 },  -- Basic slot package
            { id = 12346, slot = 3 },  -- Premium package
            { id = 12347, slot = 5 },  -- Ultimate package
        }
    },
    
    -- Discord Role Rewards
    Discord = {
        status = true,
        roles = {
            { id = 1111111111111111, slot = 1 },  -- Supporter
            { id = 2222222222222222, slot = 2 },  -- VIP
            { id = 3333333333333333, slot = 5 },  -- MVP
            { id = 4444444444444444, slot = 10 }, -- Staff
        }
    },
    
    -- Manual License Assignments
    Custom = {
        status = true,
        licenses = {
            { id = 'license:owner123', slot = 99 },  -- Server owner
        }
    }
}

โšก Admin Commands#

Add slots directly to players via commands:

lua
-- In server/commands.lua
lib.addCommand('addslots', {
    help = 'Add slots to a player',
    params = {
        { name = 'id', help = 'Player ID', type = 'playerId' },
        { name = 'amount', help = 'Slots to add', type = 'number' },
    },
    restricted = 'group.admin',
}, function(source, args)
    local identifier = GetPlayerIdentifierByType(args.id, 'license2')
    MySQL.update('UPDATE 0r_multicharacterv3 SET character_slot = character_slot + ? WHERE identifier = ?', {
        args.amount, identifier
    })
end)

โ“ FAQ#

Q: Do Discord slots stack with Tebex slots? A: Yes! All sources are additive.

Q: What happens if a player has multiple Discord roles? A: They receive slots from the role with the highest slot value.

Q: Can slots be removed? A: Yes, modify the database directly or create a remove command.