Commands and convars
Commands
Section titled “Commands”RegisterCommand('heal', function(source, args, raw) -- source is the player ID, 0 for the server console print(('%s used /heal with %d arguments'):format(source, #args))end, true) -- true: only players with permission may use itargsis a list of words. Quotes group words:/say "hello world"gives one argument.rawis the full line as typed.- Restricted commands (
trueas the third argument) check the permissioncommand.<name>. Grant it inserver.cfg:
add_ace group.admin command.heal allowadd_principal identifier.gampeon:1234 group.adminPlayers type commands in chat as /name args. Commands that client scripts registered run in the player’s game first; all others run on the server as that player, with the player’s permissions. See Text chat.
ExecuteCommand('name args') runs a command as the server console. GetRegisteredCommands() lists all commands, and IsPlayerAceAllowed(player, 'object') checks a permission.
Kick and ban
Section titled “Kick and ban”Server owners remove players from the server console, or players with permission from the chat:
| Command | Effect |
|---|---|
clientkick <id> [reason] |
Disconnects the player with that message |
ban <id> [duration] [reason] |
Bans a player who is online, with all their identifiers, and disconnects them |
ban <identifier> [duration] [reason] |
Bans an identifier such as gampeon:1234, also when the player is offline |
unban <ban ID or identifier> |
Removes a ban |
banlist |
Lists active bans with ID, name, identifiers, end, who banned and reason |
- Durations are
30m,12h,7d,2worperm. Without a duration the ban is permanent. - Players who are kicked or banned see the reason in the game.
- Banned players cannot join until the ban ends. They see the reason, the end date in UTC and the ban ID, so they can ask you about it.
- Bans are saved in
bans.jsonnext toserver.cfgand survive restarts. Expired bans are removed when the list is saved. If the file is broken, the server keeps it as it is, applies no bans from it and refuses new bans until you fix or remove it. - Players need permission to use these commands from the chat:
add_ace group.admin command.ban allowadd_ace group.admin command.unban allowadd_ace group.admin command.banlist allowadd_ace group.admin command.clientkick allowResources can ban with ExecuteCommand('ban 12 7d cheating') if they have command.ban, for example add_ace resource.anticheat command.ban allow.
Convars
Section titled “Convars”Server settings come from server.cfg:
set shop_tax 0.19 # server onlysetr shop_theme dark # also sent to clientssets tags "roleplay, eu" # shown in the server browserlocal tax = GetConvarFloat('shop_tax', 0.0)local theme = GetConvar('shop_theme', 'light')local debug = GetConvarBool('shop_debug', false)Scripts can set convars on the server with SetConvar, SetConvarReplicated and SetConvarServerInfo.
Convars that hold credentials, such as mysql_connection_string and the server key, are protected. Scripts cannot read or change them.