OnPlayerContact

From Multi Theft Auto: Wiki
Revision as of 11:02, 1 December 2007 by Lil Toady (talk | contribs) (New page: __NOTOC__ This event is triggered when the player hits an element. ==Syntax== <syntaxhighlight lang="lua"> void onPlayerContact ( element previous, element current ) </syntaxhighlight> ==Parameters== *The ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This event is triggered when the player hits an element.

Syntax

void onPlayerContact ( element previous, element current )

Parameters

  • The source of this event refers to the player who hit an element.
  • previous: the element player was standing on before.
  • current: the element that was hit.

Example

This example outputs the element you have hit

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

See Also