SendPlayerToRegion
Sends a player to another region of the cluster, behind a loading screen.
Their game changes level and joins that region; it is never restarted. Here they leave as any player does (OnPlayerDisconnect - save them there,
its reason is "travelling to <region>"). An admin does the same with /travel [player] <region>.
opts says where they arrive (beating the region’s spawn) and what to send with them. The data goes through the player’s game in a signed pass: they
can read it but not change it, so keep secrets in the database.
Syntax
Section titled “Syntax”SendPlayerToRegion(pid, region [, opts])| Parameter | Type | |
|---|---|---|
pid |
number | the player |
region |
string | a region GetRegions lists |
opts |
table | x, y, z (below 0 = on the terrain), yaw, and data - a string of up to 8 KB (JsonEncode makes one of a table) (optional) |
Returns
Section titled “Returns”boolean - true, or false and why: "not connected", "not in the world", "no such region", "that region is down", "already in that region", "their game cannot", "the cluster has no secret", "the data is too long", "the game mode refused"
Example
Section titled “Example”function OnPlayerCommandText(pid, cmd, args) if cmd == "trosky" then local ok, why = SendPlayerToRegion(pid, "trosecko") if not ok then SendClientMessage(pid, 0xFF6060FF, "You cannot go: " .. why) end return true endendSee also
Section titled “See also”GetRegion · GetRegions · OnPlayerDisconnect · the Regions group of the index
