native register_message(iMsgId, const szFunction[]);
Lets you directly hook a message in the engine.
-
The function is called in the following manner:
msg_id - Message id
msg_dest - Destination type (see MSG_* constants in messages_const.inc)
msg_entity - Entity receiving the message
-
You can overwrite the message before anything happens by using the
set_msg_arg_* functions and either let the message continue by
returning PLUGIN_CONTINUE or fully block it with PLUGIN_HANDLED.
-
If you hook a message, the message is stored but not sent. You have
the opportunity to not only execute code, but to get/set the contents
of the message before you choose to either block it or let it go on
its way.
-
The return value can be passed to unregister_message() in order to
stop the message from being hooked.
- iMsgId — Message id
- szFunction — Function that will be called
Id that can be passed to unregister_message() on
success, or 0 if an invalid message id is passed
-
If the specified function can't be found, an
error will be thrown.