====== OnChat hook ======
A plugin may implement an OnChat() function and register it as a [[API:Plugin:Hooks|Hook]] to process chat messages from the players. The function is then called for every in-game message sent from any player.
Note that commands are handled separately using a [[API:CommandFramework|command framework API]].

===== Function signature =====
<code lua>
function OnChat(Player, Message)
</code>
Parameters:
| Player | cPlayer | The player that has sent the message |
| Message | string | The message |

===== Return values =====
If the plugin returns false, the message is broadcast to all players in the world.
If the plugin returns true, no message is broadcast and no further action is taken.

===== Registering the callback =====
To register your plugin to receive a callback through this function, use the hook [[api:plugin:hooks|HOOK_CHAT]]
<code lua>
PluginManager = cPluginManager:GetPluginManager()
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT)
</code>