- Documentation
- Shared functions
- getZoneName
Function
getZoneName
Returns 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. With citiesOnly = true it 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.
Syntax
string getZoneName(float x, float y [, float z = 0, bool citiesOnly = false])Arguments
xfloat- X coordinate (or a vector instead of x, y, z).
yfloat- Y coordinate.
zfloat, optional = 0- Z height (some zones depend on height).
citiesOnlybool, optional = falsetrue= region name instead of district.
Returns
The zone name, or "Unknown" outside the map.
Example
addCommandHandler("gdzie", function(player)
local x, y, z = getElementPosition(player)
outputChatBox("Jestes w: " .. getZoneName(x, y, z) .. ", " .. getZoneName(x, y, z, true), player)
end)
See also
getCityNameReturns the map region name at a point ("Los Santos","San Fierro","Las Venturas","Red County","Flint County","Whetstone","Bone County","Tierra Robada"); the same asgetZoneName(x, y, z, true).isInsideZoneChecks 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.getZoneNamesReturns a sorted list of all district names (without duplicates) or, withcitiesOnly = true, region names. Good for selection lists in panels.