OnChatMessage: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 26: | Line 26: | ||
addEventHandler("onChatMessage", root, onChatMessageHandler) | addEventHandler("onChatMessage", root, onChatMessageHandler) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Requirements== | |||
{{Requirements|1.1.1-9.03316|n/a|}} | |||
{{See also/Server event|Server events}} | {{See also/Server event|Server events}} | ||
Revision as of 23:28, 21 October 2011
| This article needs checking. | |
Reason(s): thePlayer arguement from a say command returns userdata but is not an element, teamsay and me worked however. |
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 sent to a player using outputChatBox.
Parameters
string theMessage, element thePlayer
- theMessage: The text that was output to the chatbox
- thePlayer: The player who triggered the event (needs checking)
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