SetLevelBarriers
Lifts or puts back the level’s invisible barriers in a circle, for every player.
on = false lifts every invisible barrier that reaches into the circle - a player then walks or wades where the level
stopped them; on = true puts them back. The change reaches every player at once and everyone who joins later.
Lifting again at a place already lifted (its middle within 1 m) changes that area’s radius instead of adding a second
one. Putting back takes away every lifted area whose middle lies within radius of the point (at least 1 m), so a large
radius puts back every area at once. At most 64 areas; not kept across a restart - lift them again in
OnGameModeInit. Scenery, water and everything else stay as they are: only the invisible walls go.
Syntax
Section titled “Syntax”SetLevelBarriers(x, y, radius, on)| Parameter | Type | |
|---|---|---|
x |
number | the circle’s middle on the map, metres |
y |
number | metres |
radius |
number | metres, 0.1 to 500 when lifting; when putting back, how far from the point a lifted area’s middle may be |
on |
boolean | false lifts the barriers, true puts them back |
Returns
Section titled “Returns”boolean, string - accepted; the reason when not ("is not a place", "needs a radius of 0.1 to 500 m", "is lifted there already", "has 64 areas lifted already", "has no lifted area there"; "" when accepted)
Example
Section titled “Example”-- Suchdol's moat (kutnohorsko): its east side wadeable during a siegelocal SUCHDOL_MOAT = {x = 778, y = 3376, radius = 30}
function OnGameModeInit() SetLevelBarriers(SUCHDOL_MOAT.x, SUCHDOL_MOAT.y, SUCHDOL_MOAT.radius, false)end
function OnPlayerCommandText(pid, cmd, args) if cmd == "moat" and IsPlayerAdmin(pid) then local closed = args == "closed" SetLevelBarriers(SUCHDOL_MOAT.x, SUCHDOL_MOAT.y, SUCHDOL_MOAT.radius, closed) SendClientMessage(pid, COLOR_YELLOW, closed and "The moat stops everyone again." or "The moat can be waded.") return true endendSee also
Section titled “See also”GetLevelBarriers · SetLevelLayer · the Level layers group of the index
