getCenter and isPointInside are also available server-side.
#lib.zones.isPointInside
Check if a position is inside a polygon
lua
local inside = lib.zones.isPointInside(points, pos, height)
Parameter
Type
Required
Description
points
vector3[]
yes
Polygon boundary points
pos
vector3
yes
Position to test
height
number
no
Height of the polygon
#lib.zones.isInsideZone
Check whether a position lies inside a zone(s)
lua
local isInside, zoneName = lib.zones.isInsideZone(name, pos)
Parameter
Type
Required
Description
name
String, Object
true
Unique zone reference(s)
pos
Vector3
true
Position to be checked
#Data Structure
This is the data structure of a blip and the valid options
lua
{ -- Required type = "circle", -- Type of zone: circle, circle2D, poly, box, game_zone -- Not Required onEnter = function(data) -- Callback for entering the zone end, onExit = function(data) -- Callback for exiting the zone end,}
Some zones have different requirements, see below:
{% tabs %}
{% tab title="circle" %}
code
[object Object], pos = vector3(0, 0, 0), -- Position of the zone
radius = 5.0, -- Size of the zone radially from the point
}
{% endtab %}
{% tab title="circle2D" %}
lua
{ pos = vector2(0, 0), -- Position of the zone radius = 5.0, -- Size of the zone radially from the point}
{% endtab %}
{% tab title="poly" %}
code
[object Object], points = { -- Boundy marks for the polyzone
vector2(0, 0),
vector2(2, 1),
vector2(3, 3),
}
}
{% endtab %}
{% tab title="box" %}
lua
{ pos = vector4(0,0,0,0), -- Position of the zone, x, y, z, heading size = vector3(0,0,0) -- Size of the zone from the center point}