M MY Multiplayer: Wiki
Side
Kind

onColShapeHit

ServerEvent

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

addEventHandler("onColShapeHit", root, function(element hitElement, bool matchingDimension) … end)

Handler parameters

NameTypeDescription
hitElementelementThe element that entered.
matchingDimensionboolWhether the element is in the same dimension as the shape.

Source

The collision shape (colshape).

Example

local zone = createColSphere(2488.0, -1666.0, 13.3, 5)

addEventHandler("onColShapeHit", zone, function(hitElement, matchingDimension)
    if matchingDimension and getElementType(hitElement) == "player" then
        setElementHealth(hitElement, 100)
    end
end)
NoteThe event fires in any dimension; check matchingDimension.

See also