> For the complete documentation index, see [llms.txt](https://docs.vames-store.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vames-store.com/assets/vms_multichars/configuration-files/config_commands.lua.md).

# config\_commands.lua

<details>

<summary>ESX Version</summary>

```lua
-- THIS COMMAND IS FOR USE ONLY THROUGH THE CONSOLE OR THROUGH THE TEBEX API
RegisterCommand("addslots", function(source, args)
    if (source == 0) then
		local formatIdentifier = Config.Identifier == 'license' and string.gsub(args[1], "license:", "") or Config.Identifier == 'steam' and string.gsub(args[1], "steam:", "")
		MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {formatIdentifier}, function(result)
			if result[1] then
				MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {result[1].slots + tonumber(args[2]), formatIdentifier})
			else
				MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {formatIdentifier, Config.Slots + tonumber(args[2])})
			end
		end)
    end
end, false)

-- ADMIN COMMANDS

ESX.RegisterCommand('deletecharacter', 'admin', function(xPlayer, args, showError)
    MySQL.update("DELETE FROM `users` WHERE identifier = ?", {args.identifier})
    MySQL.update("DELETE FROM `owned_vehicles` WHERE owner = ?", {args.identifier})
    MySQL.update("DELETE FROM `user_licenses` WHERE owner = ?", {args.identifier})
    MySQL.update("DELETE FROM `datastore_data` WHERE owner = ?", {args.identifier})
    -- Here you can add more tables that you want it to delete when deleting a character.
    
    xPlayer.triggerEvent('vms_multichars:notification', (Config.Translate['cmd.success_deleted_character']):format(args.identifier), 5500, 'success')
end, true, {help = Config.Translate['cmd.help_deletecharacter'], validate = true, arguments = {
	{name = 'identifier', help = Config.Translate['cmd.help_identifier'], type = 'string'},
}})

ESX.RegisterCommand('setslots', 'admin', function(xPlayer, args, showError)
	MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args.identifier}, function(result)
		if result[1] then
			MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {args.slots, args.identifier})
			xPlayer.triggerEvent('vms_multichars:notification', (Config.Translate['slots_edited']):format(args.slots, args.identifier), 5500, 'success')
		else
			MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {args.identifier, args.slots})
			xPlayer.triggerEvent('vms_multichars:notification', (Config.Translate['slots_added']):format(args.slots, args.identifier), 5500, 'success')
		end
	end)
end, true, {help = Config.Translate['cmd.setslots'], validate = true, arguments = {
	{name = 'identifier', help = Config.Translate['cmd.help_identifier_only_numbers'], type = 'string'},
	{name = 'slots', help = Config.Translate['cmd.help_slots'], type = 'number'}
}})

ESX.RegisterCommand('removeslots', 'admin', function(xPlayer, args, showError)
	MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args.identifier}, function(result)
		if result[1] then
			MySQL.update('DELETE FROM `multichars_slots` WHERE `identifier` = ?', {args.identifier})
			xPlayer.triggerEvent('vms_multichars:notification', (Config.Translate['slots_removed']):format(args.identifier), 5500, 'success')
		end
	end)
end, true, {help = Config.Translate['cmd.removeslots'], validate = true, arguments = {
	{name = 'identifier', help = Config.Translate['cmd.help_identifier_only_numbers'], type = 'string'}
}})

ESX.RegisterCommand('enablechar', 'admin', function(xPlayer, args, showError)
	MySQL.update('UPDATE `users` SET `disabled` = 0 WHERE identifier = ?', {args.identifier}, function(result)
		if result > 0 then
			xPlayer.triggerEvent('vms_multichars:notification', Config.Translate['charenabled']:format(args.identifier), 5500, 'success')
		else
			xPlayer.triggerEvent('vms_multichars:notification', Config.Translate['charnotfound']:format(args.identifier), 5500, 'error')
		end
	end)
end, true, {help = Config.Translate['cmd.help_enablechar'], validate = true, arguments = {
	{name = 'identifier', help = Config.Translate['cmd.help_identifier'], type = 'string'},
}})

ESX.RegisterCommand('disablechar', 'admin', function(xPlayer, args, showError)
	MySQL.update('UPDATE `users` SET `disabled` = 1 WHERE identifier = ?', {args.identifier}, function(result)
		if result > 0 then
			xPlayer.triggerEvent('vms_multichars:notification', Config.Translate['chardisabled']:format(args.identifier), 5500, 'success')
		else
			xPlayer.triggerEvent('vms_multichars:notification', Config.Translate['charnotfound']:format(args.identifier), 5500, 'error')
		end
	end)
end, true, {help = Config.Translate['cmd.help_disablechar'], validate = true, arguments = {
	{name = 'identifier', help = Config.Translate['cmd.help_identifier'], type = 'string'},
}})
```

</details>

<details>

<summary>QB-Core Version</summary>

```lua
local QBCore = exports['qb-core']:GetCoreObject()

-- THIS COMMAND IS FOR USE ONLY THROUGH THE CONSOLE OR THROUGH THE TEBEX API
RegisterCommand("addslots", function(source, args)
    if (source == 0) then
		local formatIdentifier = Config.Identifier == 'license' and string.gsub(args[1], "license:", "") or Config.Identifier == 'steam' and string.gsub(args[1], "steam:", "")
		MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {formatIdentifier}, function(result)
			if result[1] then
				MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {result[1].slots + tonumber(args[2]), formatIdentifier})
			else
				MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {formatIdentifier, Config.Slots + tonumber(args[2])})
			end
		end)
    end
end, false)

-- ADMIN COMMANDS

QBCore.Commands.Add('deletecharacter', Config.Translate['cmd.help_deletecharacter'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid']
}}, true, function(source, args)
    if (args[1]) then
        QBCore.Player.ForceDeleteCharacter(args[1])
        TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['cmd.success_deleted_character']):format(args[1]), 5500, 'success')
    end
end, 'admin')

QBCore.Commands.Add('setslots', Config.Translate['cmd.setslots'], {
    {name = 'identifier', help = Config.Translate['cmd.help_identifier']},
    {name = 'slots', help = Config.Translate['cmd.help_slots']}
}, true, function(source, args)
    if (args[1] and tonumber(args[2])) then
        MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args[1]}, function(result)
            if result[1] then
                MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {args[2], args[1]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_edited']):format(args[2], args[1]), 5500, 'success')
            else
                MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {args[1], args[2]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_added']):format(args[2], args[1]), 5500, 'success')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('removeslots', Config.Translate['cmd.removeslots'], {{ 
    name = 'identifier', help = Config.Translate['cmd.help_identifier'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args[1]}, function(result)
            if result[1] then
                MySQL.update('DELETE FROM `multichars_slots` WHERE `identifier` = ?', {args[1]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_removed']):format(args[1]), 5500, 'success')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('enablechar', Config.Translate['cmd.help_enablechar'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.update('UPDATE `players` SET `disabled` = 0 WHERE citizenid = ?', {args[1]}, function(result)
            if result > 0 then
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charenabled']:format(args[1]), 5500, 'success')
            else
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charnotfound']:format(args[1]), 5500, 'error')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('disablechar', Config.Translate['cmd.help_disablechar'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.update('UPDATE `users` SET `disabled` = 1 WHERE identifier = ?', {args[1]}, function(result)
            if result > 0 then
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['chardisabled']:format(args[1]), 5500, 'success')
            else
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charnotfound']:format(args[1]), 5500, 'error')
            end
        end)
    end
end, 'admin')
```

</details>

<details>

<summary>QBOX Version</summary>

```lua
local QBCore = exports['qb-core']:GetCoreObject()

-- THIS COMMAND IS FOR USE ONLY THROUGH THE CONSOLE OR THROUGH THE TEBEX API
RegisterCommand("addslots", function(source, args)
    if (source == 0) then
		local formatIdentifier = Config.Identifier == 'license' and string.gsub(args[1], "license:", "") or Config.Identifier == 'steam' and string.gsub(args[1], "steam:", "")
		MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {formatIdentifier}, function(result)
			if result[1] then
				MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {result[1].slots + tonumber(args[2]), formatIdentifier})
			else
				MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {formatIdentifier, Config.Slots + tonumber(args[2])})
			end
		end)
    end
end, false)

-- ADMIN COMMANDS

QBCore.Commands.Add('deletecharacter', Config.Translate['cmd.help_deletecharacter'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid']
}}, true, function(source, args)
    if (args[1]) then
        QBCore.Player.ForceDeleteCharacter(args[1])
        TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['cmd.success_deleted_character']):format(args[1]), 5500, 'success')
    end
end, 'admin')

QBCore.Commands.Add('setslots', Config.Translate['cmd.setslots'], {{ 
    name = 'identifier', help = Config.Translate['cmd.help_identifier'],
    name = 'slots', help = Config.Translate['cmd.help_slots']
}}, true, function(source, args)
    if (args[1] and tonumber(args[2])) then
        MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args[1]}, function(result)
            if result[1] then
                MySQL.update('UPDATE `multichars_slots` SET `slots` = ? WHERE `identifier` = ?', {args[2], args[1]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_edited']):format(args[2], args[1]), 5500, 'success')
            else
                MySQL.update('INSERT INTO `multichars_slots` (`identifier`, `slots`) VALUES (?, ?)', {args[1], args[2]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_added']):format(args[2], args[1]), 5500, 'success')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('removeslots', Config.Translate['cmd.removeslots'], {{ 
    name = 'identifier', help = Config.Translate['cmd.help_identifier'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.Async.fetchAll('SELECT slots FROM multichars_slots WHERE identifier = ?', {args[1]}, function(result)
            if result[1] then
                MySQL.update('DELETE FROM `multichars_slots` WHERE `identifier` = ?', {args[1]})
                TriggerClientEvent('vms_multichars:notification', source, (Config.Translate['slots_removed']):format(args[1]), 5500, 'success')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('enablechar', Config.Translate['cmd.help_enablechar'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.update('UPDATE `players` SET `disabled` = 0 WHERE citizenid = ?', {args[1]}, function(result)
            if result > 0 then
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charenabled']:format(args[1]), 5500, 'success')
            else
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charnotfound']:format(args[1]), 5500, 'error')
            end
        end)
    end
end, 'admin')

QBCore.Commands.Add('disablechar', Config.Translate['cmd.help_disablechar'], {{ 
    name = 'citizenid', help = Config.Translate['cmd.help_citizenid'],
}}, true, function(source, args)
    if (args[1]) then
        MySQL.update('UPDATE `users` SET `disabled` = 1 WHERE identifier = ?', {args[1]}, function(result)
            if result > 0 then
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['chardisabled']:format(args[1]), 5500, 'success')
            else
                TriggerClientEvent('vms_multichars:notification', source, Config.Translate['charnotfound']:format(args[1]), 5500, 'error')
            end
        end)
    end
end, 'admin')
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vames-store.com/assets/vms_multichars/configuration-files/config_commands.lua.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
