GetLevelLayersNear
The level’s story layers with a solid piece near a point.
Every layer with a solid piece (a wall, a fence, a door, a heap) within radius of the point, the nearest first - how to find
the layer of something a mode wants gone or back; admins ask the same with /layer near [radius]. Needs the game’s tables
exported with this version or later; with an older export the list is empty. The level’s few huge ground layers are not listed.
Syntax
Section titled “Syntax”GetLevelLayersNear(x, y, z, radius)| Parameter | Type | |
|---|---|---|
x |
number | metres |
y |
number | metres |
z |
number | metres |
radius |
number | metres (10 when not given) |
Returns
Section titled “Returns”table - {{name =, near =, pieces =, distance =, on =}, ...}: the layer’s full name, how many of its pieces lie within the radius, how many it has, the nearest one’s distance, and true / false as this server switched it (nil when never switched)
Example
Section titled “Example”-- /whatlayer: the layers around an admin, to find the one to switchfunction OnPlayerCommandText(pid, cmd, args) if cmd == "whatlayer" and IsPlayerAdmin(pid) then local x, y, z = GetPlayerPos(pid) for i, layer in ipairs(GetLevelLayersNear(x, y, z, 8)) do if i > 5 then break end SendClientMessage(pid, COLOR_WHITE, string.format("%s (%d pieces, %.1f m)", layer.name, layer.pieces, layer.distance)) end return true endendSee also
Section titled “See also”SetLevelLayer · GetLevelLayers · the Level layers group of the index
