OnClientMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client event}} This event is triggered when a player enters a marker created using createMarker. ==Parameters== <syntaxhighlight lang="lua"> player hitPlayer, bool matchingDimension </co...)
 
No edit summary
 
(10 intermediate revisions by 6 users not shown)
Line 2: Line 2:
{{Client event}}
{{Client event}}
This event is triggered when a player enters a marker created using [[createMarker]].
This event is triggered when a player enters a marker created using [[createMarker]].
{{Important Note|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==
==Parameters==
Line 8: Line 10:
</syntaxhighlight>  
</syntaxhighlight>  


*'''hitPlayer:''' The player that hit the marker
*'''hitPlayer:''' the [[player]] that hit the [[marker]].
*'''matchingDimension:''' ''true'' if the player is in the same dimension as the marker he hit
*'''matchingDimension:''' ''true'' if the [[player]] is in the same [[dimension]] as the hit [[marker]].


==Source==
==Source==
Line 21: Line 23:
outputChatBox ( getPlayerName(hitPlayer) .. " entered a marker" )
outputChatBox ( getPlayerName(hitPlayer) .. " entered a marker" )
end
end
addEventHandler ( "onMarkerHit", getRootElement(), MarkerHit )
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
===Client marker events===
{{Client marker events}}
{{Client marker events}}
===Client marker functions===
{{Client_marker_functions}}

Latest revision as of 20:39, 20 September 2023

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


[[{{{image}}}|link=|]] Important Note: 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

player hitPlayer, bool matchingDimension

Source

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

Example

This code will output a message to the chatbox whenever any player walks into any marker.

function MarkerHit ( hitPlayer, matchingDimension )
	outputChatBox ( getPlayerName(hitPlayer) .. " entered a marker" )
end
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )

See Also

Client marker events


Client marker functions