onPlayerContact | Multi Theft Auto: Wiki Skip to content

onPlayerContact

Client-side
Server-side
Shared

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

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

Code Examples

server

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