OnElementColShapeLeave: Difference between revisions

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


*'''theColShape''': The [[colshape]] that this element left the area of
*'''theColShape''': the [[colshape]] that this [[element]] left the area of.
*'''matchingDimension''': True if the colshape and the element that left it are in the same dimension
*'''matchingDimension''': a [[boolean]] representing if the [[element]] and the [[colshape]] are in the same [[dimension]].


==Source==
==Source==
Line 15: Line 15:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example prints type of the element which left the created colshape to chatbox.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
colArea = createColCircle( 1400.0, -700.0, 5.0 ) -- create the colshape
blah()
 
--This line does this...
function elementColShapeLeave( colShapeLeft )
mooo
    if colShapeLeft == colArea then -- if element left the created colshape
        outputChatBox( getElementType( source ) .. " left the colCircle!" ) -- print the type of the element to chatbox
    end
end
addEventHandler( "onElementColShapeLeave", getRootElement(), elementColShapeLeave ) -- add a handler function for the event
</syntaxhighlight>
</syntaxhighlight>


==See Also==
{{See also/Server event|Element events}}
{{Event_functions}}
[[Category:Needs Example]]

Latest revision as of 02:56, 27 September 2018

This event is triggered when an player or vehicle element leaves the area of a colshape.

Parameters

colshape theColShape, bool matchingDimension

Source

The source of this event is the player or vehicle that left colshape.

Example

This example prints type of the element which left the created colshape to chatbox.

colArea = createColCircle( 1400.0, -700.0, 5.0 ) -- create the colshape

function elementColShapeLeave( colShapeLeft )
    if colShapeLeft == colArea then -- if element left the created colshape
        outputChatBox( getElementType( source ) .. " left the colCircle!" ) -- print the type of the element to chatbox
    end
end
addEventHandler( "onElementColShapeLeave", getRootElement(), elementColShapeLeave ) -- add a handler function for the event

See Also

Element events


Event functions