OnColShapeHit: Difference between revisions
Jump to navigation
Jump to search
JonChappell (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This event is triggered when the player hits a [[colshape]]. | This event is triggered when the player hits a [[colshape]]. | ||
Line 6: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
void onColShapeHit ( player | void onColShapeHit ( player thePlayer, bool matchingDimension ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Parameters== | |||
* The source of this event refers to the col shape which was hit by a player | |||
*'''thePlayer''': A player element referring to the player who entered the col shape. | |||
*'''matchingDimension''': A boolean referring to whether the collision shape was hit in the correct dimension. | |||
==Example== | ==Example== | ||
This example | This example creates a hill area for a king of the hill gamemode. When a player enters the area, it announces it in the chatbox. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
- | hillArea = createColSquare ( -2171.0678710938, 678.17950439453, 0, 15, 15 ) --create our hill area for our gamemode | ||
-- | addEventHandler ( "onColShapeHit", hillArea, "hill_Enter" ) -- add an event handler for onConsole | ||
function hill_Enter ( thePlayer, matchingDimension ) --when a player enters the hill area | |||
outputChatBox( getClientName(thePlayer).." entered the zone!", getRootElement(),255, 255, 109, ) --announce to everyone that the player entered the hill | |||
end | |||
addEventHandler ( "onColShapeLeave", hillArea, "hill_Exit" ) | |||
function hill_Exit ( thePlayer, matchingDimension ) | |||
if isPlayerDead ( player ) ~= true then --check if the player is not dead when he leaves the zone | |||
outputChatBox ( getClientName(player).." left the zone!", getRootElement(), 255, 255, 109 ) --if it is, announce it to everyone | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | |||
{{Event_functions}} |
Revision as of 18:50, 22 April 2007
This event is triggered when the player hits a colshape.
Syntax
void onColShapeHit ( player thePlayer, bool matchingDimension )
Parameters
- The source of this event refers to the col shape which was hit by a player
- thePlayer: A player element referring to the player who entered the col shape.
- matchingDimension: A boolean referring to whether the collision shape was hit in the correct dimension.
Example
This example creates a hill area for a king of the hill gamemode. When a player enters the area, it announces it in the chatbox.
hillArea = createColSquare ( -2171.0678710938, 678.17950439453, 0, 15, 15 ) --create our hill area for our gamemode addEventHandler ( "onColShapeHit", hillArea, "hill_Enter" ) -- add an event handler for onConsole function hill_Enter ( thePlayer, matchingDimension ) --when a player enters the hill area outputChatBox( getClientName(thePlayer).." entered the zone!", getRootElement(),255, 255, 109, ) --announce to everyone that the player entered the hill end addEventHandler ( "onColShapeLeave", hillArea, "hill_Exit" ) function hill_Exit ( thePlayer, matchingDimension ) if isPlayerDead ( player ) ~= true then --check if the player is not dead when he leaves the zone outputChatBox ( getClientName(player).." left the zone!", getRootElement(), 255, 255, 109 ) --if it is, announce it to everyone end end
See Also
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled