Skip to content
GAMPEONCreate
New project
Preview: this works today, but details can still change.

Commands and convars

server.lua
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 it
  • args is a list of words. Quotes group words: /say "hello world" gives one argument.
  • raw is the full line as typed.
  • Restricted commands (true as the third argument) check the permission command.<name>. Grant it in server.cfg:
server.cfg
add_ace group.admin command.heal allow
add_principal identifier.gampeon:1234 group.admin

Players 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.

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, 2w or perm. 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.json next to server.cfg and 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:
server.cfg
add_ace group.admin command.ban allow
add_ace group.admin command.unban allow
add_ace group.admin command.banlist allow
add_ace group.admin command.clientkick allow

Resources can ban with ExecuteCommand('ban 12 7d cheating') if they have command.ban, for example add_ace resource.anticheat command.ban allow.

Server settings come from server.cfg:

server.cfg
set shop_tax 0.19 # server only
setr shop_theme dark # also sent to clients
sets tags "roleplay, eu" # shown in the server browser
local 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.

Report a problem with this pageOther ways to give feedback