reskate.server is the session’s authority acting on its players. It works only in a plugin’s server copy. Every function needs the server permission, except the park mod functions, which need server.parks. See permissions and manifest.
Server copies
A plugin whose manifest says"side": "server" or "side": "both" has a server copy, which runs as the session’s authority:
- On a lobby’s host. While a player’s game hosts a lobby, the server copies of their plugins run on that game beside the client copies. Each has its own id,
<folder>@server(reskate.id), for its log lines, its storage, its console commands and all it holds in the game, so it shares nothing with the client copy. They stop when the game stops hosting, and the client copies carry on untouched. - On a dedicated server, from the
Pluginsfolder beside the server.
reskate.side is "server"; in a client copy it is "client". Branch on it in a plugin for both sides:
reskate.server function in a client copy raises an error, as does calling one without the server permission.
Lobby host and dedicated server
The functions do not all work the same way in both places.
Chat lines from
say and tell start with the plugin’s name in brackets ([My Plugin] ...): the name in its manifest.json, or its folder’s name without one.
Players
A player is a player’s id ("7656...", a string of digits and nothing else) or a player table with an id, such as reskate.session.players() and the player_joined event give. A whole number works only while a Lua number holds it exactly, which a SteamID64 never is. Anything else raises an error, "0" and 0 included. See players.
reskate.server.kick(player, why)
Removes a player from the session.
At most 120 characters, shown to the player: “You were removed from the session: ” (lobby) or “Removed from the server: ” (dedicated server), then
why.Why not: on a lobby’s host
"the host cannot be kicked" or "that player is not in the session"; on a dedicated server "that player is not on the server".Needs the
server permission and a server copy. The example also needs session.read and storage.reskate.server.say(text)
A chat line to everyone in the session.
Why not:
"one line a second", or on a lobby’s host "not in a session" or the chat’s own reason./, or one longer than 200 characters raises an error.
Needs the
server permission and a server copy. One line a second.reskate.server.tell(player, text)
A chat line to one player only. Only a dedicated server has it: a lobby has no private chat. On a lobby’s host, send that player’s copy a message with reskate.net.send and show it there.
Why not:
"that player is not on the server", or on a lobby’s host "a lobby has no private chat: send that player's copy a message (reskate.net.send) and show it there".Needs the
server permission and a server copy.reskate.server.move(player, position)
Moves a player’s skater, on a lobby’s host and on a dedicated server alike. The player’s game makes the move, as for the console’s tpall and tphere.
Why not: on a lobby’s host
"that player is not in the world" (or not in the session, or the host) or "it could not be sent"; on a dedicated server "that player is not on the server".Needs the
server permission and a server copy. A position that is not finite raises an error.reskate.server.ban(player)
Bans a player from a dedicated server, whether they are connected or not, as the server console’s ban does: a connected player is dropped with “You were banned from this server.”, and the ban is saved in the server’s ban list.
The player: a player table, or any player’s SteamID64 (17 digits starting
7656119), here or not.Why not: the console’s answer, such as
"Enter a connected player or a SteamID64 (17 digits starting 7656119)."; on a lobby’s host "unavailable here".Needs the
server permission and a server copy on a dedicated server. The example also needs storage.reskate.server.unban(player)
Lifts a dedicated server’s ban on a player, as the server console’s unban does. The player may also join again at once if they were kicked.
Needs the
server permission and a server copy on a dedicated server.Park mods
A dedicated server can have park mods set up: parks built in the Park Editor and shipped as mods, each bound to one map (maps.park_mods in ReSkateServer.json, or the console’s park-mod config add). The server copy can list them and spawn or remove them, as the console’s park-mod add and remove do: with the server’s limits on parks and objects, the check that a park belongs on the map running now, and the chat line to everyone. The server’s log says [parks] <name> spawned (...) by plugin <id>.
These functions need the server.parks permission, not server, and a server copy on a dedicated server.
A park mod’s name is its own in the server’s setup: 1 to 16 of a-z, 0-9, - and _. Anything else raises an error.
reskate.server.parks()
The park mods the server has set up.
A list of tables:
name(string): the park mod’s name.map(string): the map it belongs on, as the server names it ("San Vansterdam").here(boolean):truewhen it belongs on the map running now, so it can be spawned.spawned(boolean):truewhile it is out.objects(number): how many objects it has out (0 while it is not spawned).minutes_left(number): minutes until it goes; 0 when it stays until removed, or is not spawned.
Needs
server.parks and a server copy on a dedicated server. Each call counts as a reskate.server call.reskate.server.park_spawn(name, minutes)
Spawns a park mod for every player.
Why not, as
park-mod add says it: "street is already spawned.", "street belongs on Isle of Grom, and the server is on San Vansterdam.", "there is no park mod called "street" (park-mod list).", the limits on parks and objects; on a lobby’s host "unavailable here".Needs
server.parks and a server copy on a dedicated server. A name that is not a park mod’s, or minutes outside 1 to 1440, raises an error. Each call counts as a reskate.server call.reskate.server.park_remove(name)
Removes a spawned park mod.
Why not:
"street is not spawned.", "there is no park mod called "street" (park-mod list)."; on a lobby’s host "unavailable here".Needs
server.parks and a server copy on a dedicated server. Each call counts as a reskate.server call.Cards and polls
On a dedicated server, the server copy can put a card or a poll on players’ screens, where the server shows its own announcements and votes. Each player’s card or poll is their own: it shows over the server’s until it ends, and then the server’s shows again. Players need no plugin of their own to see them. Both take who they are for:"all": everyone on the server now;- one player (an id or a player table);
- a list of players, 1 to 128.
reskate.server.card(who, text, seconds)
A card with a line of text, as the server’s announcements show.
How long it is up, 1 to 60. Without it, as long as an announcement of the same length (6 to 15 seconds).
Why not:
"that player is not on the server", "none of those players is on the server" or "nobody is on the server"; on a lobby’s host "unavailable here".Needs the
server permission and a server copy on a dedicated server. Each call counts as a reskate.server call.reskate.server.poll(who, question, answers, options)
A poll on each player’s screen, shown as the server’s own polls are, which they answer the same way: /1, /2 and so on in chat. One answer closes it for that player. The poll shows no counts: your plugin hears each answer and counts them itself.
How long it runs, 5 to 300. Without it, the server’s poll time (
votes.poll_seconds, 60 by default).The poll’s id, one for everyone it asks. It comes back in the
poll_answer and poll_closed events.When
id is nil: "that player is not on the server", "none of those players is on the server" or "nobody is on the server"; on a lobby’s host "unavailable here".poll_closed with "replaced". Answering a plugin’s poll is not a server vote, so a player’s role does not need votes for it.
Needs the
server permission and a server copy on a dedicated server. Each call counts as a reskate.server call.reskate.server.poll_close(id)
Closes one of your polls for every player it is still open for. Each of them comes back in poll_closed with "closed".
Why not:
"no poll of the plugin's with that id is open"; on a lobby’s host "unavailable here".Needs the
server permission and a server copy on a dedicated server. When the plugin stops, its cards and polls go too, with no events.Hiding players
On a dedicated server, the server copy can hide one player from others: wholly, so they are gone from those players’ games, or only their voice or sound. For Hide and Seek, tag, spectating or ghost runs. It works per viewer: the hidden player still sees everyone, and players it is not hidden from still see them. Hidden wholly, the player is taken out of the viewers’ games as if they had left: their skater, name tag, place in the player list and the objects they placed are gone, and the viewers get nothing of them (poses, sound, voice, outfit, effects). Chat lines still show. Shown again, they come back as if they had just joined: outfit, skater and objects. The name goes with the skater: a game has no skater without its player, so one cannot be hidden without the other.reskate.server.hide(target, viewers, options)
Hides target from viewers.
Who they are hidden from:
"all" (everyone on the server now but target; players who join later still see them), a player, or a list of 1 to 128 players. Players in the list who are not on the server are left out.true (the default): hidden wholly. false: only what voice and sound say is held back, and the player stays.Why not:
"that player is not on the server" (the target), "none of those players is on the server", "nobody else is on the server", "they share a party" or "they are in a throwdown together" (with any of the viewers: their games would lose a party member or a player mid-way, so nothing is hidden); on a lobby’s host "unavailable here".viewers, an empty list, an option that is not skater, name, voice or sound or not a boolean, skater = true with voice or sound set to false (a hidden skater’s voice and sound go too), and all three set to false.
Needs the
server permission and a server copy on a dedicated server. Each call counts as a reskate.server call. When the plugin stops, everyone it hid is shown again; a player who leaves the server is taken out of every list.The throwdown check works while the server follows throwdowns: when
activity_log, announce_throwdowns and throwdown_locks are all off in its settings, it does not know who plays together.reskate.server.unhide(target, viewers)
Shows target again to viewers, as far as this plugin hid them.
A player, a list of players, or
"all". Without it, to everyone this plugin hid them from.Why not:
"the plugin hides that player from none of them"; on a lobby’s host "unavailable here".Needs the
server permission and a server copy on a dedicated server. Each call counts as a reskate.server call.Player permissions
On a dedicated server, the server copy decides what each player may do, as the server console’slock does. A player table (from reskate.session.players(), the player_joined event and the others) has two names of its own for this in a server copy: permissions and apply_permissions.
player.permissions
What the server holds for the player now: a read-only table with each permission above, true where the player may. It is read from the server each time you read it.
nil for a player the server cannot hold permissions for (not a player’s SteamID64), and on a lobby’s host.server permission, raises an error. Each read counts as a reskate.server call (see limits).
permissions:clone()
A copy of a permissions table that you can change, for apply_permissions. The table player.permissions gives is read-only.
player:apply_permissions(permissions)
Makes the player’s permissions exactly these. They hold as an admin’s locks do: a throwdown ending does not lift them.
All six permissions, each
true or false, and nothing else: start from player.permissions:clone(), so none is left out by mistake. A permission that is missing or not a boolean, or a name that is not a permission, raises an error.Needs the
server permission and a server copy on a dedicated server. The example also needs session.read. Each call counts as a reskate.server call.Player roles
A dedicated server gives each player a role (data/roles.json, and the console’s role <SteamID64> <role>): the one given them, or else the server’s default role. In a server copy, a player table’s role says which, so a plugin can let its own commands follow the server’s roles instead of keeping a list of its own.
player.role
The player’s role now: a read-only table, read from the server each time you read it.
Its rank, 0 to 1000. With the roles a new server starts with:
player and muted 0, vip 10, moderator 50, admin 100.Whether the role gives any of the server’s commands (such as
kick): true for moderator and admin on a new server.role is nil for a player with no role (one given none, on a server with no default role), for the server itself, and on a lobby’s host.
server permission, raises an error. Each read counts as a reskate.server call (see limits).
Limits
A server copy makes at most 20
reskate.server calls a second, reading player.permissions and player.role, apply_permissions and the park mod functions included; the 21st raises an error. say also has its own limit of one line a second, which returns false. See limits.