OnPlayerChat
Jump to navigation
Jump to search
onPlayerChat
Triggered when a player submits a normal chat message.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerChat(playerId, message, channel)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The player that sent the message. |
message |
string |
The validated message text. |
channel |
string |
The chat channel name; the bundled chat resource currently uses global. |
Examples
Handle the event:
addEventHandler("onPlayerChat", root, function(playerId, message, channel)
outputDebugString("[" .. channel .. "] " .. getPlayerName(playerId) .. ": " .. message)
end)
Notes
- Slash commands are dispatched through onPlayerCommand and are not broadcast as chat messages.
- When a script handles this event, the bundled chat resource does not perform its fallback broadcast.