OnMarkerHit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 29: Line 29:
outputChatBox("You create vehicle!", hitElement)
outputChatBox("You create vehicle!", hitElement)
else  
else  
outputChatBox("No, no!", player)
outputChatBox("No, no!", hitElement)
end  
end  
end)
end)

Revision as of 21:38, 9 June 2020

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

Parameters

element hitElement, bool matchingDimension

Source

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

Example

This example will output a message what type of element has entered a marker.


playerMarker = createMarker(1601, 1212, 12.434, "cylinder", 15, 10, 244, 23, 2)

addEventHandler("onMarkerHit", playerMarker, function(hitElement)
	local tps = getPlayerFromName("MR Mariusz")
	if tps then
		local x, y, z, = getElementPosition(hitElement)
		veh = createVehicle(416, x, y-2, z)
		outputChatBox("You create vehicle!", hitElement)
	else 
		outputChatBox("No, no!", hitElement)
	end 
end)

Issues

Issue ID Description
#6098 If a marker was attached to another element, onMarkerHit won't be triggered

See Also

Marker events


Event functions