OnMarkerHit: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 20: | Line 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
playerMarker = createMarker(1601, 1212, 12.434, "cylinder", 15, 10, 244, 23, 2) | |||
function | addEventHandler("onMarkerHit", playerMarker, function(hitElement) | ||
local tps = getPlayerFromName("MR Mariusz") | |||
if tps then | |||
end | local x, y, z, = getElementPosition(hitElement) | ||
veh = createVehicle(416, x, y-2, z) | |||
outputChatBox("You create vehicle!", hitElement) | |||
else | |||
outputChatBox("No, no!", player) | |||
end | |||
end) | |||
</syntaxhighlight> | |||
==Issues== | ==Issues== |
Revision as of 21:38, 9 June 2020
This event is triggered when an element enters a marker created using createMarker.
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
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.
playerMarker = createMarker(1601, 1212, 12.434, "cylinder", 15, 10, 244, 23, 2) addEventHandler("onMarkerHit", playerMarker, function(hitElement) local tps = getPlayerFromName("MR Mariusz") if tps then local x, y, z, = getElementPosition(hitElement) veh = createVehicle(416, x, y-2, z) outputChatBox("You create vehicle!", hitElement) else outputChatBox("No, no!", player) end end)
Issues
Issue ID | Description |
---|---|
#6098 | If a marker was attached to another element, onMarkerHit won't be triggered |
See Also
Marker events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled