Skip to content

SetPlayerEditor

Opens the in-game map editor for a player - with what they may do - or closes it.

In the editor the player flies, picks the game’s meshes from its panel, places, moves, turns and scales them with the mouse and takes level things out; every edit reaches every player at once and is written into the map, and the player’s undo and redo are their own. The panel needs the web interface in their game; without it the editor says so.

scope is "admin" (everything an admin’s /editor gives), "builder" (place objects and change or delete their own - nothing of the level, no layers, no areas) or a table over "admin"’s rights: place, changeOthers (objects someone else made), delete, removeLevel (take parts of the level out), layers (switch map layers), areas (draw, change and delete the map’s areas and nav links), maxObjects (how many objects of their own they may have on the map, 0 = no cap) and layer (the one map layer they edit - what they place goes into it, made if it is new). OnMapEdit decides each edit after the scope. nil or false closes the editor.

SetPlayerEditor(pid, scope)
Parameter Type
pid number the player
scope string|table|nil "admin", "builder", a table of rights, or nil to close it

boolean - true; false and the reason when the server has no map, the map is read-only or the player cannot fly now (on a horse, dead …)

-- a plot owner builds on their own plot's layer, at most 40 objects
RegisterCommand("build", function(pid)
local ok, why = SetPlayerEditor(pid, {changeOthers = false, removeLevel = false, layers = false, maxObjects = 40,
layer = "plot_" .. PLOT_OF[pid]})
if not ok then SendClientMessage(pid, COLOR_RED, why) end
end)

GetPlayerEditor · OnMapEdit · the The server’s map group of the index