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

Function

createColPolygon

Server and clientCollision shapesIdentical to MTA:SA

Creates a collision zone shaped as any polygon on the map (e.g. a gang territory outline). The first two numbers are the centre point (element position), then x, y pairs of vertices - at least three. No height limit by default; setColPolygonHeight sets a range.

Syntax

colshape createColPolygon(float fCenterX, float fCenterY, float fX1, float fY1, float fX2, float fY2, float fX3, float fY3 [, float ...])

Arguments

fCenterXfloat
Centre point X.
fCenterYfloat
Centre point Y.
fX1float
First vertex X.
fY1float
First vertex Y.
fX2float
Second vertex X.
fY2float
Second vertex Y.
fX3float
Third vertex X.
fY3float
Third vertex Y.
...float, optional
More x, y pairs.

Returns

The new zone, or false with fewer than 3 vertices.

Example

local grove = createColPolygon(2490, -1665, 2430, -1720, 2540, -1720, 2540, -1620, 2430, -1620)
addEventHandler("onColShapeHit", grove, function(element)
    if getElementType(element) == "player" then outputChatBox("Teren Grove Street Families", element) end
end)

See also