M MY Multiplayer: Wiki
Side
Kind

createColRectangle

Shared

Creates a rectangular collision shape, aligned with the world's axes and with no height limit.

element|false createColRectangle(float x, y, float width, depth)

Parameters

NameTypeDescription
x, yfloatThe rectangle's corner with the lowest x and y. A vec2 also works.
width, depthfloatThe size along x and y, in metres. Negative values count as 0. A vec2 also works.

Returns

The created colshape element, or false if it could not be created.

A collision shape detects players, peds, vehicles and objects by their position and fires onColShapeHit and onColShapeLeave (onClientColShapeHit and onClientColShapeLeave on a client). It goes away when the resource that created it stops.

Example

local parking = createColRectangle(1520.0, -1700.0, 40, 25)

See also