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

Function

getZoneName

Server and clientWorldIdentical to MTA:SA

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 = false
true = 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