# onElementColShapeHit (Server)

> Fired on a player, ped, vehicle or object when it enters a collision shape.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Server
- **Category**: Collision shapes
- **URL**: https://wiki.mymp.gg/en/onElementColShapeHit

## Syntax

```lua
addEventHandler("onElementColShapeHit", root, function(element colShape, bool matchingDimension) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `colShape` | `element` | The collision shape it entered. |
| `matchingDimension` | `bool` | Whether the element is in the same dimension as the shape. |

## Source

The element that entered.

It fires right after `onColShapeHit`, unless a handler of that one destroyed the element.

## Example

```lua
addEventHandler("onElementColShapeHit", root, function(colShape, matchingDimension)
    if colShape == safeZone and getElementType(source) == "vehicle" then
        setElementFrozen(source, true)
    end
end)
```

## See also

- [onElementColShapeLeave (Server)](https://wiki.mymp.gg/en/onElementColShapeLeave.md): Fired on a player, ped, vehicle or object when it leaves a collision shape.
- [onColShapeHit (Server)](https://wiki.mymp.gg/en/onColShapeHit.md): Fired when a player, ped, vehicle or object enters a collision shape.
