Skip to main content
This page covers the multiplayer session: who is in it, spectating a player, the session’s world and what other players wear (reskate.session, which needs session.read), other players’ skaters, touching them, hiding them or some of their items, and rays at them (session.skaters), tags beside their nametags (session.nametags), their voice volume (voice.control), and messages between the copies of your plugin on every player’s game (reskate.net.send and the message event, which need net.session). See permissions.

Players

A player is a table: Every function that takes a player reads it the same way, as one of these:
  • a player table, such as reskate.session.players() gives, read by its id;
  • a player’s id as a string of digits and nothing else, such as "76561197960287930";
  • a whole number, but only while a Lua number holds it exactly (below 2^53).
A SteamID64 is past 2^53, so pass it as a string or a player table. A number that is not whole, or is too big for a Lua number to hold exactly, raises a Steam ID is a string: a number cannot hold one exactly. Anything else that is not a player raises an error too: "123abc", "", " 1", "+1", "0" and 0. The session is read four times a second, so a player who just joined may take up to a quarter of a second to appear. The player_joined and player_left events (they need session.read) say who came and went; see events.

reskate.session.active()

boolean
true while the player is in a multiplayer session.

reskate.session.is_dedicated()

boolean
true when the session is on a dedicated server, false in a player’s lobby or outside a session.

reskate.session.players()

Everyone in the session, the local player first.
table
A list of players; empty outside a session.

reskate.session.me()

table or nil
The local player, or nil outside a session.

reskate.session.host()

table or nil
The player who hosts the lobby, or nil outside a session and on a dedicated server.
active, is_dedicated, players, me and host need session.read.
On a plugin’s server copy on a dedicated server, active and is_dedicated are true, players lists the players on the server, and me and host are nil: the server is none of them.

Spectating and the world

reskate.session.spectate(player)

Watches a session player’s skater with the game’s Spectate camera, as the party menu’s Spectate does, or stops watching.
string or table
A player, as players says: their id ("7656...") or a player table. nil, nothing, "0" or 0 stops a Spectate started this way.
Returns nothing. A player whose skater cannot be watched now is ignored, and so is the player Spectate already watches.
A player that is none of those raises an error. Pass the id as a string or a player table: a Lua number cannot hold a SteamID64 exactly.
Needs session.read. Spectate takes the camera from a plugin’s view while it runs (see camera). A Spectate started with spectate or camera.follow is the same one: stopping either way ends it. It does not end when your plugin stops: stop it in an unload handler.

reskate.session.world()

The world the local player is in, for a game mode that matches players in the same world.
table
Needs session.read. On a dedicated server, a server copy gets the server’s own world and the name of the map it runs, and barred is false.

Other players’ skaters

reskate.session.skaters()

Where the other players’ skaters are, as the session last heard. The local skater is not in it: use reskate.skater.get.
table
A list of tables:
  • id (string): the player’s id.
  • position (vector): the skater’s position, in world metres.
  • heading (number): the way it faces, in radians, as the local skater’s heading.
  • age_ms (number): how old that pose is, in milliseconds.
Needs session.skaters.
On a dedicated server’s server copy, skaters lists every player in the world who has sent a pose, from the poses the server has: the server has no skater of its own. A server copy can follow players with it, for checkpoints or a game of tag, without trusting what each player’s copy reports. age_ms grows while a player sends no poses (in a menu, or gone quiet). On a lobby’s host, the server copy gets the host’s own view, as its client copy does.

reskate.session.joint(player, joint)

Where one of another player’s joints is in the world, as your game draws their skater.
string or table
required
The player, by id or player table.
number or string
required
A joint, as reskate.skater.joint takes it: 0 to 394, or "right_hand", "left_hand", "head", "hips" or "spine".
table or nil
{position, rotation, scale}, as reskate.skater.joint gives it. nil while your game does not draw that player, and on the first call: asking keeps the joint read for 2 seconds, so call it every tick. At most 64 joints of other players are read at once, for every plugin together.
Needs session.skaters. A player that is not a player’s id, or a joint that is not one of those, raises an error.

reskate.session.tag(player, text, colour)

Puts a short tag beside a player’s nametag, or takes yours away. Only this player sees it: it changes nothing on anyone else’s game.
table or string
required
A player, or their id.
string
At most 16 characters of printable ASCII. nil or "" takes your tag away.
number
default:"white"
A number 0xRRGGBBAA.
Needs session.nametags. Raises an error for a player that is not one, text over 16 characters or not printable, and a colour that is not a whole number from 0 to 0xFFFFFFFF. When several plugins tag the same player, one tag shows. Your tags go away when your plugin stops.

reskate.session.nametags(shown)

Holds the names over the other players off on your screen, or gives them back: for a camera that films, say. Chat bubbles still show.
boolean
required
False holds the names off; true gives them back.
Returns nothing.
Needs session.nametags. The names stay off while any plugin holds them off. When the plugin stops, its hold is let go. A shown that is not a boolean raises an error.

Touching, hiding and rays at players

For tag, infection or prop hunt: when your skater touches another player’s, another player’s skater hidden on your screen, and a ray that hits players. Each skater’s body is a set of capsules around its parts, as your game draws it: "head", "body" (hips to neck), "left_arm", "right_arm" (shoulder to hand), "left_leg", "right_leg" (hip to foot) and "board" (the deck, while it is drawn). Your own skater’s body is read each time your pose is sent to the other players, and moves with your skater in between. Bodies are read only in a multiplayer session, and only while a plugin uses them: the first tick or two after you start, nothing is touched or hit. Each game sees its own skater’s touches. To tell everyone, send a message: the player you touched hears it on their game too.

reskate.session.touch(on, reach)

Turns the touch and touch_end events on or off for your plugin.
boolean
default:"true"
True (or nothing) to hear touches. False stops them: touching is empty again, and no touch_end fires for the players touched then.
number
default:"0.05"
How near counts as touching, in metres between the two bodies’ surfaces: 0 to 1. Calling it again while on changes the reach.
Returns nothing.
Needs session.skaters. A reach that is not 0 to 1 raises an error. At most 64 players are touched at once: past that, a touch waits until one of them is apart.

reskate.session.touching()

The players your skater touches now, while touching is on.
table
A list of tables, as the touch event gives them:
  • player (string): the player’s id.
  • part (string): the part of your skater nearest theirs.
  • their_part (string): the part of their skater nearest yours.
  • distance (number): the gap between the two parts, in metres: 0 where they overlap.
  • position (vector): the point halfway across that gap, in the world.
Needs session.skaters. Empty while touching is off.

reskate.session.hide(player, hidden)

Hides another player’s skater on your screen, or shows it again. Only your game changes: they still see themselves, and everyone else still sees them. While hidden, their skater and board are not drawn, their sounds do not play, their nametag and their marker on the map are gone, they cannot be spectated, and they are not solid to your skater. Their body is still there for touch and raycast.
string or table
required
The player, by id or player table.
boolean
default:"true"
True (or nothing) hides them; false shows them again.
boolean
Whether it was done.
string
"at most 256 players are hidden": the most for every plugin together.
Needs session.skaters. A player stays hidden while any plugin hides them. Your plugin’s go when it stops.

reskate.session.hidden()

table
The ids (strings) of the players your plugin hides.
Needs session.skaters.

reskate.session.raycast(from, to, options)

The first other player’s body a ray meets. Your own skater is never hit; hidden players are.
vector
required
Where the ray starts, in world metres.
vector
required
Where it ends. At most 1000 m from from.
boolean
default:"true"
True: the world blocks the ray, as reskate.world.raycast meets it. Anything it meets more than 0.4 m before the player blocks (closer than that, the player’s own collision can be what it meets). False: the ray goes through the world.
table or nil
nil when no player is hit, or the world is in the way. Otherwise:
  • player (string): the player’s id.
  • part (string): the part hit, one of the parts above.
  • position (vector): where the ray meets the part’s surface.
  • distance (number): how far that is from from, in metres.
Needs session.skaters, and no world.raycast. Each call counts towards the 64 raycasts a tick, with reskate.world.raycast’s. A ray longer than 1000 m, or a raycast past those 64, raises an error. Collision is loaded only near your skater, so far from it the world does not block.

Other players’ items

What another player wears, and items of theirs your game does not show. With reskate.mods.item_origins (which mod an item comes from) and reskate.outfit.stand_ins (what shows in its place), a plugin can hide every item of one mod, or every mod item on one player. The rules, and the menu to choose them, are your plugin’s.

reskate.session.outfit(player)

The items another player wears, as their game sent them.
string or table
required
The player, by id or player table.
table or nil
nil before their outfit has arrived, for a player not in the session, and for the local player (read yours with reskate.outfit).
The names are the ones reskate.mods.item_origins takes. An item your game does not have is in the list all the same: it is what they wear, not what your game shows. Paid store items are left out: your game never shows them on another player.
Needs session.read. A player that is not a player’s id raises an error.

reskate.session.hide_items(lists)

Items not to show on other players, on your screen. A hidden item shows the way an item your game does not have does: a plugin’s stand-in, the slot’s default, or nothing. Only your game changes: nothing is sent, and nobody else sees a difference.
table or nil
Your plugin’s whole list, which replaces the one before. nil (or empty lists) shows them all again.
boolean
True when the list was taken.
string
With false: "asked more than 4 times in a second".
Names match in any case, and any item can be hidden, the game’s own included: an item is a name, wherever it comes from. Every plugin’s list applies together.
Each change dresses the players your game shows again, one every 100 ms, so a change on a full server takes a few seconds to reach everyone. The same lists as last time change nothing. Send a list when your rules change, not every tick.
Needs session.skaters. It shares 4 calls a second with reskate.outfit.set, reskate.outfit.stand_ins and the other control calls (see shared budgets); a call with the same lists still counts. At most 4096 names in all and 64 players; each name 1 to 255 characters. A list that is not a list of names, a players not keyed by player ids, or more than those raises an error. Your plugin’s list goes when it stops.

Voice

reskate.voice.set_volume(player, volume)

Sets how loud a player’s voice chat is for the local player. It changes only what this player hears.
table or string
required
A player, or their id.
number
required
0 mutes them, 1 is as heard, up to 10.
boolean
true when it was set.
string
Why not, when ok is false: “more than 10 changes in a second”, or the session’s own answer when it refused.
Needs voice.control. At most 10 changes a second; past them it returns false and why. Raises an error for a player that is not one, and a volume outside 0 to 10.

Messages

Your plugin talks to the copies of itself on the other players’ games, and to its server copy, with reskate.net.send. Messages go only to the same plugin: two copies are the same plugin when their manifest.json gives the same name (case does not matter), whatever their folders are called. A plugin with no name in its manifest.json uses its folder’s name. The session says who sent a message: a plugin cannot pretend to be another player, or the server.

reskate.net.send(to, message)

Sends a message.
string or table
required
Who gets it:
  • "all": every other player’s copy (and the server copy).
  • a player, or a player’s id: that player’s copy only.
  • "server": the plugin’s server copy only: on the lobby’s host, or on the dedicated server. A server copy cannot send to "server": it is the server.
string or buffer
required
At most 4082 bytes. Text, or binary in a string or a buffer.
boolean
true when it was sent; false outside a session, or when too many messages wait to go out.
A message is not delivered back to the copy that sent it.
Needs net.session. A message is at most 4082 bytes, and a plugin sends at most 16 KB a second (each message counts 14 bytes more for its header). Raises an error past those, for to that is not "all", "server", a player or a player’s id, for "server" from a server copy, and for a message that is not a string or a buffer.

The message event

Fires when a message from another copy of your plugin arrives. It needs net.session.
  • from is the player who sent it. A message from the server copy has from.server == true; its name is the host’s, or "Server" on a dedicated server.
  • message is always a string, even when it was sent as a buffer: use buffer.fromstring to read it as one.
Only from.server is a message you can trust to come from the session’s authority. Any player can run a changed copy of your plugin and send what they like to "all", to you or to "server": check what arrives, and let the server copy decide what counts.