# isElementWithinColShape (Shared)

> Tells whether an element is inside a collision shape.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Collision shapes
- **URL**: https://wiki.mymp.gg/en/isElementWithinColShape

## Syntax

```lua
bool isElementWithinColShape(element element, element shape)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The element. |
| `shape` | `element` | The collision shape. |

## Returns

`true` if the element is inside.

Only players, peds, vehicles and objects enter a shape. The answer comes from the last check, the same one that fires `onColShapeHit`, so an element just moved counts only after it.

## Example

```lua
if isElementWithinColShape(player, safeZone) then
    return
end
```

## See also

- [getElementsWithinColShape (Shared)](https://wiki.mymp.gg/en/getElementsWithinColShape.md): Lists the elements inside a collision shape.
- [onColShapeHit (Server)](https://wiki.mymp.gg/en/onColShapeHit.md): Fired when a player, ped, vehicle or object enters a collision shape.
