ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. isInsideZone

Function

isInsideZone

Server and clientWorldTrilogy Hub only

Checks whether a point lies in a zone or region with the given name (case-insensitive). A zone can consist of many rectangles; each of them counts.

Syntax

bool isInsideZone(string name, float x, float y [, float z = 0])

Arguments

namestring
Zone or region name, e.g. "Grove Street", "Los Santos".
xfloat
X coordinate (or a vector).
yfloat
Y coordinate.
zfloat, optional = 0
Z height.

Returns

true when the point is inside the zone.

Example

setTimer(function()
    for _, player in ipairs(getElementsByType("player")) do
        local x, y, z = getElementPosition(player)
        if isInsideZone("Grove Street", x, y, z) then setElementData(player, "naGrove", true) end
    end
end, 5000, 0)

See also