- Documentation
- Shared functions
- isInsideZone
Function
isInsideZone
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
getZoneNameReturns the name of the district (map zone) at a point, e.g."Grove Street","Idlewood","Downtown Los Santos"- what the game shows on screen when you enter a new area. WithcitiesOnly = trueit returns the region name ("Los Santos","San Fierro","Las Venturas","Red County"…). Works on both sides on the data of the game's 356 zones, without asking a client.getZoneBoundsReturns the box enclosing a whole zone (all its parts) with the given name: minimum and maximum coordinates. When there is no such district it looks for a region.