merged register_message into core

This commit is contained in:
David Anderson 2006-05-11 08:36:20 +00:00
parent 441ab14d3b
commit e0fa5227d6
5 changed files with 70 additions and 55 deletions

View File

@ -321,3 +321,4 @@ enum {
#define SND_STOP (1<<5) // stop sound
#define SND_CHANGE_VOL (1<<6) // change sound vol
#define SND_CHANGE_PITCH (1<<7) // change sound pitch

View File

@ -18,6 +18,7 @@
#include <file>
#include <vault>
#include <lang>
#include <messages>
/* Function is called just after server activation.
* Good place for configuration loading, commands and cvars registration. */

View File

@ -33,42 +33,6 @@ native register_touch(Touched[], Toucher[], function[]);
/* Registers a think action to a function by classname. */
native register_think(Classname[], function[]);
/* 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
* either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index. */
native register_message(iMsgId, szFunction[]);
/* 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);
native set_msg_arg_string(argn, szString[]);
/* Gets the origin of a message */
native get_msg_origin(Float:_Origin[3]);
/* NOTE: In old engine versions, this was not the case. Values are now WINDOWS values.
* You must pass with the windows offset (e.g. if 230 on windows, pass 230 no matter what)
* The module will automatically add +5 for Linux.
@ -212,10 +176,6 @@ native Float:halflife_time();
/* Sets map lighting, #OFF to disable. */
native set_lights(const Lighting[]);
/* Sets/Gets what engine messages are blocked. */
native set_msg_block(iMessage, iMessageFlags);
native get_msg_block(iMessage);
/* Sets Player's View to entity iTargetIndex. */
native attach_view(iIndex, iTargetIndex);

View File

@ -20,21 +20,6 @@
#define CAMERA_UPLEFT 2
#define CAMERA_TOPDOWN 3
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
enum {
ARG_BYTE = 1, /* int */
ARG_CHAR, /* int */
ARG_SHORT, /* int */
ARG_LONG, /* int */
ARG_ANGLE, /* float */
ARG_COORD, /* float */
ARG_STRING, /* string */
ARG_ENTITY, /* int */
}
/* Int */
enum {
EV_INT_gamestate = 0,

View File

@ -0,0 +1,68 @@
/* 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
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
enum
{
ARG_BYTE = 1, /* int */
ARG_CHAR, /* int */
ARG_SHORT, /* int */
ARG_LONG, /* int */
ARG_ANGLE, /* float */
ARG_COORD, /* float */
ARG_STRING, /* string */
ARG_ENTITY, /* int */
}
/* 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
* either block it or let it go on its way. The hooked function will be passed a msg_id, msg_dest, and entity index. */
native register_message(iMsgId, szFunction[]);
/* 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);
native set_msg_arg_string(argn, szString[]);
/* Gets the origin of a message */
native get_msg_origin(Float:_Origin[3]);