OnPlayerContact: Difference between revisions
Jump to navigation
Jump to search
(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 ...) |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This event is triggered when | {{Server event}} | ||
This event is triggered when a player stands on an element. | |||
== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element previous, element current | |||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''previous''': the [[element]] player was standing on before. | *'''previous''': the [[element]] player was standing on before. | ||
*'''current''': the element that | *'''current''': the new [[element]] that the player is standing on. | ||
==Source== | |||
The [[event system#Event source|source]] of this event is the [[player]] who hit an element. | |||
==Example== | ==Example== | ||
This example outputs the element you have hit | This example outputs the element type of an element you have hit | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function outputElementType ( prev, current ) | ||
if ( current | if ( current ) then | ||
outputChatBox ( "You have hit an "..getElementType ( current ) ) | outputChatBox ( "You have hit an "..getElementType ( current ) ) | ||
end | end | ||
end | end | ||
addEventHandler ( "onPlayerContact", getRootElement(), | addEventHandler ( "onPlayerContact", getRootElement(), outputElementType ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Event_functions}} | {{Event_functions}} |
Revision as of 14:03, 1 December 2007
This event is triggered when a player stands on an element.
Parameters
element previous, element current
- previous: the element player was standing on before.
- current: the new element that the player is standing on.
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
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled