======  OnExecuteCommand hook callback function ======
A plugin may implement an OnExecuteCommand() function and register it as a [[API:Plugin:Hooks|Hook]] to intercept both in-game commands executed by the players and console commands executed by the server admin. The function is called for every in-game command sent from any player and for those server console commands that are not built in in the server.

If the command is in-game, the first parameter to the hook function is the [[API:cPlayer|cPlayer]] object of the player who's executing the command. If the command comes from the server console, the first parameter is nil.
===== Function signature =====
<code lua>
function OnExecuteCommand(Player, CommandSplit)
</code>
Parameters:
| Player | [[API:cPlayer|cPlayer]] | For in-game commands, the player that has sent the message. For console commands, nil. |
| CommandSplit | Table of strings | The command and its parameters, broken into a table by spaces. |

===== Return values =====
If the plugin returns true the command will be blocked. if the plugin returns false the command will be executed

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