OnChatMessage: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Server event}} | {{Server event}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature|3.0120|1.2| | {{New feature|3.0120|1.2| | ||
'''Available only in MTA SA 1.2 and onwards''' | '''Available only in MTA SA 1.2 and onwards''' | ||
}} | }} | ||
This event is triggered when a player uses say, teamsay, me successfully. Or when any message is | This event is triggered when a player uses say, teamsay, me successfully. Or when any message is output to chat using [[outputChatBox]]. It can be used to get the resource responsible for specific [[outputChatBox]] call via the second parameter. | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string theMessage, element | string theMessage, resource / element theElement | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''theMessage:''' The text that was output to the chatbox | *'''theMessage:''' The text that was output to the chatbox | ||
*''' | *'''theElement:''' Player element if chatbox output was done via say, teamsay or me. Resource element if it was done via [[outputChatBox]]. | ||
==Source== | ==Source== |
Revision as of 22:52, 29 October 2011
Available only in MTA SA 1.2 and onwards This event is triggered when a player uses say, teamsay, me successfully. Or when any message is output to chat using outputChatBox. It can be used to get the resource responsible for specific outputChatBox call via the second parameter.
Parameters
string theMessage, resource / element theElement
- theMessage: The text that was output to the chatbox
- theElement: Player element if chatbox output was done via say, teamsay or me. Resource element if it was done via outputChatBox.
Source
The source of this event is the root element.
Example
This example outputs all chat messages to debug view.
[lua] function onChatMessageHandler(theMessage, thePlayer) outputDebugString(theMessage) end addEventHandler("onChatMessage", root, onChatMessageHandler)
Requirements
This template will be deleted.
See Also
Server events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled