OnColShapeLeave: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 11: Line 11:
* The source of this event refers to the col object in which an element has left
* The source of this event refers to the col object in which an element has left
*'''leaveElement''': The [[element]] that who exited the col shape.
*'''leaveElement''': The [[element]] that who exited the col shape.
*'''matchingDimension''': a boolean referring to whether the collision shape was in the same dimension as the element.


==Example==  
==Example==  

Revision as of 11:42, 24 December 2007

This event is triggered when a player leaves a collision shape.

Syntax

onColShapeLeave ( element leaveElement, bool matchingDimension )


Variables

  • The source of this event refers to the col object in which an element has left
  • leaveElement: The element that who exited the col shape.
  • matchingDimension: a boolean referring to whether the collision shape was in the same dimension as the element.

Example

This example kills the player whenever they leave a certain collision shape:

jailZone = createColCircle ( 1024, 1024, 15, 50 ) -- create a collision shape

-- call 'jailZoneLeave' whenever a player leaves the collision shape:
addEventHandler ( "onColShapeLeave", jailZone, "jailZoneLeave" )
function jailZoneLeave ( thePlayer )
   killPlayer ( thePlayer ) -- kill the player
   outputChatBox ( "You are not allowed to leave the jail!", thePlayer )
end

See Also