OnPlayerContact: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
</syntaxhighlight>  
</syntaxhighlight>  


*'''previousElement''': The [[element]] player was standing on before. ''nil'' if none.
*'''previousElement''': the [[element]] [[player]] was standing on before. ''nil'' if none.
*'''currentElement''': The new [[element]] that the player is standing on now. ''nil'' if none.
*'''currentElement''': the new [[element]] that the [[player]] is standing on now. ''nil'' if none.


==Source==
==Source==

Latest revision as of 03:01, 27 September 2018

This event is triggered when a player stands on a different element than before.

Parameters

element previousElement, element currentElement
  • previousElement: the element player was standing on before. nil if none.
  • currentElement: the new element that the player is standing on now. nil if none.

Source

The source of this event is the player who hit an element.

Example

This example outputs the element type of an element you have hit

function outputElementType ( prev, current )
	if ( current ) then
		outputChatBox ( "You have hit an "..getElementType ( current ) )
	end
end
addEventHandler ( "onPlayerContact", getRootElement(), outputElementType )

See Also

Player events


Event functions