From Multi Theft Auto: Wiki

This event is triggered when a player uses say, teamsay, me successfully. Or when any message is output to chat using outputChatBox on the server side. It can be used to get the resource responsible for 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 player element if chatbox output was done via say, teamsay or me. Resource if it was done via outputChatBox.


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 supported server 1.1.1-9.03316
Minimum supported client n/a

Note: Using this function 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