OnPlayerChat

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:31, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.