M MY Multiplayer: Wiki
Side
Kind

getElementsWithinColShape

Shared

Lists the elements inside a collision shape.

table getElementsWithinColShape(element shape [, string elementType = ""])

Parameters

NameTypeDescription
shapeelementThe collision shape.
elementTypestringIf not empty, only elements of this type, such as "player" or "vehicle".default ""

Returns

A list of elements, empty if there are none.

Only players, peds, vehicles and objects enter a shape. The list comes from the last check, the same one that fires onColShapeHit.

Example

for _, vehicle in ipairs(getElementsWithinColShape(garage, "vehicle")) do
    destroyElement(vehicle)
end

See also