2006-05-11 08:36:20 +00:00
|
|
|
/* Messaging functions (now part of Core)
|
|
|
|
*
|
|
|
|
* by the AMX Mod X Development Team
|
|
|
|
*
|
|
|
|
* This file is provided as is (no warranties).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined _coremsg_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _coremsg_included
|
|
|
|
|
2006-05-17 20:08:04 +00:00
|
|
|
#include <message_const>
|
2006-05-11 08:36:20 +00:00
|
|
|
|
2006-05-17 20:08:04 +00:00
|
|
|
/* These functinos are used to generate client messages.
|
|
|
|
* You may generate menu, smoke, shockwaves, thunderlights,
|
|
|
|
* intermission and many many others messages.
|
|
|
|
* See HL SDK for more examples. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native message_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
|
2013-08-10 08:22:38 +00:00
|
|
|
native message_begin_f(dest, msg_type, const Float:origin[3] = {0.0,0.0,0.0}, player = 0);
|
2006-05-17 20:08:04 +00:00
|
|
|
native message_end();
|
|
|
|
native write_byte(x);
|
|
|
|
native write_char(x);
|
|
|
|
native write_short(x);
|
|
|
|
native write_long(x);
|
|
|
|
native write_entity(x);
|
|
|
|
native write_angle(x);
|
2013-08-10 08:22:38 +00:00
|
|
|
native write_angle_f(Float:x);
|
2006-05-17 20:08:04 +00:00
|
|
|
native write_coord(x);
|
2013-08-10 08:22:38 +00:00
|
|
|
native write_coord_f(Float:x);
|
2007-01-26 05:56:10 +00:00
|
|
|
native write_string(const x[]);
|
2006-05-11 08:36:20 +00:00
|
|
|
|
2006-06-28 10:01:55 +00:00
|
|
|
/* These are the same as above, except that the messages sent
|
|
|
|
* are also sent to all other plugins and Metamod plugins.
|
|
|
|
* This means that if you send one of these messages, other plugins will
|
|
|
|
* be notified, which was previously impossible.
|
|
|
|
* BE CAREFUL! Using these incorrectly, or not for their intended purpose,
|
|
|
|
* could cause infinite recursion or something just as bad.
|
|
|
|
* NOTE! These natives are experimental.
|
|
|
|
*/
|
2007-01-26 05:56:10 +00:00
|
|
|
native emessage_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
|
2013-08-10 08:22:38 +00:00
|
|
|
native emessage_begin_f(dest, msg_type, const Float:origin[3] = {0.0,0.0,0.0}, player = 0);
|
2006-06-28 10:01:55 +00:00
|
|
|
native emessage_end();
|
|
|
|
native ewrite_byte(x);
|
|
|
|
native ewrite_char(x);
|
|
|
|
native ewrite_short(x);
|
|
|
|
native ewrite_long(x);
|
|
|
|
native ewrite_entity(x);
|
|
|
|
native ewrite_angle(x);
|
2013-08-10 08:22:38 +00:00
|
|
|
native ewrite_angle_f(Float:x);
|
2006-06-28 10:01:55 +00:00
|
|
|
native ewrite_coord(x);
|
2013-08-10 08:22:38 +00:00
|
|
|
native ewrite_coord_f(Float:x);
|
2007-01-26 05:56:10 +00:00
|
|
|
native ewrite_string(const x[]);
|
2006-06-28 10:01:55 +00:00
|
|
|
|
2006-05-11 08:36:20 +00:00
|
|
|
/* Sets/Gets what engine messages are blocked. */
|
|
|
|
native set_msg_block(iMessage, iMessageFlags);
|
|
|
|
native get_msg_block(iMessage);
|
|
|
|
|
|
|
|
/* Lets you directly hook a message in the engine!
|
|
|
|
* You can overwrite the message before anything happens and either let the message continue
|
|
|
|
* or fully block it. Here is how it works:
|
|
|
|
* 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
|
2008-04-29 02:18:39 +00:00
|
|
|
* either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index.
|
|
|
|
* The return value can be passed to unregister_message() to stop the message from being hooked */
|
2007-01-26 05:56:10 +00:00
|
|
|
native register_message(iMsgId, const szFunction[]);
|
2006-05-11 08:36:20 +00:00
|
|
|
|
2008-04-29 02:18:39 +00:00
|
|
|
/* Unregisters a message hook previously created with register_message
|
|
|
|
* You must pass the proper message id, and return value from the message to unregister the message successfully. */
|
|
|
|
native unregister_message(iMsgId, registeredmsg);
|
|
|
|
|
|
|
|
|
2006-05-11 08:36:20 +00:00
|
|
|
/* The get/set _msg commands will fail if used outside a hooked message scope.
|
|
|
|
* They should never be used unless inside a registered message function.
|
|
|
|
* There are eight different ways of sending a message, five are ints, two are floats, and one is string.
|
|
|
|
* These are denoted by iArgType. argn is the number
|
|
|
|
* of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea.
|
|
|
|
* As of AMX Mod X 1.5, the middle parameter of set_* no longer does anything.
|
|
|
|
* You cannot change the message argument type (as this would crash the mod anyway)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Gets number of arguments that were passed to this message */
|
|
|
|
native get_msg_args();
|
|
|
|
|
|
|
|
/* Gets the argument type of argument argn */
|
|
|
|
native get_msg_argtype(argn);
|
|
|
|
|
|
|
|
/* Gets the value of argn. */
|
|
|
|
native get_msg_arg_int(argn);
|
|
|
|
native Float:get_msg_arg_float(argn);
|
|
|
|
native get_msg_arg_string(argn, szReturn[], iLength);
|
|
|
|
|
|
|
|
/* sets the value of argn. */
|
|
|
|
native set_msg_arg_int(argn, argtype, iValue);
|
|
|
|
native set_msg_arg_float(argn, argtype, Float:fValue);
|
2007-01-26 05:56:10 +00:00
|
|
|
native set_msg_arg_string(argn, const szString[]);
|
2006-05-11 08:36:20 +00:00
|
|
|
|
|
|
|
/* Gets the origin of a message */
|
2007-01-26 05:56:10 +00:00
|
|
|
native get_msg_origin(const Float:_Origin[3]);
|