onChatMessage | Multi Theft Auto: Wiki Skip to content

onChatMessage

Client-side
Server-side
Shared

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).

It can be used to get the element responsible for a specific outputChatBox call via the second parameter.

Parameters

string theMessage, 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.

Source

element: The source of this event is the root element.

Code Examples

server

This example outputs all chat messages to debug view.

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