getElementsWithinColShape
Shared
Lists the elements inside a collision shape.
table getElementsWithinColShape(element shape [, string elementType = ""])
Parameters
| Name | Type | Description |
|---|---|---|
| shape | element | The collision shape. |
| elementType | string | If 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