map.zones
map.zones(filter: table?): { Zone }
Returns the zones drawn in the map.
Parameters#
- filter (
table, optional): fields thatdatamust contain, for example{ type = "classroom" }. Without a filter: all of them
Returns#
{ Zone }: map zones, with id, name, data, bucket and fromMap = true
Example#
for _, classroom in map.zones({ type = "classroom" }) do
classroom.onEnter = function(zone, player)
player:setBucket(zone.data.bucket, zone)
end
end
Notes#
- Players already in the zone are announced on the next tick, with the reason
zone_added. - Set
onEnterandonExitdirectly on the zone. Forinside, callzone:whileInside. - A map zone cannot be removed by a script.