Configuration
The system::config() block and server.cfg keys.
system::config() writes server.cfg keys when the gamemode loads. Only assignments are allowed.
system::config() {
server.name = "My Server";
server.max_players = 100;
server.port = 7777;
server.language = "English";
server.weather = 10;
server.world_time = 12;
server.gravity = 0.008;
};
Configuring without server.cfg
server.cfg is optional. Every setting can live in system::config() inside the gamemode, which is the recommended setup for a single-gamemode server: one file to deploy, no external configuration to keep in sync.
system::config() {
server.name = "Euporia RP";
server.port = 7777;
server.max_players = 200;
server.language = "Indonesian";
server.weather = 10;
server.world_time = 12;
server.gravity = 0.008;
server.stream_distance = 300.0;
server.connect_timeout = 20;
server.announce = true;
server.map_name = "San Andreas";
};
Starting without a config file
knight -cfg "" -gamemode Gamemodes/euporia.sa
With -cfg "" the server starts from built-in defaults and lets the gamemode define everything, including the port. Without the flag it reads server.cfg when present and still applies the gamemode's values on top.
Precedence
| Source | Wins? |
|---|---|
system::config() in the gamemode | Always, for fields it declares |
server.cfg | For every field the gamemode does not declare |
| Built-in defaults | When neither declares a field |
Plugins are configuration too
server.plugins = ["plugins", "mods/anticheat.sa"];
See the Plugin System page for what each path loads.
server.name keeps every other value from server.cfg or the defaults.Reading the values back
The values are available at runtime, so the same names work in commands and logs.
player::command("/info") {
SendClientMessage(playerid, "{server.name} | {server.max_players} slots");
};
max_players outside 1..1000, port outside 1..65535 and connect_timeout outside 1..300 are ignored and reported in the log; the previous value is kept.server.cfg keys
| Field | Type | server.cfg key |
|---|---|---|
server.name | string | hostname |
server.max_players | int | maxplayers |
server.port | int | port |
server.gamemode | string | gamemode0 |
server.language | string | language |
server.password | string | password |
server.rcon_password | string | rcon_password |
server.weather | int | weather |
server.world_time | int | worldtime |
server.gravity | float | gravity |
server.stream_distance | float | streamdistance |
server.connect_timeout | int | connect_timeout |
All config fields
Every server.<field> accepted by system::config(), with its type and the server.cfg key it writes.
| Field | Type | server.cfg key |
|---|---|---|
server.name | string | hostname |
server.hostname | string | hostname |
server.max_players | int | maxplayers |
server.port | int | port |
server.gamemode | string | gamemode0 |
server.language | string | language |
server.password | string | password |
server.rcon_password | string | rcon_password |
server.weather | int | weather |
server.world_time | int | worldtime |
server.gravity | float | gravity |
server.stream_distance | float | stream_distance |
server.announce | bool | announce |
server.map_name | string | mapname |
server.web_url | string | weburl |
server.bind | string | bind |
server.connect_timeout | int | connect_timeout |
Reading config at runtime
The same names are readable outside system::config(), so a command can report the live settings.
player::command("/serverinfo") {
SendClientMessage(playerid, "Name: {server.name}");
SendClientMessage(playerid, "Players: {PlayerCount()} / {GetMaxPlayers()}");
SendClientMessage(playerid, "Gravity: {GetGravity()}");
};
server.* methods
| Call | Delegates to |
|---|---|
server.disable_interior_enter_exits() | DisableInteriorEnterExits |
server.game_mode_exit() | GameModeExit |
server.get_max_players() | GetMaxPlayers |
server.get_player_count() | PlayerCount |
server.get_gravity() | GetGravity |
Custom models (0.3.DL)
useartwork 1
# artpath models # optional: only for bare file names
# artwork_cdn https://cdn/models
# artwork_port 7777
custom_invisible_vehicle_model 570
useartwork is an opt-out switch: custom models are enabled by default. Set it to 0 to disable them.