OnPlayerMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (See Also for server events)
No edit summary
(4 intermediate revisions by 3 users not shown)
Line 8: Line 8:
</syntaxhighlight>  
</syntaxhighlight>  


*'''markerHit''': The marker the player hit
*'''markerHit''': the [[marker]] the [[player]] hit.
*'''matchingDimension''': Whether the player and the marker he hit are in the same dimension
*'''matchingDimension''': a [[boolean]] representing whether the [[player]] and the hit [[marker]] are in the same [[dimension]].


==Source==
==Source==
Line 15: Line 15:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example outputs when a player hits a marker.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function markerAlert(markerHit,matchingDimension)
blah()
if (matchingDimension) then -- Make sure the player is in the same dimension as the marker (so they're actually going into it).
--This line does this...
outputChatBox("You have just entered a marker.",source,255,255,0) -- Output that they are.
mooo
end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),markerAlert)
</syntaxhighlight>
</syntaxhighlight>


{{See also/Server event|Player events}}
{{See also/Server event|Player events}}
[[Category:Needs Example]]

Revision as of 03:01, 27 September 2018

This event is triggered when a player hits a marker.

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.

function markerAlert(markerHit,matchingDimension)
	if (matchingDimension) then -- Make sure the player is in the same dimension as the marker (so they're actually going into it).
		outputChatBox("You have just entered a marker.",source,255,255,0) -- Output that they are.
	end
end
addEventHandler("onPlayerMarkerHit",getRootElement(),markerAlert)

See Also

Player events


Event functions