OnMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Improve example.)
(Updated issues)
Line 31: Line 31:
==Issues==
==Issues==
{{Issues|
{{Issues|
{{Issue|6098|If a marker was attached to another element, onMarkerHit won't be triggered}}
{{Issue|551|If a marker was attached to another element, onMarkerHit won't be triggered}}
{{Issue|519|onMarkerHit not always triggered in interiors}}
{{Issue|923|Server side markers with size < 1.5 don't trigger event}}
}}
}}


{{See also/Server event|Marker events}}
{{See also/Server event|Marker events}}

Revision as of 10:39, 30 January 2022

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

Parameters

element hitElement, bool matchingDimension

Source

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

Example

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)

Issues

Issue ID Description
#551 If a marker was attached to another element, onMarkerHit won't be triggered
#519 onMarkerHit not always triggered in interiors
#923 Server side markers with size < 1.5 don't trigger event

See Also

Marker events


Event functions