OnPlayerMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Changed example, added note about attaching this event)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__
{{Server event}}
This event is triggered when a [[player]] hits a [[marker]].
{{Note|This event is triggered for <b>players</b> only. Attaching this event to a marker does nothing.}}


__NOTOC__
==Parameters==
This event is triggered when a player hits a marker.
 
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onPlayerMarkerHit ( marker hitmarker, bool matchingDimension )   
marker markerHit, bool matchingDimension
</syntaxhighlight>  
</syntaxhighlight>  
*'''markerHit''': the [[marker]] the [[player]] hit.
*'''matchingDimension''': a [[boolean]] representing whether the [[player]] and the hit [[marker]] are in the same [[dimension]].
==Source==
The [[event system#Event source|source]] of this event is the [[player]] that hit the marker.


==Example==  
==Example==  
This example does...
This example outputs when a player hits a marker.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addEventHandler('onPlayerMarkerHit', root, function(marker, dimension)
blabhalbalhb --abababa
if not dim then return end -- check if player is actually going into the marker
--This line does this...
outputChatBox('You have just entered a marker!', source, 255, 255, 0) -- output something
mooo
end)
</syntaxhighlight>
</syntaxhighlight>
{{See also/Server event|Player events}}

Latest revision as of 18:20, 2 September 2023

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 dim 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