From Multi Theft Auto: Wiki
This event is triggered when the player or a vehicle hits a colshape.
element hitElement, bool matchingDimension
- hitElement: the element that entered the colshape.
- matchingDimension: a boolean referring to whether the hit collision shape was in the same dimension as the element.
This example creates a hill area for a King of the hill gamemode. When a player enters or leaves the area, it's announced in the chatbox.
-- create our hill area for our gamemode local hillArea = createColSquare ( -2171.0678710938, 678.17950439453, 0, 15, 15 ) -- add hill_Enter as a handler for when a player enters the hill area function hill_Enter ( thePlayer, matchingDimension ) local nameOfThePlayer = getClientName(thePlayer) --announce to everyone that the player entered the hill outputChatBox( nameOfThePlayer.." entered the zone!", getRootElement(),255, 255, 109 ) end addEventHandler ( "onColShapeHit", hillArea, hill_Enter ) -- add hill_Enter as a handler for when a player leaves the hill area function hill_Exit ( thePlayer, matchingDimension ) --check if the player is not dead if isPlayerDead ( thePlayer ) ~= true then --if he was alive, announce to everyone that the player has left the hill outputChatBox ( nameOfThePlayer.." left the zone!", getRootElement(), 255, 255, 109 ) end end addEventHandler ( "onColShapeLeave", hillArea, hill_Exit )