[Half-Life AMXX] / include / messages.inc Repository:
ViewVC logotype

Annotation of /include/messages.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : ian 1 /* Messaging functions (now part of Core)
2 :     *
3 :     * by the AMX Mod X Development Team
4 :     *
5 :     * This file is provided as is (no warranties).
6 :     */
7 :    
8 :     #if defined _coremsg_included
9 :     #endinput
10 :     #endif
11 :     #define _coremsg_included
12 :    
13 :     #include <message_const>
14 :    
15 :     /* These functinos are used to generate client messages.
16 :     * You may generate menu, smoke, shockwaves, thunderlights,
17 :     * intermission and many many others messages.
18 :     * See HL SDK for more examples. */
19 :     native message_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
20 :     native message_end();
21 :     native write_byte(x);
22 :     native write_char(x);
23 :     native write_short(x);
24 :     native write_long(x);
25 :     native write_entity(x);
26 :     native write_angle(x);
27 :     native write_coord(x);
28 :     native write_string(const x[]);
29 :    
30 :     /* These are the same as above, except that the messages sent
31 :     * are also sent to all other plugins and Metamod plugins.
32 :     * This means that if you send one of these messages, other plugins will
33 :     * be notified, which was previously impossible.
34 :     * BE CAREFUL! Using these incorrectly, or not for their intended purpose,
35 :     * could cause infinite recursion or something just as bad.
36 :     * NOTE! These natives are experimental.
37 :     */
38 :     native emessage_begin(dest, msg_type, const origin[3] = {0,0,0}, player = 0);
39 :     native emessage_end();
40 :     native ewrite_byte(x);
41 :     native ewrite_char(x);
42 :     native ewrite_short(x);
43 :     native ewrite_long(x);
44 :     native ewrite_entity(x);
45 :     native ewrite_angle(x);
46 :     native ewrite_coord(x);
47 :     native ewrite_string(const x[]);
48 :    
49 :     /* Sets/Gets what engine messages are blocked. */
50 :     native set_msg_block(iMessage, iMessageFlags);
51 :     native get_msg_block(iMessage);
52 :    
53 :     /* Lets you directly hook a message in the engine!
54 :     * You can overwrite the message before anything happens and either let the message continue
55 :     * or fully block it. Here is how it works:
56 :     * If you hook a message, the message is stored but not sent. You have the opportunity to
57 :     * not only execute code, but to get/set the contents of the message, before you choose to
58 :     * either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index. */
59 :     native register_message(iMsgId, const szFunction[]);
60 :    
61 :     /* The get/set _msg commands will fail if used outside a hooked message scope.
62 :     * They should never be used unless inside a registered message function.
63 :     * There are eight different ways of sending a message, five are ints, two are floats, and one is string.
64 :     * These are denoted by iArgType. argn is the number
65 :     * of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea.
66 :     * As of AMX Mod X 1.5, the middle parameter of set_* no longer does anything.
67 :     * You cannot change the message argument type (as this would crash the mod anyway)
68 :     */
69 :    
70 :     /* Gets number of arguments that were passed to this message */
71 :     native get_msg_args();
72 :    
73 :     /* Gets the argument type of argument argn */
74 :     native get_msg_argtype(argn);
75 :    
76 :     /* Gets the value of argn. */
77 :     native get_msg_arg_int(argn);
78 :     native Float:get_msg_arg_float(argn);
79 :     native get_msg_arg_string(argn, szReturn[], iLength);
80 :    
81 :     /* sets the value of argn. */
82 :     native set_msg_arg_int(argn, argtype, iValue);
83 :     native set_msg_arg_float(argn, argtype, Float:fValue);
84 :     native set_msg_arg_string(argn, const szString[]);
85 :    
86 :     /* Gets the origin of a message */
87 :     native get_msg_origin(const Float:_Origin[3]);

Contact
ViewVC Help
Powered by ViewVC 1.0.4