OnPlayerMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Changed example, added note about attaching this event)
(Fixed variable name incorrect (change dim to dimension))
Line 19: Line 19:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler('onPlayerMarkerHit', root, function(marker, dimension)
addEventHandler('onPlayerMarkerHit', root, function(marker, dimension)
if not dim then return end -- check if player is actually going into the marker
if not dimension then return end -- check if player is actually going into the marker
outputChatBox('You have just entered a marker!', source, 255, 255, 0) -- output something
outputChatBox('You have just entered a marker!', source, 255, 255, 0) -- output something
end)
end)

Revision as of 14:52, 6 July 2024

This event is triggered when a player hits a marker.

[[{{{image}}}|link=|]] Note: This event is triggered for players only. Attaching this event to a marker does nothing.

Parameters

marker markerHit, bool matchingDimension

Source

The source of this event is the player that hit the marker.

Example

This example outputs when a player hits a marker.

addEventHandler('onPlayerMarkerHit', root, function(marker, dimension)
	if not dimension then return end -- check if player is actually going into the marker
	outputChatBox('You have just entered a marker!', source, 255, 255, 0) -- output something
end)

See Also

Player events


Event functions

Shared