💻 Server
Server represents all Server controls in the Server side.
🗿Static Class
This is a Static Class. Access it's methods directly with
.
. It's not possible to spawn new instances.💂Authority
This static class can be accessed only on 🟦 Server side.
🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
🎒 Examples
Server/Index.lua
-- prints "Server started" when the server is starting
Server.Subscribe("Start", function()
Console.Log("Server started")
end)
-- prints "Server stopped" when the server stops / shutdown
Server.Subscribe("Stop", function()
Console.Log("Server stopped")
end)
-- prints the delta time about every 33 ms
Server.Subscribe("Tick", function(delta_time)
Console.Log("Tick: " .. delta_time)
end)
🗿 Static Functions
Returns | Name | Description | |
---|---|---|---|
ChangeMap | Restarts the server in a new Map, restarts all packages and reconnects all players | ||
table of string | GetAllValuesKeys | Gets a list of all values keys | |
integer | GetCompressionLevel | Returns the server Compression Level being used | |
table of table | GetCustomSettings | Returns the Server Custom Settings passed as parameter or New Game screen | |
string | GetDescription | Returns the Server Description | |
string | GetIP | Returns the server Public IP | |
string | GetMap | Returns the current Map Package name | |
string | GetMapAsset | Returns the current Map Asset reference | |
table | GetMapConfig | Returns a list of the Custom Config of the current map (stored in the MAP_NAME.toml) | |
table of table | GetMapSpawnPoints | Returns a list of the Spawn Points of the current map (stored in the MAP_NAME.toml) | |
integer | GetMaxPlayers | Returns the Max Players configured | |
table of table | GetPackages | Returns a list of Packages running, optionally returns all Packages installed in the server | |
integer | GetPort | Returns the server Port | |
integer | GetQueryPort | Returns the server QueryPort | |
integer | GetTickRate | Returns the Configured Tick Rate | |
integer | GetTime | Gets the Unix Epoch Time in milliseconds | |
any | GetValue | Gets a value given a key | |
string | GetVersion | Returns the server version | |
boolean | IsAnnounced | Returns if the Server is announced in the Master List | |
boolean | LoadPackage | Loads a Package | |
boolean | ReloadPackage | No description provided | |
Restart | Restarts the server, reloading all Packages and reconnecting all Players | ||
SetDescription | Sets the description of the server, optionally overrides Config.toml | ||
SetLogo | Sets the logo of the server, optionally overrides Config.toml | ||
SetMaxPlayers | Sets the maximum player slots of the server, optionally overrides Config.toml | ||
SetName | Sets the name of the server, optionally overrides Config.toml | ||
SetPassword | Sets the password of the server, optionally overrides Config.toml | ||
SetValue | Sets a global value in the Server, which can be accessed from anywhere (server side) | ||
Stop | Stops the server | ||
function | Subscribe | Subscribes for an Event | |
Unban | Unbans a Player by it's account ID | ||
boolean | UnloadPackage | Unloads a Package | |
Unsubscribe | Unsubscribes from all subscribed Events in this Class and in this Package, optionally passing the function to unsubscribe only that callback |
ChangeMap
Restarts the server in a new Map, restarts all packages and reconnects all players
Server.ChangeMap(map_path)
Type | Parameter | Default | Description |
---|---|---|---|
string | map_path | Required parameter | The new map to load |
GetAllValuesKeys
Gets a list of all values keys
— Returns table of string (a list with all values keys).
local ret = Server.GetAllValuesKeys()
GetCompressionLevel
Returns the server Compression Level being used
— Returns integer (the server Compression Level).
local ret = Server.GetCompressionLevel()