From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is triggered when any message is output to chat using outputChatBox server-side (also when a player uses say, teamsay or me successfully).

[[{{{image}}}|link=|]] Note: It can be used to get the element responsible for a specific outputChatBox call via the second parameter.


string theMessage, resource / element theElement
  • theMessage: A string representing the text that was output to the chatbox.
  • theElement: A resource if it was done via outputChatBox or a player element if it was done via say, teamsay or me.


The source of this event is the root element.


This example outputs all chat messages to debug view.

function onChatMessageHandler(theMessage, thePlayer)
addEventHandler("onChatMessage", root, onChatMessageHandler)


Minimum server version 1.1.1-9.03316
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.1.1-9.03316" />

See Also

Server events

Event functions