OnMarkerLeave: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: Category:Incomplete Event __NOTOC__ This event is triggered when a player hits a marker. ==Syntax== <syntaxhighlight lang="lua"> void onMarkerHit ( player, bool matchingdimension ) <...)
 
(Improved example.)
 
(14 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__
{{Server event}}
This event is triggered when an element leaves the area of a marker created using [[createMarker]].


__NOTOC__
==Parameters==
This event is triggered when a player hits a marker.
 
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onMarkerHit ( player, bool matchingdimension )           
element leftElement, bool matchingDimension
</syntaxhighlight>  
</syntaxhighlight>  
*'''leftElement''': the [[element]] that left the [[marker|marker's]] area.
*'''matchingDimension''': a [[boolean]] representing whether the [[element]] is in the same dimension as the [[marker]].
==Source==
The [[event system#Event source|source]] of this event is the [[marker]] that the element left.


==Example==  
==Example==  
This example does...
This example shows a message in the chat box when element (in this case a player) leaves a marker.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
local myMarker = createMarker(-2596.6259765625, 579.3583984375, 15.626741409302, "cylinder", 2.0, 255, 0, 0, 150)
blabhalbalhb --abababa
 
--This line does this...
function markerLeave(leaveElement, matchingDimension)
mooo
local elementType = getElementType(leaveElement)
 
if elementType == "player" then
outputChatBox("Player has left a marker.", root, 255, 255, 0)
end
end
addEventHandler("onMarkerLeave", myMarker, markerLeave)
</syntaxhighlight>
</syntaxhighlight>
{{See also/Server event|Marker events}}

Latest revision as of 13:48, 24 February 2021

This event is triggered when an element leaves the area of a marker created using createMarker.

Parameters

element leftElement, bool matchingDimension

Source

The source of this event is the marker that the element left.

Example

This example shows a message in the chat box when element (in this case a player) leaves a marker.

local myMarker = createMarker(-2596.6259765625, 579.3583984375, 15.626741409302, "cylinder", 2.0, 255, 0, 0, 150)

function markerLeave(leaveElement, matchingDimension)
	local elementType = getElementType(leaveElement)

	if elementType == "player" then
		outputChatBox("Player has left a marker.", root, 255, 255, 0)
	end
end
addEventHandler("onMarkerLeave", myMarker, markerLeave)

See Also

Marker events


Event functions