onMarkerHit | Multi Theft Auto: Wiki Skip to content

onMarkerHit

Client-side
Server-side
Shared

This event is triggered when an element enters a marker created using createMarker.

The event is not triggered when only the dimension changes of the player. So, if you use the matchingDimension when teleporting players into existing markers you should always first set their dimension/interior and only then the position

Parameters

element hitElement, bool matchingDimension
  • hitElement: the element that hit the marker.
  • matchingDimension: a boolean representing whether the element is in the same dimension as the marker.

Source

element: The source of this event is the marker that got hit by the element.

Code Examples

server

This example will output a message what type of element has entered a marker.

local playerMarker = createMarker(0, 0, 2, "cylinder", 5, 10, 244, 23, 200, root)
function handlePlayerMarker(hitElement)
local elementType = getElementType(hitElement)
outputChatBox("Element ("..elementType..") has entered marker.")
end
addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker)