Merge pull request #108 from Nextra/inc-doc

Update include documentation (mainly amxmodx.inc)
This commit is contained in:
Vincent Herbet 2014-08-08 01:25:56 +02:00
commit c22bb12c1e
7 changed files with 4839 additions and 2038 deletions

View File

@ -15,191 +15,223 @@
#include <amxmodx_version> #include <amxmodx_version>
/** /**
* This is the buffer size AMX Mod X uses internally to retrieve strings from plugins. * Internal AMXX buffer size for string retrieval.
* Most natives that take strings as arguments will implicitly truncate those to this maximum length.
* This has been raised to the current value with AMXX 1.8.3. Previously the limit was 3072.
* *
* @note This is here mainly for documentation purposes. By default plugins don't even have enough * @note This is the buffer size AMX Mod X uses internally to retrieve strings
* memory available to create an array of this size. You probably should not use this to * from plugins. Most natives that take strings as arguments will
* actually *declare* a buffer unless you *absolutely* have to. Look at #pragma dynamic * implicitly truncate them to this maximum length. This has been raised
* to increase a plugins available memory. * to the current value with AMXX 1.8.3. Previously the limit was 3072.
* @note This is here mainly for documentation purposes. By default plugins
* don't have enough memory available to allocate an array of this size.
* You probably should not use this to actually declare a buffer unless
* you *absolutely* have to. Look at #pragma dynamic to increase a plugins
* available memory.
*/ */
#define MAX_STRING_LENGTH 16384 #define MAX_STRING_LENGTH 16384
/** /**
* MAX_PLAYERS is not the same as MaxClients. * Defines and constants related to the maximum number of clients.
* MAX_PLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server. *
* @note MAX_PLAYERS is not the same as MaxClients. MAX_PLAYERS is a hardcoded
* value as an upper limit, used mainly to declare arrays big enough for
* all possible server situations. MaxClients changes based on the
* server the plugin is deployed on..
*/ */
#define MAX_PLAYERS 33 /* Maximum number of players AMX Mod X supports */ #define MAX_PLAYERS 33 /* Maximum number of players AMX Mod X supports */
#define MAX_NAME_LENGTH 32 /* Maximum buffer required to store a client name */
public stock const MaxClients; /* Maximum number of players the server supports (dynamic) */ public stock const MaxClients; /* Maximum number of players the server supports */
/**
* The maximum buffer size required to store a clients name.
*/
#define MAX_NAME_LENGTH 32
/**
* π
*/
#define M_PI 3.1415926535 #define M_PI 3.1415926535
/**
* @section Admin privilege and authentication constants
*/
/** /**
* Admin level constants * Admin level constants
*/ */
#define ADMIN_ALL 0 /* everyone */ #define ADMIN_ALL 0 /* everyone */
#define ADMIN_IMMUNITY (1<<0) /* flag "a" */ #define ADMIN_IMMUNITY (1<<0) /* flag "a" */
#define ADMIN_RESERVATION (1<<1) /* flag "b" */ #define ADMIN_RESERVATION (1<<1) /* flag "b" */
#define ADMIN_KICK (1<<2) /* flag "c" */ #define ADMIN_KICK (1<<2) /* flag "c" */
#define ADMIN_BAN (1<<3) /* flag "d" */ #define ADMIN_BAN (1<<3) /* flag "d" */
#define ADMIN_SLAY (1<<4) /* flag "e" */ #define ADMIN_SLAY (1<<4) /* flag "e" */
#define ADMIN_MAP (1<<5) /* flag "f" */ #define ADMIN_MAP (1<<5) /* flag "f" */
#define ADMIN_CVAR (1<<6) /* flag "g" */ #define ADMIN_CVAR (1<<6) /* flag "g" */
#define ADMIN_CFG (1<<7) /* flag "h" */ #define ADMIN_CFG (1<<7) /* flag "h" */
#define ADMIN_CHAT (1<<8) /* flag "i" */ #define ADMIN_CHAT (1<<8) /* flag "i" */
#define ADMIN_VOTE (1<<9) /* flag "j" */ #define ADMIN_VOTE (1<<9) /* flag "j" */
#define ADMIN_PASSWORD (1<<10) /* flag "k" */ #define ADMIN_PASSWORD (1<<10) /* flag "k" */
#define ADMIN_RCON (1<<11) /* flag "l" */ #define ADMIN_RCON (1<<11) /* flag "l" */
#define ADMIN_LEVEL_A (1<<12) /* flag "m" */ #define ADMIN_LEVEL_A (1<<12) /* flag "m" */
#define ADMIN_LEVEL_B (1<<13) /* flag "n" */ #define ADMIN_LEVEL_B (1<<13) /* flag "n" */
#define ADMIN_LEVEL_C (1<<14) /* flag "o" */ #define ADMIN_LEVEL_C (1<<14) /* flag "o" */
#define ADMIN_LEVEL_D (1<<15) /* flag "p" */ #define ADMIN_LEVEL_D (1<<15) /* flag "p" */
#define ADMIN_LEVEL_E (1<<16) /* flag "q" */ #define ADMIN_LEVEL_E (1<<16) /* flag "q" */
#define ADMIN_LEVEL_F (1<<17) /* flag "r" */ #define ADMIN_LEVEL_F (1<<17) /* flag "r" */
#define ADMIN_LEVEL_G (1<<18) /* flag "s" */ #define ADMIN_LEVEL_G (1<<18) /* flag "s" */
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */ #define ADMIN_LEVEL_H (1<<19) /* flag "t" */
#define ADMIN_MENU (1<<20) /* flag "u" */ #define ADMIN_MENU (1<<20) /* flag "u" */
#define ADMIN_BAN_TEMP (1<<21) /* flag "v" */ #define ADMIN_BAN_TEMP (1<<21) /* flag "v" */
#define ADMIN_ADMIN (1<<24) /* flag "y" */ #define ADMIN_ADMIN (1<<24) /* flag "y" */
#define ADMIN_USER (1<<25) /* flag "z" */ #define ADMIN_USER (1<<25) /* flag "z" */
#define FLAG_KICK (1<<0) /* flag "a" */ /**
#define FLAG_TAG (1<<1) /* flag "b" */ * Admin authentication behavior flags
#define FLAG_AUTHID (1<<2) /* flag "c" */ */
#define FLAG_IP (1<<3) /* flag "d" */ #define FLAG_KICK (1<<0) /* flag "a" */
#define FLAG_NOPASS (1<<4) /* flag "e" */ #define FLAG_TAG (1<<1) /* flag "b" */
#define FLAG_CASE_SENSITIVE (1<<10) /* flag "k" */ #define FLAG_AUTHID (1<<2) /* flag "c" */
#define FLAG_IP (1<<3) /* flag "d" */
#define FLAG_NOPASS (1<<4) /* flag "e" */
#define FLAG_CASE_SENSITIVE (1<<10) /* flag "k" */
/**
* @endsection
*/
/** /**
* Return codes * Return codes
*/ */
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */ #define PLUGIN_CONTINUE 0 /* Results returned by public functions */
#define PLUGIN_HANDLED 1 /* stop other plugins */ #define PLUGIN_HANDLED 1 /* stop other plugins */
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */ #define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
/** /**
* CVAR constants for register_cvar() * CVAR flags for register_cvar()
*/ */
#define FCVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */ #define FCVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */
#define FCVAR_USERINFO 2 /* changes the client's info string */ #define FCVAR_USERINFO 2 /* changes the client's info string */
#define FCVAR_SERVER 4 /* notifies players when changed */ #define FCVAR_SERVER 4 /* notifies players when changed */
#define FCVAR_EXTDLL 8 /* defined by external DLL */ #define FCVAR_EXTDLL 8 /* defined by external DLL */
#define FCVAR_CLIENTDLL 16 /* defined by the client dll */ #define FCVAR_CLIENTDLL 16 /* defined by the client dll */
#define FCVAR_PROTECTED 32 /* It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value */ #define FCVAR_PROTECTED 32 /* It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value */
#define FCVAR_SPONLY 64 /* This cvar cannot be changed by clients connected to a multiplayer server. */ #define FCVAR_SPONLY 64 /* This cvar cannot be changed by clients connected to a multiplayer server. */
#define FCVAR_PRINTABLEONLY 128 /* This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). */ #define FCVAR_PRINTABLEONLY 128 /* This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). */
#define FCVAR_UNLOGGED 256 /* If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */ #define FCVAR_UNLOGGED 256 /* If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
/** /**
* IDs of weapons in CS * IDs of weapons in CS
*/ */
#define CSW_P228 1 #define CSW_P228 1
#define CSW_SCOUT 3 #define CSW_SCOUT 3
#define CSW_HEGRENADE 4 #define CSW_HEGRENADE 4
#define CSW_XM1014 5 #define CSW_XM1014 5
#define CSW_C4 6 #define CSW_C4 6
#define CSW_MAC10 7 #define CSW_MAC10 7
#define CSW_AUG 8 #define CSW_AUG 8
#define CSW_SMOKEGRENADE 9 #define CSW_SMOKEGRENADE 9
#define CSW_ELITE 10 #define CSW_ELITE 10
#define CSW_FIVESEVEN 11 #define CSW_FIVESEVEN 11
#define CSW_UMP45 12 #define CSW_UMP45 12
#define CSW_SG550 13 #define CSW_SG550 13
#define CSW_GALI 14 #define CSW_GALI 14
#define CSW_GALIL 14 #define CSW_GALIL 14
#define CSW_FAMAS 15 #define CSW_FAMAS 15
#define CSW_USP 16 #define CSW_USP 16
#define CSW_GLOCK18 17 #define CSW_GLOCK18 17
#define CSW_AWP 18 #define CSW_AWP 18
#define CSW_MP5NAVY 19 #define CSW_MP5NAVY 19
#define CSW_M249 20 #define CSW_M249 20
#define CSW_M3 21 #define CSW_M3 21
#define CSW_M4A1 22 #define CSW_M4A1 22
#define CSW_TMP 23 #define CSW_TMP 23
#define CSW_G3SG1 24 #define CSW_G3SG1 24
#define CSW_FLASHBANG 25 #define CSW_FLASHBANG 25
#define CSW_DEAGLE 26 #define CSW_DEAGLE 26
#define CSW_SG552 27 #define CSW_SG552 27
#define CSW_AK47 28 #define CSW_AK47 28
#define CSW_KNIFE 29 #define CSW_KNIFE 29
#define CSW_P90 30 #define CSW_P90 30
#define CSW_VEST 31 // Custom #define CSW_VEST 31 // Custom
#define CSW_VESTHELM 32 // Custom #define CSW_VESTHELM 32 // Custom
#define CSW_SHIELDGUN 99 #define CSW_SHIELDGUN 99
/** /**
* HI weapon constants * HI weapon constants
*/ */
#define HIW_BERETTA 1 #define HIW_BERETTA 1
#define HIW_SPAS12 2 #define HIW_SPAS12 2
#define HIW_M4A1 3 #define HIW_M4A1 3
#define HIW_MP5A4 4 #define HIW_MP5A4 4
#define HIW_MP5SD5 5 #define HIW_MP5SD5 5
#define HIW_AK47 6 #define HIW_AK47 6
#define HIW_AKS74U 7 #define HIW_AKS74U 7
#define HIW_GLOCK 8 #define HIW_GLOCK 8
#define HIW_M11 9 #define HIW_M11 9
#define HIW_M11SD 10 #define HIW_M11SD 10
#define HIW_PSG1 11 #define HIW_PSG1 11
#define HIW_ZASTAVA 12 #define HIW_ZASTAVA 12
#define HIW_M16A2 13 #define HIW_M16A2 13
#define HIW_REMINGTON 14 #define HIW_REMINGTON 14
#define HIW_NATOGREN 15 #define HIW_NATOGREN 15
#define HIW_TANGOGREN 16 #define HIW_TANGOGREN 16
#define HIW_FLASHBANG 17 #define HIW_FLASHBANG 17
/** /**
* Parts of body for hits * Parts of body for hits
*/ */
#define HIT_GENERIC 0 /* none */ #define HIT_GENERIC 0 /* none */
#define HIT_HEAD 1 #define HIT_HEAD 1
#define HIT_CHEST 2 #define HIT_CHEST 2
#define HIT_STOMACH 3 #define HIT_STOMACH 3
#define HIT_LEFTARM 4 #define HIT_LEFTARM 4
#define HIT_RIGHTARM 5 #define HIT_RIGHTARM 5
#define HIT_LEFTLEG 6 #define HIT_LEFTLEG 6
#define HIT_RIGHTLEG 7 #define HIT_RIGHTLEG 7
/** /**
* @section Constants for emit_sound() * @section emit_sound() constants
*/ */
/** /**
* Channels * Channels
*/ */
#define CHAN_AUTO 0 #define CHAN_AUTO 0
#define CHAN_WEAPON 1 #define CHAN_WEAPON 1
#define CHAN_VOICE 2 #define CHAN_VOICE 2
#define CHAN_ITEM 3 #define CHAN_ITEM 3
#define CHAN_BODY 4 #define CHAN_BODY 4
#define CHAN_STREAM 5 /* allocate stream channel from the static or dynamic area */ #define CHAN_STREAM 5 /* allocate stream channel from the static or dynamic area */
#define CHAN_STATIC 6 /* allocate channel from the static area */ #define CHAN_STATIC 6 /* allocate channel from the static area */
#define CHAN_NETWORKVOICE_BASE 7 /* voice data coming across the network */ #define CHAN_NETWORKVOICE_BASE 7 /* voice data coming across the network */
#define CHAN_NETWORKVOICE_END 500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */ #define CHAN_NETWORKVOICE_END 500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */
/** /**
*Attenuation values *Attenuation values
*/ */
#define ATTN_NONE 0.00 #define ATTN_NONE 0.00
#define ATTN_NORM 0.80 #define ATTN_NORM 0.80
#define ATTN_IDLE 2.00 #define ATTN_IDLE 2.00
#define ATTN_STATIC 1.25 #define ATTN_STATIC 1.25
/** /**
* Pitch values * Pitch values
*/ */
#define PITCH_NORM 100 /* non-pitch shifted */ #define PITCH_NORM 100 /* non-pitch shifted */
#define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */ #define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */
#define PITCH_HIGH 120 #define PITCH_HIGH 120
/** /**
* Volume values * Volume values
*/ */
#define VOL_NORM 1.0 #define VOL_NORM 1.0
/**
* Sound behavior constants
*/
#define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients
#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
/** /**
* @endsection * @endsection
@ -208,22 +240,26 @@ public stock const MaxClients; /* Maximum number of players the server supports
/** /**
* Menu keys * Menu keys
*/ */
#define MENU_KEY_1 (1<<0) #define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1) #define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2) #define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3) #define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4) #define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5) #define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6) #define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7) #define MENU_KEY_8 (1<<7)
#define MENU_KEY_9 (1<<8) #define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9) #define MENU_KEY_0 (1<<9)
/** /**
* Language constants * Language constants
*/ */
#define LANG_SERVER 0 #define LANG_SERVER 0
#define LANG_PLAYER -1 #define LANG_PLAYER -1
/**
* @section Client print native constants
*/
/** /**
* Destination types for client_print() * Destination types for client_print()
@ -234,13 +270,13 @@ enum
print_console, print_console,
print_chat, print_chat,
print_center, print_center,
print_radio /* Counter-Strike only */ print_radio /* Counter-Strike only */
}; };
/** /**
* Color types for client_print_color() * Color types for client_print_color()
*/ */
enum enum
{ {
print_team_default = 0, print_team_default = 0,
print_team_grey = -1, print_team_grey = -1,
@ -259,20 +295,28 @@ enum
}; };
/** /**
* Render for set_user_rendering() * @endsection
*/
/**
* @section Entity rendering constants
*/
/**
* Rendering modes (i.e. for set_user_rendering())
*/ */
enum enum
{ {
kRenderNormal = 0, /* src */ kRenderNormal = 0, /* src */
kRenderTransColor, /* c*a+dest*(1-a) */ kRenderTransColor, /* c*a+dest*(1-a) */
kRenderTransTexture, /* src*a+dest*(1-a) */ kRenderTransTexture, /* src*a+dest*(1-a) */
kRenderGlow, /* src*a+dest -- No Z buffer checks */ kRenderGlow, /* src*a+dest -- No Z buffer checks */
kRenderTransAlpha, /* src*srca+dest*(1-srca) */ kRenderTransAlpha, /* src*srca+dest*(1-srca) */
kRenderTransAdd, /* src*a+dest */ kRenderTransAdd, /* src*a+dest */
}; };
/** /**
* Fx for set_user_rendering() * Rendering fx (i.e. for set_user_rendering())
*/ */
enum enum
{ {
@ -291,22 +335,26 @@ enum
kRenderFxFlickerSlow, kRenderFxFlickerSlow,
kRenderFxFlickerFast, kRenderFxFlickerFast,
kRenderFxNoDissipation, kRenderFxNoDissipation,
kRenderFxDistort, /* Distort/scale/translate flicker */ kRenderFxDistort, /* Distort/scale/translate flicker */
kRenderFxHologram, /* kRenderFxDistort + distance fade */ kRenderFxHologram, /* kRenderFxDistort + distance fade */
kRenderFxDeadPlayer, /* kRenderAmt is the player index */ kRenderFxDeadPlayer, /* kRenderAmt is the player index */
kRenderFxExplode, /* Scale up really big! */ kRenderFxExplode, /* Scale up really big! */
kRenderFxGlowShell, /* Glowing Shell */ kRenderFxGlowShell, /* Glowing Shell */
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */ kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
}; };
/**
* @endsection
*/
/** /**
* Type for force_unmodified() * Type for force_unmodified()
*/ */
enum enum
{ {
force_exactfile = 0, /* File on client must exactly match server's file */ force_exactfile = 0, /* File on client must exactly match server's file */
force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */ force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */
force_model_specifybounds, /* For model files only, the geometry must fit in the specified bbox */ force_model_specifybounds, /* For model files only, the geometry must fit in the specified bbox */
}; };
/** /**
@ -327,53 +375,74 @@ enum
/** /**
* AMX flag constants * AMX flag constants
*/ */
#define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */ #define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */ #define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */ #define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */ #define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */ #define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */ #define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000 /* busy browsing */ #define AMX_FLAG_BROWSE 0x4000 /* busy browsing */
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */ #define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
#define INVALID_PLUGIN_ID -1 /**
* Invalid plugin id
*/
#define INVALID_PLUGIN_ID -1
#define MENU_TIMEOUT -4 /**
#define MENU_EXIT -3 * Menu and menu item status codes
#define MENU_BACK -2 */
#define MENU_MORE -1 #define MENU_TIMEOUT -4
#define ITEM_IGNORE 0 #define MENU_EXIT -3
#define ITEM_ENABLED 1 #define MENU_BACK -2
#define ITEM_DISABLED 2 #define MENU_MORE -1
#define ITEM_IGNORE 0
#define ITEM_ENABLED 1
#define ITEM_DISABLED 2
#define AMX_ERR_NATIVE 10 /**
#define AMX_ERR_MEMACCESS 5 * AMX error codes
#define AMX_ERR_NONE 0 */
#define AMX_ERR_BOUNDS 4 #define AMX_ERR_NATIVE 10
#define AMX_ERR_STACKERR 3 #define AMX_ERR_MEMACCESS 5
#define AMX_ERR_STACKLOW 7 #define AMX_ERR_NONE 0
#define AMX_ERR_HEAPLOW 8 #define AMX_ERR_BOUNDS 4
#define AMX_ERR_DIVIDE 11 #define AMX_ERR_STACKERR 3
#define AMX_ERR_NOTFOUND 19 #define AMX_ERR_STACKLOW 7
#define AMX_ERR_PARAMS 25 #define AMX_ERR_HEAPLOW 8
#define AMX_ERR_GENERAL 27 #define AMX_ERR_DIVIDE 11
#define AMX_ERR_NOTFOUND 19
#define AMX_ERR_PARAMS 25
#define AMX_ERR_GENERAL 27
#define INVALID_HANDLE -1 /**
* Generic invalid handle value
*/
#define INVALID_HANDLE -1
#define ET_IGNORE 0 //ignore return val /**
#define ET_STOP 1 //stop on PLUGIN_HANDLED * @section Plugin forward related constants
#define ET_STOP2 2 //same, except return biggest */
#define ET_CONTINUE 3 //no stop, return biggest
#define FP_CELL 0 /**
#define FP_FLOAT 1 * Stop types for plugin forwards
#define FP_STRING 2 */
#define FP_ARRAY 4 #define ET_IGNORE 0 //ignore return val
#define ET_STOP 1 //stop on PLUGIN_HANDLED
#define ET_STOP2 2 //same, except return biggest
#define ET_CONTINUE 3 //no stop, return biggest
#define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients /**
#define SND_STOP (1<<5) // stop sound * Parameter types for plugin forwards
#define SND_CHANGE_VOL (1<<6) // change sound vol */
#define SND_CHANGE_PITCH (1<<7) // change sound pitch #define FP_CELL 0
#define FP_FLOAT 1
#define FP_STRING 2
#define FP_ARRAY 4
/**
* @endsection
*/
/** /**
* LibType constants * LibType constants

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
// vim: set ts=4 sw=4 tw=99 noet: // vim: set ts=4 sw=4 tw=99 noet:
// //
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO"). // AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team. // Copyright (C) The AMX Mod X Development Team.
// //
// This software is licensed under the GNU General Public License, version 3 or higher. // This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit: // Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license // https://alliedmods.net/amxmodx-license
#if defined _cellarray_included #if defined _cellarray_included
#endinput #endinput
#endif #endif
@ -14,23 +14,28 @@
#define _cellarray_included #define _cellarray_included
/** /**
* These arrays are intended to be used for a form of global storage without * Cellarray tag declaration
* requiring a #define that needs to be increased each time a person needs more *
* storage. * @note These dynamic arrays are intended to be used for a form of global
* These are not designed to be used as a replacement for normal arrays, as * storage without requiring a #define that needs to be increased each
* normal arrays are faster and should be used whenever possible. * time the plugin author requires more storage. These are not designed
* to be a full replacement for normal arrays, as those are faster and
* should be used whenever possible.
* @note Plugins are responsible for freeing all Array handles they acquire,
* including those from ArrayClone. Failing to free handles will result
* in the plugin and AMXX leaking memory.
*/ */
enum Array enum Array
{ {
Invalid_Array = 0 Invalid_Array = 0
}; };
/** /**
* Given a maximum string size (including the null terminator), * Returns the number of cells required to fit a string of the specified size
* returns the number of cells required to fit that string. * (including the null terminator).
* *
* @param size Number of bytes. * @param size Number of bytes.
*
* @return Minimum number of cells required to fit the byte count. * @return Minimum number of cells required to fit the byte count.
*/ */
stock ByteCountToCells(size) stock ByteCountToCells(size)
@ -39,418 +44,480 @@ stock ByteCountToCells(size)
{ {
return 1; return 1;
} }
return (size + 3) / 4; return (size + 3) / 4;
} }
/** /**
* Creates a handle to a dynamically sized array. * Creates a handle to a dynamically sized array.
* It is very important that the cellsize you provide matches up with the buffer sizes
* that you pass with subsequent Array{Get,Set,Push} calls.
* *
* @param cellsize How many cells each entry in the array is. * @note It is very important that the provided cellsize matches up with the
* @param reserved How many blank entries are created immediately when the array is created. * buffer sizes that are passed with subsequent Array[Get|Set|Push] calls.
* These entries are not valid to read from until called with ArraySet. * @note Initially the "reserved" parameter was intended to create blank entries
* that would immediately be usable with Array[Get|Set] functions. This
* functionality was never working as intended, and can now be achieved
* using ArrayResize().
*
* @param cellsize Size of each array entry in cells
* @param reserved Pre-allocates space in the array for the specified
* number of items. The items are not valid to read or set
* until they have actually been pushed into the array.
* *
* @return Handle to the array. * @return Handle to the array.
*/ */
native Array:ArrayCreate(cellsize = 1, reserved = 0); native Array:ArrayCreate(cellsize = 1, reserved = 32);
/** /**
* Clones an array, returning a new handle with the same size and data. * Clones an array, returning a new handle with the same size and data.
* You must close it.
* *
* @param which Array handle to be cloned. * @param which Array handle
* *
* @return New handle to the cloned array object on success, 0 on failure. * @return Handle to the cloned array on success, 0 otherwise
* @error Invalid handle. * @error If an invalid handle is provided an error will be
* thrown.
*/ */
native Array:ArrayClone(Array:which); native Array:ArrayClone(Array:which);
/** /**
* Clears all entries from the array. * Clears all entries from the array.
* *
* @param which The array to clear. * @param which Array handle
* *
* @noreturn * @noreturn
* @error Invalid handle. * @error Invalid handle
*/ */
native ArrayClear(Array:which); native ArrayClear(Array:which);
/** /**
* Returns the number of elements in the array. * Returns the number of elements in the array.
* *
* @param which The array to check. * @param which Array handle
* *
* @return How many elements are in the array. * @return Number of elements in the array
* @error Invalid handle. * @error If an invalid handle is provided an error will be
* thrown.
*/ */
native ArraySize(Array:which); native ArraySize(Array:which);
/** /**
* Resizes an array. If the size is smaller than the current size, * Resizes an array.
* the array is truncated.
* *
* @param which Array handle. * @note If the size is smaller than the current array size the array is
* @param newsize New size. * truncated and data lost.
*
* @param which Array handle
* @param newsize New size
* *
* @noreturn * @noreturn
* @error Invalid handle or out of memory. * @error If an invalid handle is provided or the resizing
* operation runs out of memory, an error will be thrown.
*/ */
native bool:ArrayResize(Array:which, newsize); native bool:ArrayResize(Array:which, newsize);
/** /**
* Returns data within an array. * Retrieves an array of data from a cellarray.
* Make sure the output buffer matches the size the array was created with!
* *
* @param which The array to retrieve the item from. * @note If the size parameter is specified as -1 the output buffer has to match
* @param item The item to retrieve (zero-based). * the size the array was created with.
* @param output The output buffer to write. *
* @param which Array handle
* @param item Item index in the array
* @param output Buffer to copy value to
* @param size If not set, assumes the buffer size is equal to the * @param size If not set, assumes the buffer size is equal to the
* cellsize. Otherwise, the size passed is used. * cellsize. Otherwise, the specified size is used.
* *
* @return Number of cells copied. * @return Number of cells copied
* @error Invalid handle or invalid index. * @error If an invalid handle or index is provided an error will
* be thrown.
*/ */
native ArrayGetArray(Array:which, item, any:output[], size = -1); native ArrayGetArray(Array:which, item, any:output[], size = -1);
/** /**
* Returns a single cell of data from an array. * Returns a single cell of data from an array
* *
* @param which The array to retrieve the item from. * @param which Array handle
* @param item The item to retrieve (zero-based). * @param item Item index in the array
* @param block Optionally specify which block to read from * @param block If the array has a cellsize >1 this optionally specifies
* (useful if the blocksize > 0). * which block to read from
* @param asChar Optionally read as a byte instead of a cell. * @param asChar If true reads the value as a byte instead of a cell
* *
* @return Value read. * @return Integer value
* @error Invalid handle, invalid index, or invalid block. * @error If an invalid handle, index or block is provided an
* error will be thrown.
*/ */
native any:ArrayGetCell(Array:which, item, block = 0, bool:asChar = false); native any:ArrayGetCell(Array:which, item, block = 0, bool:asChar = false);
/** /**
* Returns a string value from an array. * Returieves string data from an array.
* *
* @param which The array to retrieve the item from. * @param which Array handle
* @param item The item to retrieve (zero-based). * @param item Item index in the array
* @param output The variable to store the value in. * @param output Buffer to copy value to
* @param size Character size of the output buffer. * @param size Maximum size of the buffer
* *
* @return Number of characters copied. * @return Number of characters copied
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayGetString(Array:which, item, output[], size); native ArrayGetString(Array:which, item, output[], size);
/** /**
* Sets an item's data with that of a local buffer. * Fills an item's data with the contents of an array.
* The buffer size must match what the cellsize that the array was created with!
* The item must already exist, use ArrayPushArray to create a new item within the array.
* *
* @param which The array to set the item from within. * @note If the size parameter is specified as -1 the input buffer has to match
* @param item The item to set (zero-based). * the size the array was created with.
* @param input The input buffer to store. * @note The item index must already be valid. Use ArrayPushArray to create
* a new array item in the cellarray.
*
* @param which Array handle
* @param item Item index in the array
* @param input Array to copy to the cellarray
* @param size If not set, assumes the buffer size is equal to the * @param size If not set, assumes the buffer size is equal to the
* blocksize. Otherwise, the size passed is used. * cellsize. Otherwise, the specified size is used.
* *
* @return Number of cells copied. * @return Number of cells copied
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArraySetArray(Array:which, item, const any:input[], size =-1); native ArraySetArray(Array:which, item, const any:input[], size =-1);
/** /**
* Sets an array's single cell value. Use this only on array that were created with a cellsize of 1! * Sets an item's data to a single cell value.
* The item must already exist, use ArrayPushCell to create a new item within the array.
* *
* @param which The array to set the item from within. * @note The item index must already be valid. Use ArrayPushArray to create
* @param item The item to set (zero-based). * a new array item in the cellarray.
* @param input The value to set. *
* @param block Optionally specify which block to write to * @param which Array handle
* (useful if the blocksize > 0). * @param item Item index in the array
* @param asChar Optionally set as a byte instead of a cell. * @param input Value to set
* @param block If the array has a cellsize >1 this optionally specifies
* which block to write to
* @param asChar If true writes the value as a byte instead of a cell
* *
* @noreturn * @noreturn
* @error Invalid handle, invalid index, or invalid block. * @error If an invalid handle, index or block is provided an
* error will be thrown.
*/ */
native ArraySetCell(Array:which, item, any:input, block = 0, bool:asChar = false); native ArraySetCell(Array:which, item, any:input, block = 0, bool:asChar = false);
/** /**
* Sets a string value from an array. * Sets an item's data to a string value.
* The stored string will be truncated if it is longer than the cellsize the array was created with!
* The item must already exist, use ArrayPushString to create a new item within the array.
* *
* @param which The array to set the item from within. * @note The input will be truncated if it is longer than the cellsize the array
* @param item The item to set (zero-based). * was created with.
* @param input The string to set the item as. * @note The item index must already be valid. Use ArrayPushString to create
* a new array item in the cellarray.
* *
* @return Number of characters copied. * @param which Array handle
* @error Invalid handle or invalid index. * @param item Item index in the array
* @param input String to copy to the array
*
* @return Number of characters copied
* @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArraySetString(Array:which, item, const input[]); native ArraySetString(Array:which, item, const input[]);
/** /**
* Creates a new item at the end of the array and sets its data with that of a local buffer. * Creates a new item at the end of the cellarray and copies the provided array
* The buffer size must match what the cellsize that the array was created with! * into it.
* *
* @param which The array to add the item to. * @note The input will be truncated if it is bigger than the cellsize the array
* @param input The input buffer to store. * was created with.
* @param size If not set, the number of elements copied from the array
* will be equal to the blocksize. If set higher than the
* blocksize, the operation will be truncated.
* *
* @return Index of the new entry. * @param which Array handle
* @error Invalid handle or out of memory. * @param input Array to copy to the cellarray
* @param size If not set, assumes the buffer size is equal to the
* cellsize. Otherwise, the specified size is used.
*
* @return Index of the new entry
* @error If an invalid handle is provided or the resizing
* operation runs out of memory, an error will be thrown.
*/ */
native ArrayPushArray(Array:which, const any:input[], size = -1); native ArrayPushArray(Array:which, const any:input[], size = -1);
/** /**
* Creates a new item and sets the array's single cell value. * Creates a new item ath the end of the array and sets the item's single cell
* Use this only on array that were created with a cellsize of 1! * value.
* *
* @param which The array to add the item to. * @param which Array handle
* @param input The value to set. * @param input Value to set
* *
* @return Index of the new entry. * @return Index of the new entry
* @error Invalid handle or out of memory. * @error If an invalid handle is provided or the resizing
* operation runs out of memory, an error will be thrown.
*/ */
native ArrayPushCell(Array:which, any:input); native ArrayPushCell(Array:which, any:input);
/** /**
* Creates a new element in the array and sets its value to the input buffer. * Creates a new item at the end of the array and copies the provided string
* The stored string will be truncated if it is longer than the cellsize the array was created with! * into it.
* *
* @param which The array to add the item to. * @note The input will be truncated if it is longer than the cellsize the array
* @param input The string to set the item as. * was created with.
* *
* @return Index of the new entry. * @param which Array handle
* @error Invalid handle or out of memory. * @param input String to copy to the array
*
* @return Index of the new entry
* @error If an invalid handle is provided or the resizing
* operation runs out of memory, an error will be thrown.
*/ */
native ArrayPushString(Array:which, const input[]); native ArrayPushString(Array:which, const input[]);
/** /**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space. * Creates a new item behind the specified item and copies the provided array
* The buffer size must match what the cellsize that the array was created with! * into it. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @param which Array handle
* @param item The item to insert after. * @param item Item index in the array
* @param input The input buffer to store. * @param input Array to copy to the cellarray
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertArrayAfter(Array:which, item, const any:input[]); native ArrayInsertArrayAfter(Array:which, item, const any:input[]);
/** /**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space. * Creates a new item behind the specified item and sets the item's single cell
* Use this only on an array that was created with a cellsize of 1! * value. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @param which Array handle
* @param item The item to insert after. * @param item Item index in the array
* @param input The value to set. * @param input Value to set
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertCellAfter(Array:which, item, any:input); native ArrayInsertCellAfter(Array:which, item, any:input);
/** /**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space. * Creates a new item behind the specified item and copies the provided string
* The stored string will be truncated if it is longer than the cellsize the array was created with! * into it. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @note The input will be truncated if it is longer than the cellsize the array
* @param item The item to insert after. * was created with.
* @param input The value to set. *
* @param which Array handle
* @param item Item index in the array
* @param input String to copy to the array
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertStringAfter(Array:which, item, const input[]); native ArrayInsertStringAfter(Array:which, item, const input[]);
/** /**
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space. * Creates a new item in front of the specified item and copies the provided
* The buffer size must match what the cellsize that the array was created with! * array into it. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @param which Array handle
* @param item The item to insert before. * @param item Item index in the array
* @param input The input buffer to store. * @param input Array to copy to the cellarray
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertArrayBefore(Array:which, item, const any:input[]); native ArrayInsertArrayBefore(Array:which, item, const any:input[]);
/** /**
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space. * Creates a new item in front of the specified item and sets the item's single
* Use this only on an array that was created with a cellsize of 1! * cell value. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @param which Array handle
* @param item The item to insert after. * @param item Item index in the array
* @param input The value to set. * @param input Value to set
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertCellBefore(Array:which, item, const any:input); native ArrayInsertCellBefore(Array:which, item, const any:input);
/** /**
* Inserts an item before the selected item. All items beyond it, and the selected item get shifted up 1 space. * Creates a new item in front of the specified item and copies the provided
* The stored string will be truncated if it is longer than the cellsize the array was created with! * string into it. All items beyond it get shifted up by one.
* *
* @param which The array to add the item to. * @note The input will be truncated if it is longer than the cellsize the array
* @param item The item to insert before. * was created with.
* @param input The value to set. *
* @param which Array handle
* @param item Item index in the array
* @param input String to copy to the array
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayInsertStringBefore(Array:which, item, const input[]); native ArrayInsertStringBefore(Array:which, item, const input[]);
/** /**
* Swaps the position of two items. * Swaps the position of two items.
* *
* @param which The array that contains the items. * @param which Array handle
* @param item1 The first item to swap. * @param item1,item2 Item pair to swap
* @param item2 The second item to swap.
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArraySwap(Array:which, item1, item2); native ArraySwap(Array:which, item1, item2);
/** /**
* Deletes an item from the array. All items beyond it get shifted down 1 space. * Deletes an item from the array. All items beyond it get shifted down by one.
* *
* @param which The array that contains the item to delete. * @param which Array handle
* @param item The item to delete. * @param item Item to delete
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid index. * @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native ArrayDeleteItem(Array:which, item); native ArrayDeleteItem(Array:which, item);
/** /**
* Returns the index for the first occurance of the provided string. If the string * Searches through the array and returns the index of the first occurence of
* cannot be located, -1 will be returned. * the specified string.
* *
* @param which Array handle. * @param which Array handle
* @param item String to search for. * @param item String to search for
* *
* @return Array index, or -1 on failure. * @return Array index on success, -1 if the string can't be found
* @error Invalid handle. * @error Invalid handle.
*/ */
native ArrayFindString(Array:which, const item[]); native ArrayFindString(Array:which, const item[]);
/**
* Returns the index for the first occurance of the provided value. If the value
* cannot be located, -1 will be returned.
*
* @param which Array handle.
* @param item Value to search for.
*
* @return Array index, or -1 on failure.
* @error Invalid handle.
*/
native ArrayFindValue(Array:which, any:item);
/** /**
* Creates a handle that is passable to a format compliant routine for printing as a string (with the %a format option). * Searches through the array and returns the index of the first occurence of
* It is suggested to pass the function directly as a parameter to the format routine. * the specified value.
* The array contents must be a null-terminated string!
* *
* An example usage: client_print(id, print_chat, "%a", ArrayGetStringHandle(MessageArray, i)); * @param which Array handle
* @param item Value to search for
* *
* @param which The array the string is stored in. * @return Array index on success, -1 if the value can't be found
* @param item Which item to print the string value of. * @error If an invalid handle is provided an error will be
* thrown.
*/
native ArrayFindValue(Array:which, any:item);
/**
* Creates a special handle that can be passed to a string format routine for
* printing as a string (with the %a format option).
* *
* @return Handle to the item directly. Do not use or save stale handles. * @note It is recommended to pass the function as a parameter to the format
* @error Invalid handle or invalid index. * routine directly. The array item must contain a null-terminated string!
* @note Do not save or otherwise use the handles returned by this function.
* @note Example usage:
* console_print(id, "%a", ArrayGetStringHandle(MessageArray, i));
*
* @param which Array handle
* @param item Item to retrieve handle of
*
* @return Handle to the item
* @error If an invalid handle or an invalid index is provided an
* error will be thrown.
*/ */
native DoNotUse:ArrayGetStringHandle(Array:which, item); native DoNotUse:ArrayGetStringHandle(Array:which, item);
/** /**
* Destroys the array, and resets the handle to 0 to prevent accidental usage after it is destroyed. * Destroys the array and frees its memory.
* *
* @param which The array to destroy. * @note The function automatically sets the variable passed to it to 0 to aid
* in preventing accidental usage after destroy.
* *
* @noreturn * @param which Array to destroy
* @error Invalid handle. *
* @return 1 if the array was destroyed, 0 if nothing had to be
* destroyed (invalid handle)
*/ */
native ArrayDestroy(&Array:which); native ArrayDestroy(&Array:which);
/** /**
* Similar to sorting.inc's CustomSort. * Similar to sorting.inc's CustomSort, the sorting algorithm then uses the
* The sorting algorithm then uses your comparison function to sort the data. * custom comparison function to sort the data.
* The function is called in the following manner: *
* * @note The function is called in the following manner:
*
* public MySortFunc(Array:array, item1, item2, const data[], data_size) * public MySortFunc(Array:array, item1, item2, const data[], data_size)
* *
* array - Array handle in its current un-sorted state. * array - Array handle in its current un-sorted state
* item1, item2 - Current item pair being compared * item1, item2 - Current item pair being compared
* data[] - Extra data array you passed to the sort func. * data[] - Extra data array passed to the sort func
* data_size - Size of extra data you passed to the sort func. * data_size - Size of extra data
* *
* Your function should return: * @note The comparison function should return:
* -1 if item1 should go before item2 * -1 if item1 should go before item2
* 0 if item1 and item2 are equal * 0 if item1 and item2 are equal
* 1 if item1 should go after item2 * 1 if item1 should go after item2
* *
* Note that the parameters after item2 are all optional and you do not need to specify them. * @note All parameters after item2 are optional and do not need to be specified
* Note that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state. * and used.
* @note Unlike the sorting.inc version, the array passed to the callback is not
* in mid-sorted state.
* *
* @param array Array handle. * @param array Array handle
* @param comparefunc A callback function used for comparison. * @param comparefunc Callback function used for comparison
* @param data Extra data array you passed to the sort func. * @param data Extra data that is passed through to the callback
* @param data_size Size of extra data you passed to the sort func. * @param data_size Size of extra data
* *
* @noreturn * @noreturn
* @error Invalid handle or invalid callback. * @error If an invalid handle or an invalid callback is provided
* an error will be thrown.
*/ */
native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0); native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0);
/** /**
* A faster version of ArraySort. * A faster version of ArraySort, the sorting algorithm then uses the custom
* The sorting algorithm then uses your comparison function to sort the data. * comparison function to sort the data.
*
* @note The advantage of this function is that the data of the elements being
* compared is directly passed to the function, instead of the item
* indexes that are passed by ArraySort. This removes the need for calling
* ArrayGet[Cell|String|Array] every time before being able to compare the
* elements.
*
* @note For Arrays with a cellsize of 1 (used for storing integers and floats),
* the function is called in the following manner:
* *
* The advantage of this native is that the Array elements being compared are
* directly passed into your function, instead of the item indexes that are passed by ArraySort.
* This removes the need for calling ArrayGet[Cell|String|Array] every time before being
* able to compare the elements.
*
* For Arrays with a cellsize of 1 (used for storing integers and floats),
* the function is called in the following manner:
*
* public MySortFunc(Array:array, elem1, elem2, const data[], data_size) * public MySortFunc(Array:array, elem1, elem2, const data[], data_size)
* *
* array - Array handle in its current un-sorted state. * array - Array handle in its current un-sorted state
* elem1, elem2 - Current element pair being compared * elem1, elem2 - Current element pair being compared
* data[] - Extra data array you passed to the sort func. * data[] - Extra data array passed to the sort func
* data_size - Size of extra data you passed to the sort func. * data_size - Size of extra data
* *
* For Arrays with a cellsize larger than 1 (used for storing arrays and strings), * @note For Arrays with a cellsize larger than 1 (used for storing arrays and
* the function is called in the following manner: * strings), the function is called in the following manner:
* *
* public MySortFunc(Array:array, elem1[], elem2[], const data[], data_size) * public MySortFunc(Array:array, elem1[], elem2[], const data[], data_size)
* *
* array - Array handle in its current un-sorted state. * array - Array handle in its current un-sorted state
* elem1[], elem2[] - Current element pair being compared * elem1[], elem2[] - Current element pair being compared
* data[] - Extra data array you passed to the sort func. * data[] - Extra data array passed to the sort func
* data_size - Size of extra data you passed to the sort func. * data_size - Size of extra data
* *
* *
* In both cases your function should return: * @note The comparison function should return:
* -1 if elem1 should go before elem2 * -1 if elem1 should go before elem2
* 0 if elem1 and elem2 are equal * 0 if elem1 and elem2 are equal
* 1 if elem1 should go after elem2 * 1 if elem1 should go after elem2
* *
* Note that the parameters after elem2 are all optional and you do not need to specify them. * @note All parameters after item2 are optional and do not need to be specified
* Note that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state. * and used.
* @note Unlike the sorting.inc version, the array passed to the callback is not
* in mid-sorted state.
* *
* @param array Array handle. * @param array Array handle
* @param comparefunc A callback function used for comparison. * @param comparefunc Callback function used for comparison
* @param data Extra data array you passed to the sort func. * @param data Extra data that is passed through to the callback
* @param data_size Size of extra data you passed to the sort func. * @param data_size Size of extra data
* *
* @noreturn * @noreturn
* @error Invalid handle, invalid callback or out of memory. * @error If an invalid handle or an invalid callback is provided
* an error will be thrown.
*/ */
native ArraySortEx(Array:array, const comparefunc[], data[]="", data_size=0); native ArraySortEx(Array:array, const comparefunc[], data[]="", data_size=0);

View File

@ -19,9 +19,9 @@
/** /**
* Ham return types. * Ham return types.
* *
* Return these from hooks to disable calling the target function. * @note Return these from hooks to disable calling the target function.
* Numbers match up with fakemeta's FMRES_* for clarity. They are interchangable. * Numbers match up with fakemeta's FMRES_* for clarity. They are
* 0 (or no return) is also interpretted as HAM_IGNORED. * interchangable. 0 (or no return) is also interpretted as HAM_IGNORED.
*/ */
#define HAM_IGNORED 1 /**< Calls target function, returns normal value */ #define HAM_IGNORED 1 /**< Calls target function, returns normal value */
#define HAM_HANDLED 2 /**< Tells the module you did something, still calls target function and returns normal value */ #define HAM_HANDLED 2 /**< Tells the module you did something, still calls target function and returns normal value */
@ -29,30 +29,27 @@
#define HAM_SUPERCEDE 4 /**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */ #define HAM_SUPERCEDE 4 /**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */
/** /**
* A few notes about all of the following functions: * List of virtual functions made available through the hamsandwich module.
* - Not all functions will do as you expect on all mods.
* If a function does not do what you would believe it should
* DO NOT file a bug report, you will be ignored.
* *
* - Passing invalid parameters has potential to crash the server * @note Not all functions will do as you expect on all mods. If a function does
* So be careful, and adequately test! * not do what you would believe it should DO NOT file a bug report, you
* * will be ignored.
* - All functions take (and pass) a "this" index as the first param. * @note Passing invalid parameters has potential to crash the server, so be
* This is the entity from which the function is being executed on. * careful, and test carefully and adequately!
* * @note All functions take (and pass) a "this" index as the first param.
* - All functions and forwards (eg: {Register,Execute}Ham[B]) require * This is the entity from which the function is being executed on.
* the mod to have the pev and base keys in addition to the function * @note All functions and forwards (eg: {Register,Execute}Ham[B]) require
* keys for the corresponding mod/operating system in hamdata.ini * the mod to have the pev and base keys in addition to the function
* * keys for the corresponding mod/operating system in hamdata.ini
* - Some functions that return booleans may need to be logically ANDed * @note Some functions that return booleans may need to be logically ANDed
* to get the results desired. e.g: if (ExecuteHam(Ham_TS_IsObjective, this) & 0x0000FFFF != 0) { // true.. } * to get the desired results because the mod will return the full integer
* because the module will return the full integer value. * value. E.g.: (ExecuteHam(Ham_TS_IsObjective, this) & 0x0000FFFF) != 0
*/ */
enum Ham enum Ham
{ {
/** /**
* Description: This is typically called whenever an entity is created. * Description: This is typically called whenever an entity is created.
* It is the virtual equivilent of spawn from the engine. * It is the virtual equivilent of spawn from the engine.
* Some mods call this on player spawns too. * Some mods call this on player spawns too.
* Forward params: function(this) * Forward params: function(this)
@ -262,7 +259,7 @@ enum Ham
*/ */
Ham_GetDelay, Ham_GetDelay,
/** /**
* Description: Whether or not the entity is moving. * Description: Whether or not the entity is moving.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer. * Return type: Integer.
@ -318,7 +315,7 @@ enum Ham
*/ */
Ham_OnControls, Ham_OnControls,
/** /**
* Description: Whether or not the entity is sneaking. * Description: Whether or not the entity is sneaking.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -326,7 +323,7 @@ enum Ham
*/ */
Ham_IsSneaking, Ham_IsSneaking,
/** /**
* Description: Whether or not the entity is alive. * Description: Whether or not the entity is alive.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -334,7 +331,7 @@ enum Ham
*/ */
Ham_IsAlive, Ham_IsAlive,
/** /**
* Description: Whether or not the entity uses a BSP model. * Description: Whether or not the entity uses a BSP model.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -342,7 +339,7 @@ enum Ham
*/ */
Ham_IsBSPModel, Ham_IsBSPModel,
/** /**
* Description: Whether or not the entity can reflect gauss shots.. * Description: Whether or not the entity can reflect gauss shots..
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -361,7 +358,7 @@ enum Ham
*/ */
Ham_HasTarget, Ham_HasTarget,
/** /**
* Description: Whether or not the entity is in the world. * Description: Whether or not the entity is in the world.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -369,7 +366,7 @@ enum Ham
*/ */
Ham_IsInWorld, Ham_IsInWorld,
/** /**
* Description: Whether or not the entity is a player. * Description: Whether or not the entity is a player.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -377,7 +374,7 @@ enum Ham
*/ */
Ham_IsPlayer, Ham_IsPlayer,
/** /**
* Description: Whether or not the entity is a net client. * Description: Whether or not the entity is a net client.
* Forward params: function(this); * Forward params: function(this);
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -385,7 +382,7 @@ enum Ham
*/ */
Ham_IsNetClient, Ham_IsNetClient,
/** /**
* Description: Get the entity's team id. * Description: Get the entity's team id.
* This function is not supported by Team Fortress Classic mod. * This function is not supported by Team Fortress Classic mod.
* Forward params: function(this); * Forward params: function(this);
@ -1286,8 +1283,8 @@ enum Ham
Ham_BestVisibleEnemy, Ham_BestVisibleEnemy,
/** /**
* Description: Returns true if the passed ent is in the caller's forward view cone. * Description: Returns true if the passed ent is in the caller's forward view cone.
* The dot product is performed in 2d, making the view cone infinitely tall. * The dot product is performed in 2d, making the view cone infinitely tall.
* Forward params: function(this, idOther); * Forward params: function(this, idOther);
* Return type: Integer (boolean). * Return type: Integer (boolean).
* Execute params: ExecuteHam(Ham_FInViewCone, this, idOther); * Execute params: ExecuteHam(Ham_FInViewCone, this, idOther);
@ -1295,8 +1292,8 @@ enum Ham
Ham_FInViewCone, Ham_FInViewCone,
/** /**
* Description: Returns true if the passed ent is in the caller's forward view cone. * Description: Returns true if the passed ent is in the caller's forward view cone.
* The dot product is performed in 2d, making the view cone infinitely tall. * The dot product is performed in 2d, making the view cone infinitely tall.
* Forward params: function(this, const Float:origin[3]); * Forward params: function(this, const Float:origin[3]);
* Return type: Integer (boolean). * Return type: Integer (boolean).
* Execute params: ExecuteHam(Ham_FVecInViewCone, this, const Float:origin[3]); * Execute params: ExecuteHam(Ham_FVecInViewCone, this, const Float:origin[3]);
@ -1446,7 +1443,7 @@ enum Ham
/** /**
* Description: Determines whether or not the monster can play the scripted sequence or AI sequence that is * Description: Determines whether or not the monster can play the scripted sequence or AI sequence that is
* trying to possess it. If DisregardState is set, the monster will be sucked into the script * trying to possess it. If DisregardState is set, the monster will be sucked into the script
* no matter what state it is in. ONLY Scripted AI ents should allow this. * no matter what state it is in. ONLY Scripted AI ents should allow this.
* This function is not supported by Counter-Strike, The Specialists and Natural Selection mods. * This function is not supported by Counter-Strike, The Specialists and Natural Selection mods.
* Forward params: function(this, bool:disregardState, interruptLevel); * Forward params: function(this, bool:disregardState, interruptLevel);
@ -1510,7 +1507,7 @@ enum Ham
Ham_SetActivity, Ham_SetActivity,
/** /**
* Description: Part of the condition collection process gets and stores data and conditions * Description: Part of the condition collection process gets and stores data and conditions
* pertaining to a monster's enemy. Returns TRUE if Enemy LKP was updated. * pertaining to a monster's enemy. Returns TRUE if Enemy LKP was updated.
* This function is not supported by Counter-Strike, The Specialists and Natural Selection mods. * This function is not supported by Counter-Strike, The Specialists and Natural Selection mods.
* Forward params: function(this, idEnemy); * Forward params: function(this, idEnemy);
@ -1550,7 +1547,7 @@ enum Ham
Ham_BuildNearestRoute, Ham_BuildNearestRoute,
/** /**
* Description: Tries to find a nearby node that will hide the caller from its enemy. * Description: Tries to find a nearby node that will hide the caller from its enemy.
* If supplied, search will return a node at least as far away as MinDist from vecThreat, but no farther than minDist. * If supplied, search will return a node at least as far away as MinDist from vecThreat, but no farther than minDist.
* If maxDist isn't supplied, it defaults to a reasonable value. * If maxDist isn't supplied, it defaults to a reasonable value.
* This function is not supported by Counter-Strike, The Specialists and Natural Selection mods. * This function is not supported by Counter-Strike, The Specialists and Natural Selection mods.
@ -1617,7 +1614,7 @@ enum Ham
Ham_FCanActiveIdle, Ham_FCanActiveIdle,
/** /**
* Description: Returns a bit mask indicating which types of sounds this monster regards. * Description: Returns a bit mask indicating which types of sounds this monster regards.
* In the base class implementation, monsters care about all sounds, but no scents. * In the base class implementation, monsters care about all sounds, but no scents.
* This function is not supported by Counter-Strike, The Specialists and Natural Selection mods. * This function is not supported by Counter-Strike, The Specialists and Natural Selection mods.
* Forward params: function(this); * Forward params: function(this);
@ -1882,7 +1879,7 @@ enum Ham
* The following functions are specific to Team Fortress Classic. * The following functions are specific to Team Fortress Classic.
*/ */
/** /**
* Description: Get the item name. * Description: Get the item name.
* Forward params: function(this, const buffer[]); * Forward params: function(this, const buffer[]);
* Return type: String (string length returned and string byref'd in ExecuteHam). * Return type: String (string length returned and string byref'd in ExecuteHam).
@ -2858,8 +2855,8 @@ enum Ham
*/ */
/** /**
* Description: Returns the type of group (i.e, "houndeye", or "human military" * Description: Returns the type of group (i.e, "houndeye", or "human military"
* so that monsters with different classnames still realize that they are teammates. * so that monsters with different classnames still realize that they are teammates.
* (overridden for monsters that form groups) * (overridden for monsters that form groups)
* Classes list: * Classes list:
* CLASS_NONE 0 * CLASS_NONE 0
@ -2874,11 +2871,11 @@ enum Ham
* CLASS_ALIEN_PREDATOR 9 * CLASS_ALIEN_PREDATOR 9
* CLASS_INSECT 10 * CLASS_INSECT 10
* CLASS_PLAYER_ALLY 11 * CLASS_PLAYER_ALLY 11
* CLASS_PLAYER_BIOWEAPON 12 * CLASS_PLAYER_BIOWEAPON 12
* CLASS_ALIEN_BIOWEAPON 13 * CLASS_ALIEN_BIOWEAPON 13
* CLASS_XRACE_PITDRONE 14 * CLASS_XRACE_PITDRONE 14
* CLASS_XRACE_SHOCK 15 * CLASS_XRACE_SHOCK 15
* CLASS_BARNACLE 99 * CLASS_BARNACLE 99
* Forward params: function(this, class) * Forward params: function(this, class)
* Return type: Integer. * Return type: Integer.
* Execute params: ExecuteHam(Ham_SC_GetClassification, this, class) * Execute params: ExecuteHam(Ham_SC_GetClassification, this, class)
@ -3035,7 +3032,7 @@ enum Ham
Ham_SC_Revive, Ham_SC_Revive,
/** /**
* Description: Final bit of initization before a monster is turned over to the AI. * Description: Final bit of initization before a monster is turned over to the AI.
* Forward params: function(this) * Forward params: function(this)
* Return type: None. * Return type: None.
* Execute params: ExecuteHam(Ham_SC_StartMonster, this) * Execute params: ExecuteHam(Ham_SC_StartMonster, this)
@ -3108,7 +3105,7 @@ enum Ham
/** /**
* Description: Tries to find a nearby node that will hide the caller from its enemy. * Description: Tries to find a nearby node that will hide the caller from its enemy.
* If supplied, search will return a node at least as far away as minDist, but no farther than maxDist. * If supplied, search will return a node at least as far away as minDist, but no farther than maxDist.
* If maxDist isn't supplied, it defaults to a reasonable value. * If maxDist isn't supplied, it defaults to a reasonable value.
* Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist) * Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist)
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -3118,7 +3115,7 @@ enum Ham
/** /**
* Description: Tries to find a nearby node that will hide the caller from its enemy. * Description: Tries to find a nearby node that will hide the caller from its enemy.
* If supplied, search will return a node at least as far away as minDist, but no farther than maxDist. * If supplied, search will return a node at least as far away as minDist, but no farther than maxDist.
* If maxDist isn't supplied, it defaults to a reasonable value. * If maxDist isn't supplied, it defaults to a reasonable value.
* Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist) * Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist)
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -3128,7 +3125,7 @@ enum Ham
/** /**
* Description: Tries to find a nearby node that will hide the caller from its enemy. * Description: Tries to find a nearby node that will hide the caller from its enemy.
* If supplied, search will return a node at least as far away as minDist, but no farther than maxDist. * If supplied, search will return a node at least as far away as minDist, but no farther than maxDist.
* If maxDist isn't supplied, it defaults to a reasonable value. * If maxDist isn't supplied, it defaults to a reasonable value.
* Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist) * Forward params: function(this, const Float:threat[3], const Float:viewOffset[3], Float:minDist, Float:maxDist)
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -3137,7 +3134,7 @@ enum Ham
Ham_SC_FindAttackPoint, Ham_SC_FindAttackPoint,
/** /**
* Description: Determines whether or not the chosen cover location is a good one to move to. * Description: Determines whether or not the chosen cover location is a good one to move to.
* Currently based on proximity to others in the squad. * Currently based on proximity to others in the squad.
* Forward params: function(this, const Float:coverLocation[3]) * Forward params: function(this, const Float:coverLocation[3])
* Return type: Integer (boolean). * Return type: Integer (boolean).
@ -3321,7 +3318,7 @@ enum Ham
* Execute params: ExecuteHam(Ham_SC_MedicCallSound, this) * Execute params: ExecuteHam(Ham_SC_MedicCallSound, this)
*/ */
Ham_SC_Player_MenuInputPerformed, Ham_SC_Player_MenuInputPerformed,
/** /**
* Description: - * Description: -
* Forward params: function(this) * Forward params: function(this)
@ -3499,7 +3496,7 @@ enum Ham
* Execute params: ExecuteHam(Ham_SC_Weapon_BurstSupplement, this) * Execute params: ExecuteHam(Ham_SC_Weapon_BurstSupplement, this)
*/ */
Ham_SC_Weapon_BurstSupplement, Ham_SC_Weapon_BurstSupplement,
/** /**
* Description: - * Description: -
* Forward params: function(this, const alternative[] = "") * Forward params: function(this, const alternative[] = "")
@ -3596,7 +3593,7 @@ enum Ham
*/ */
Ham_SC_Weapon_ChangeWeaponSkin, Ham_SC_Weapon_ChangeWeaponSkin,
/** /**
* LATE ADDITIONS (2013) * LATE ADDITIONS (2013)
*/ */
@ -3633,7 +3630,7 @@ enum Ham
*/ */
Ham_TFC_Weapon_GetNextAttackDelay, Ham_TFC_Weapon_GetNextAttackDelay,
/** /**
* Description: Usually called whenever an entity gets a form of a heal. * Description: Usually called whenever an entity gets a form of a heal.
* Forward params: function(this, Float:health, damagebits, health_cap); * Forward params: function(this, Float:health, damagebits, health_cap);
@ -3728,7 +3725,7 @@ enum Ham
*/ */
Ham_Item_GetItemInfo, Ham_Item_GetItemInfo,
/** /**
* DONT USE ME LOL * DONT USE ME LOL
*/ */
@ -3736,7 +3733,7 @@ enum Ham
}; };
/** /**
* Ham errors types. * Ham error types.
*/ */
enum HamError enum HamError
{ {
@ -3749,8 +3746,7 @@ enum HamError
}; };
/** /**
* To be used with [Get|Set]HamItemInfo. * Constants for usage with [Get|Set]HamItemInfo
* Ham prefix to avoid collision. :(
*/ */
enum HamItemInfo enum HamItemInfo
{ {

View File

@ -12,11 +12,13 @@
// //
#if defined _hlsdk_const_included #if defined _hlsdk_const_included
#endinput #endinput
#endif #endif
#define _hlsdk_const_included #define _hlsdk_const_included
// pev(entity, pev_button) or pev(entity, pev_oldbuttons) values /**
* pev(entity, pev_button) or pev(entity, pev_oldbuttons) values
*/
#define IN_ATTACK (1<<0) #define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1) #define IN_JUMP (1<<1)
#define IN_DUCK (1<<2) #define IN_DUCK (1<<2)
@ -34,26 +36,28 @@
#define IN_ALT1 (1<<14) #define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down #define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down
// pev(entity, pev_flags) values /**
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground * pev(entity, pev_flags) values
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) */
#define FL_CONVEYOR (1<<2) #define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_CLIENT (1<<3) #define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_INWATER (1<<4) #define FL_CONVEYOR (1<<2)
#define FL_MONSTER (1<<5) #define FL_CLIENT (1<<3)
#define FL_GODMODE (1<<6) #define FL_INWATER (1<<4)
#define FL_NOTARGET (1<<7) #define FL_MONSTER (1<<5)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself #define FL_GODMODE (1<<6)
#define FL_ONGROUND (1<<9) // At rest / on the ground #define FL_NOTARGET (1<<7)
#define FL_PARTIALGROUND (1<<10) // Not all corners are valid #define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_WATERJUMP (1<<11) // Player jumping out of water #define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // Not all corners are valid
#define FL_WATERJUMP (1<<11) // Player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera #define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them #define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched #define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water #define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // Worldgraph has this ent listed as something that blocks a connection #define FL_GRAPHED (1<<16) // Worldgraph has this ent listed as something that blocks a connection
#define FL_IMMUNE_WATER (1<<17) #define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18) #define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19) #define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) // This is a spectator proxy #define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) #define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
@ -66,63 +70,77 @@
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time #define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client #define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
// engfunc(EngFunc_WalkMove, entity, Float:yaw, Float:dist, iMode) iMode values /**
#define WALKMOVE_NORMAL 0 // Normal walkmove * engfunc(EngFunc_WalkMove, entity, Float:yaw, Float:dist, iMode) iMode values
*/
#define WALKMOVE_NORMAL 0 // Normal walkmove
#define WALKMOVE_WORLDONLY 1 // Doesn't hit ANY entities, no matter what the solid type #define WALKMOVE_WORLDONLY 1 // Doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // Move, but don't touch triggers #define WALKMOVE_CHECKONLY 2 // Move, but don't touch triggers
// pev(entity, pev_movetype) values /**
#define MOVETYPE_NONE 0 // Never moves * pev(entity, pev_movetype) values
#define MOVETYPE_WALK 3 // Player only - moving on the ground */
#define MOVETYPE_STEP 4 // Gravity, special edge handling -- monsters use this #define MOVETYPE_NONE 0 // Never moves
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff #define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_TOSS 6 // Gravity/Collisions #define MOVETYPE_STEP 4 // Gravity, special edge handling -- monsters use this
#define MOVETYPE_PUSH 7 // No clip to world, push and crush #define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity #define MOVETYPE_TOSS 6 // Gravity/Collisions
#define MOVETYPE_FLYMISSILE 9 // Extra size to monsters #define MOVETYPE_PUSH 7 // No clip to world, push and crush
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces #define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // Extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // Bounce w/o gravity #define MOVETYPE_BOUNCEMISSILE 11 // Bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // Track movement of aiment #define MOVETYPE_FOLLOW 12 // Track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision) #define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
// pev(entity, pev_solid) values /**
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves * pev(entity, pev_solid) values
// SOLID only effects OTHER entities colliding with this one when they move - UGH! *
#define SOLID_NOT 0 // No interaction with other objects * @note Some movetypes will cause collisions independent of SOLID_NOT and
#define SOLID_TRIGGER 1 // Touch on edge, but not blocking * SOLID_TRIGGER when the entity moves. SOLID only effects OTHER entities
#define SOLID_BBOX 2 // Touch on edge, block * colliding with this one when they move - UGH!
#define SOLID_SLIDEBOX 3 // Touch on edge, but not an onground */
#define SOLID_BSP 4 // BSP clip, touch on edge, block #define SOLID_NOT 0 // No interaction with other objects
#define SOLID_TRIGGER 1 // Touch on edge, but not blocking
#define SOLID_BBOX 2 // Touch on edge, block
#define SOLID_SLIDEBOX 3 // Touch on edge, but not an onground
#define SOLID_BSP 4 // BSP clip, touch on edge, block
// pev(entity, pev_deadflag) values /**
#define DEAD_NO 0 // Alive * pev(entity, pev_deadflag) values
#define DEAD_DYING 1 // Playing death animation or still falling off of a ledge waiting to hit ground */
#define DEAD_DEAD 2 // Dead, lying still #define DEAD_NO 0 // Alive
#define DEAD_DYING 1 // Playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // Dead, lying still
#define DEAD_RESPAWNABLE 3 #define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4 #define DEAD_DISCARDBODY 4
// new Float:takedamage, pev(entity, pev_takedamage, takedamage) values /**
#define DAMAGE_NO 0.0 * new Float:takedamage, pev(entity, pev_takedamage, takedamage) values
#define DAMAGE_YES 1.0 */
#define DAMAGE_AIM 2.0 #define DAMAGE_NO 0.0
#define DAMAGE_YES 1.0
#define DAMAGE_AIM 2.0
// pev(entity, pev_effects) values /**
#define EF_BRIGHTFIELD 1 // Swirling cloud of particles * pev(entity, pev_effects) values
#define EF_MUZZLEFLASH 2 // Single frame ELIGHT on entity attachment 0 */
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin #define EF_BRIGHTFIELD 1 // Swirling cloud of particles
#define EF_DIMLIGHT 8 // Player flashlight #define EF_MUZZLEFLASH 2 // Single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // Player flashlight
#define EF_INVLIGHT 16 // Get lighting from ceiling #define EF_INVLIGHT 16 // Get lighting from ceiling
#define EF_NOINTERP 32 // Don't interpolate the next frame #define EF_NOINTERP 32 // Don't interpolate the next frame
#define EF_LIGHT 64 // Rocket flare glow sprite #define EF_LIGHT 64 // Rocket flare glow sprite
#define EF_NODRAW 128 // Don't draw entity #define EF_NODRAW 128 // Don't draw entity
/** /**
* Spectating camera mode constants * Spectating camera mode constants
* *
* Those constants are linked to differents camera mode available when you are spectating. * @note These constants are linked to different camera modes available when you
* (death or spectator team) * are spectating (either dead or when in spectator team). Usually this is
* They are usually stored in pev_iuser1 field in Counter-Strike and Half-Life games. * stored in the pev_iuser1 field in Counter-Strike and Half-Life games.
*/ */
#define OBS_NONE 0 #define OBS_NONE 0
#define OBS_CHASE_LOCKED 1 // Locked Chase Cam #define OBS_CHASE_LOCKED 1 // Locked Chase Cam
#define OBS_CHASE_FREE 2 // Free Chase Cam #define OBS_CHASE_FREE 2 // Free Chase Cam
@ -131,28 +149,33 @@
#define OBS_MAP_FREE 5 // Free Overview #define OBS_MAP_FREE 5 // Free Overview
#define OBS_MAP_CHASE 6 // Chase Overview #define OBS_MAP_CHASE 6 // Chase Overview
// engfunc(EngFunc_PointContents, Float:origin) return values /**
#define CONTENTS_EMPTY -1 * engfunc(EngFunc_PointContents, Float:origin) return values
#define CONTENTS_SOLID -2 */
#define CONTENTS_WATER -3 #define CONTENTS_EMPTY -1
#define CONTENTS_SLIME -4 #define CONTENTS_SOLID -2
#define CONTENTS_LAVA -5 #define CONTENTS_WATER -3
#define CONTENTS_SKY -6 #define CONTENTS_SLIME -4
#define CONTENTS_ORIGIN -7 // Removed at csg time #define CONTENTS_LAVA -5
#define CONTENTS_CLIP -8 // Changed to contents_solid #define CONTENTS_SKY -6
#define CONTENTS_CURRENT_0 -9 #define CONTENTS_ORIGIN -7 // Removed at csg time
#define CONTENTS_CURRENT_90 -10 #define CONTENTS_CLIP -8 // Changed to contents_solid
#define CONTENTS_CURRENT_180 -11 #define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_270 -12 #define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_UP -13 #define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_DOWN -14 #define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15 #define CONTENTS_TRANSLUCENT -15
#define CONTENTS_LADDER -16 #define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17 #define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18 #define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19 #define CONTENT_FOG -19
// Instant damage values for use with gmsgDamage 3rd value write_long(BIT) /**
* Instant damage values for use with the 3rd parameter of the "Damage" client
* message.
*/
#define DMG_GENERIC 0 // Generic damage was done #define DMG_GENERIC 0 // Generic damage was done
#define DMG_CRUSH (1<<0) // Crushed by falling or moving object #define DMG_CRUSH (1<<0) // Crushed by falling or moving object
#define DMG_BULLET (1<<1) // Shot #define DMG_BULLET (1<<1) // Shot
@ -164,7 +187,7 @@
#define DMG_CLUB (1<<7) // Crowbar, punch, headbutt #define DMG_CLUB (1<<7) // Crowbar, punch, headbutt
#define DMG_SHOCK (1<<8) // Electric shock #define DMG_SHOCK (1<<8) // Electric shock
#define DMG_SONIC (1<<9) // Sound pulse shockwave #define DMG_SONIC (1<<9) // Sound pulse shockwave
#define DMG_ENERGYBEAM (1<<10) // Laser or other high energy beam #define DMG_ENERGYBEAM (1<<10) // Laser or other high energy beam
#define DMG_NEVERGIB (1<<12) // With this bit OR'd in, no damage type will be able to gib victims upon death #define DMG_NEVERGIB (1<<12) // With this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB (1<<13) // With this bit OR'd in, any damage type can be made to gib victims upon death. #define DMG_ALWAYSGIB (1<<13) // With this bit OR'd in, any damage type can be made to gib victims upon death.
#define DMG_DROWN (1<<14) // Drowning #define DMG_DROWN (1<<14) // Drowning
@ -180,99 +203,144 @@
#define DMG_GRENADE (1<<24) // Counter-Strike only - Hit by HE grenade #define DMG_GRENADE (1<<24) // Counter-Strike only - Hit by HE grenade
#define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage #define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage
// The fNoMonsters parameter of EngFunc_TraceLine, EngFunc_TraceMonsterHull, EngFunc_TraceHull, and EngFunc_TraceSphere /**
* Valid constants for fNoMonsters parameter of EngFunc_TraceLine,
* EngFunc_TraceMonsterHull, EngFunc_TraceHull and EngFunc_TraceSphere.
*/
#define DONT_IGNORE_MONSTERS 0 #define DONT_IGNORE_MONSTERS 0
#define IGNORE_MONSTERS 1 #define IGNORE_MONSTERS 1
#define IGNORE_MISSILE 2 #define IGNORE_MISSILE 2
#define IGNORE_GLASS 0x100 #define IGNORE_GLASS 0x100
// The hullnumber paramater of EngFunc_TraceHull, EngFunc_TraceModel and DLLFunc_GetHullBounds /**
* The hullnumber paramater of EngFunc_TraceHull, EngFunc_TraceModel and
* DLLFunc_GetHullBounds
*/
#define HULL_POINT 0 #define HULL_POINT 0
#define HULL_HUMAN 1 #define HULL_HUMAN 1
#define HULL_LARGE 2 #define HULL_LARGE 2
#define HULL_HEAD 3 #define HULL_HEAD 3
// global_get(glb_trace_flags) /**
* global_get(glb_trace_flags)
*/
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box #define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
// Used with get/set_es(es_handle, ES_eFlags, ...) (entity_state data structure) /**
* Used with get/set_es(es_handle, ES_eFlags, ...) (entity_state data structure)
*/
#define EFLAG_SLERP 1 // Do studio interpolation of this entity #define EFLAG_SLERP 1 // Do studio interpolation of this entity
// pev(entity, pev_spawnflags) values /**
// Many of these flags apply to specific entities * @section pev(entity, pev_spawnflags) values
// func_train */
#define SF_TRAIN_WAIT_RETRIGGER 1 /**
* func_train
*/
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving #define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains #define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// func_wall_toggle /**
* func_wall_toggle
*/
#define SF_WALL_START_OFF 0x0001 #define SF_WALL_START_OFF 0x0001
// func_converyor /**
* func_converyor
*/
#define SF_CONVEYOR_VISUAL 0x0001 #define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002 #define SF_CONVEYOR_NOTSOLID 0x0002
// func_button /**
* func_button
*/
#define SF_BUTTON_DONTMOVE 1 #define SF_BUTTON_DONTMOVE 1
#define SF_BUTTON_TOGGLE 32 // Button stays pushed until reactivated #define SF_BUTTON_TOGGLE 32 // Button stays pushed until reactivated
#define SF_BUTTON_SPARK_IF_OFF 64 // Button sparks in OFF state #define SF_BUTTON_SPARK_IF_OFF 64 // Button sparks in OFF state
#define SF_BUTTON_TOUCH_ONLY 256 // Button only fires as a result of USE key. #define SF_BUTTON_TOUCH_ONLY 256 // Button only fires as a result of USE key.
// func_rot_button /**
* func_rot_button
*/
#define SF_ROTBUTTON_NOTSOLID 1 #define SF_ROTBUTTON_NOTSOLID 1
// env_global /**
* env_global
*/
#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn #define SF_GLOBAL_SET 1 // Set global state to initial state on spawn
// multisource /**
* multisource
*/
#define SF_MULTI_INIT 1 #define SF_MULTI_INIT 1
// momentary_rot_button /**
* momentary_rot_button
*/
#define SF_MOMENTARY_DOOR 0x0001 #define SF_MOMENTARY_DOOR 0x0001
// button_target /**
* button_target
*/
#define SF_BTARGET_USE 0x0001 #define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002 #define SF_BTARGET_ON 0x0002
// func_door, func_water, func_door_rotating, momementary_door /**
* func_door, func_water, func_door_rotating, momementary_door
*/
#define SF_DOOR_ROTATE_Y 0 #define SF_DOOR_ROTATE_Y 0
#define SF_DOOR_START_OPEN 1 #define SF_DOOR_START_OPEN 1
#define SF_DOOR_ROTATE_BACKWARDS 2 #define SF_DOOR_ROTATE_BACKWARDS 2
#define SF_DOOR_PASSABLE 8 #define SF_DOOR_PASSABLE 8
#define SF_DOOR_ONEWAY 16 #define SF_DOOR_ONEWAY 16
#define SF_DOOR_NO_AUTO_RETURN 32 #define SF_DOOR_NO_AUTO_RETURN 32
#define SF_DOOR_ROTATE_Z 64 #define SF_DOOR_ROTATE_Z 64
#define SF_DOOR_ROTATE_X 128 #define SF_DOOR_ROTATE_X 128
#define SF_DOOR_USE_ONLY 256 // Door must be opened by player's use button #define SF_DOOR_USE_ONLY 256 // Door must be opened by player's use button
#define SF_DOOR_NOMONSTERS 512 // Monster can't open #define SF_DOOR_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000 #define SF_DOOR_SILENT 0x80000000
// gibshooter /**
#define SF_GIBSHOOTER_REPEATABLE 1 // Allows a gibshooter to be refired * gibshooter
*/
#define SF_GIBSHOOTER_REPEATABLE 1 // Allows a gibshooter to be refired
// env_funnel /**
* env_funnel
*/
#define SF_FUNNEL_REVERSE 1 // Funnel effect repels particles instead of attracting them #define SF_FUNNEL_REVERSE 1 // Funnel effect repels particles instead of attracting them
// env_bubbles /**
* env_bubbles
*/
#define SF_BUBBLES_STARTOFF 0x0001 #define SF_BUBBLES_STARTOFF 0x0001
// env_blood /**
* env_blood
*/
#define SF_BLOOD_RANDOM 0x0001 #define SF_BLOOD_RANDOM 0x0001
#define SF_BLOOD_STREAM 0x0002 #define SF_BLOOD_STREAM 0x0002
#define SF_BLOOD_PLAYER 0x0004 #define SF_BLOOD_PLAYER 0x0004
#define SF_BLOOD_DECAL 0x0008 #define SF_BLOOD_DECAL 0x0008
// env_shake /**
* env_shake
*/
#define SF_SHAKE_EVERYONE 0x0001 // Don't check radius #define SF_SHAKE_EVERYONE 0x0001 // Don't check radius
#define SF_SHAKE_DISRUPT 0x0002 // Disrupt controls #define SF_SHAKE_DISRUPT 0x0002 // Disrupt controls
#define SF_SHAKE_INAIR 0x0004 // Shake players in air #define SF_SHAKE_INAIR 0x0004 // Shake players in air
// env_fade /**
* env_fade
*/
#define SF_FADE_IN 0x0001 // Fade in, not out #define SF_FADE_IN 0x0001 // Fade in, not out
#define SF_FADE_MODULATE 0x0002 // Modulate, don't blend #define SF_FADE_MODULATE 0x0002 // Modulate, don't blend
#define SF_FADE_ONLYONE 0x0004 #define SF_FADE_ONLYONE 0x0004
// env_beam, env_lightning /**
* env_beam, env_lightning
*/
#define SF_BEAM_STARTON 0x0001 #define SF_BEAM_STARTON 0x0001
#define SF_BEAM_TOGGLE 0x0002 #define SF_BEAM_TOGGLE 0x0002
#define SF_BEAM_RANDOM 0x0004 #define SF_BEAM_RANDOM 0x0004
@ -284,24 +352,32 @@
#define SF_BEAM_SHADEOUT 0x0100 #define SF_BEAM_SHADEOUT 0x0100
#define SF_BEAM_TEMPORARY 0x8000 #define SF_BEAM_TEMPORARY 0x8000
// env_sprite /**
* env_sprite
*/
#define SF_SPRITE_STARTON 0x0001 #define SF_SPRITE_STARTON 0x0001
#define SF_SPRITE_ONCE 0x0002 #define SF_SPRITE_ONCE 0x0002
#define SF_SPRITE_TEMPORARY 0x8000 #define SF_SPRITE_TEMPORARY 0x8000
// env_message /**
* env_message
*/
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out #define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#define SF_MESSAGE_ALL 0x0002 // Send to all clients #define SF_MESSAGE_ALL 0x0002 // Send to all clients
// env_explosion /**
#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // When set, ENV_EXPLOSION will not actually inflict damage * env_explosion
#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // Can this entity be refired? */
#define SF_ENVEXPLOSION_NODAMAGE (1<<0) // When set, ENV_EXPLOSION will not actually inflict damage
#define SF_ENVEXPLOSION_REPEATABLE (1<<1) // Can this entity be refired?
#define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // Don't draw the fireball #define SF_ENVEXPLOSION_NOFIREBALL (1<<2) // Don't draw the fireball
#define SF_ENVEXPLOSION_NOSMOKE (1<<3) // Don't draw the smoke #define SF_ENVEXPLOSION_NOSMOKE (1<<3) // Don't draw the smoke
#define SF_ENVEXPLOSION_NODECAL (1<<4) // Don't make a scorch mark #define SF_ENVEXPLOSION_NODECAL (1<<4) // Don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // Don't make a scorch mark #define SF_ENVEXPLOSION_NOSPARKS (1<<5) // Don't make a scorch mark
// func_tank /**
* func_tank
*/
#define SF_TANK_ACTIVE 0x0001 #define SF_TANK_ACTIVE 0x0001
#define SF_TANK_PLAYER 0x0002 #define SF_TANK_PLAYER 0x0002
#define SF_TANK_HUMANS 0x0004 #define SF_TANK_HUMANS 0x0004
@ -310,43 +386,65 @@
#define SF_TANK_CANCONTROL 0x0020 #define SF_TANK_CANCONTROL 0x0020
#define SF_TANK_SOUNDON 0x8000 #define SF_TANK_SOUNDON 0x8000
// grenade /**
* grenade
*/
#define SF_DETONATE 0x0001 #define SF_DETONATE 0x0001
// item_suit /**
* item_suit
*/
#define SF_SUIT_SHORTLOGON 0x0001 #define SF_SUIT_SHORTLOGON 0x0001
// game_score /**
* game_score
*/
#define SF_SCORE_NEGATIVE 0x0001 #define SF_SCORE_NEGATIVE 0x0001
#define SF_SCORE_TEAM 0x0002 #define SF_SCORE_TEAM 0x0002
// game_text /**
* game_text
*/
#define SF_ENVTEXT_ALLPLAYERS 0x0001 #define SF_ENVTEXT_ALLPLAYERS 0x0001
// game_team_master /**
* game_team_master
*/
#define SF_TEAMMASTER_FIREONCE 0x0001 #define SF_TEAMMASTER_FIREONCE 0x0001
#define SF_TEAMMASTER_ANYTEAM 0x0002 #define SF_TEAMMASTER_ANYTEAM 0x0002
// game_team_set /**
* game_team_set
*/
#define SF_TEAMSET_FIREONCE 0x0001 #define SF_TEAMSET_FIREONCE 0x0001
#define SF_TEAMSET_CLEARTEAM 0x0002 #define SF_TEAMSET_CLEARTEAM 0x0002
// game_player_hurt /**
* game_player_hurt
*/
#define SF_PKILL_FIREONCE 0x0001 #define SF_PKILL_FIREONCE 0x0001
// game_counter /**
* game_counter
*/
#define SF_GAMECOUNT_FIREONCE 0x0001 #define SF_GAMECOUNT_FIREONCE 0x0001
#define SF_GAMECOUNT_RESET 0x0002 #define SF_GAMECOUNT_RESET 0x0002
// game_player_equip /**
* game_player_equip
*/
#define SF_PLAYEREQUIP_USEONLY 0x0001 #define SF_PLAYEREQUIP_USEONLY 0x0001
// game_player_team /**
* game_player_team
*/
#define SF_PTEAM_FIREONCE 0x0001 #define SF_PTEAM_FIREONCE 0x0001
#define SF_PTEAM_KILL 0x0002 #define SF_PTEAM_KILL 0x0002
#define SF_PTEAM_GIB 0x0004 #define SF_PTEAM_GIB 0x0004
// func_trackchange /**
* func_trackchange
*/
#define SF_PLAT_TOGGLE 0x0001 #define SF_PLAT_TOGGLE 0x0001
#define SF_TRACK_ACTIVATETRAIN 0x00000001 #define SF_TRACK_ACTIVATETRAIN 0x00000001
#define SF_TRACK_RELINK 0x00000002 #define SF_TRACK_RELINK 0x00000002
@ -354,7 +452,9 @@
#define SF_TRACK_STARTBOTTOM 0x00000008 #define SF_TRACK_STARTBOTTOM 0x00000008
#define SF_TRACK_DONT_MOVE 0x00000010 #define SF_TRACK_DONT_MOVE 0x00000010
// func_tracktrain /**
* func_tracktrain
*/
#define SF_TRACKTRAIN_NOPITCH 0x0001 #define SF_TRACKTRAIN_NOPITCH 0x0001
#define SF_TRACKTRAIN_NOCONTROL 0x0002 #define SF_TRACKTRAIN_NOCONTROL 0x0002
#define SF_TRACKTRAIN_FORWARDONLY 0x0004 #define SF_TRACKTRAIN_FORWARDONLY 0x0004
@ -368,83 +468,116 @@
#define SF_CORNER_TELEPORT 0x002 #define SF_CORNER_TELEPORT 0x002
#define SF_CORNER_FIREONCE 0x004 #define SF_CORNER_FIREONCE 0x004
// trigger_push /**
#define SF_TRIGGER_PUSH_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF * trigger_push
*/
#define SF_TRIGGER_PUSH_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF
// trigger_hurt /**
* trigger_hurt
*/
#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once #define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once
#define SF_TRIGGER_HURT_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF #define SF_TRIGGER_HURT_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF
#define SF_TRIGGER_HURT_NO_CLIENTS 8 // Spawnflag that makes trigger_push spawn turned OFF #define SF_TRIGGER_HURT_NO_CLIENTS 8 // Spawnflag that makes trigger_push spawn turned OFF
#define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // Trigger hurt will only fire its target if it is hurting a client #define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // Trigger hurt will only fire its target if it is hurting a client
#define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // Only clients may touch this trigger #define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // Only clients may touch this trigger
// trigger_auto /**
* trigger_auto
*/
#define SF_AUTO_FIREONCE 0x0001 #define SF_AUTO_FIREONCE 0x0001
// trigger_relay /**
* trigger_relay
*/
#define SF_RELAY_FIREONCE 0x0001 #define SF_RELAY_FIREONCE 0x0001
// multi_manager /**
* multi_manager
*/
#define SF_MULTIMAN_CLONE 0x80000000 #define SF_MULTIMAN_CLONE 0x80000000
#define SF_MULTIMAN_THREAD 0x00000001 #define SF_MULTIMAN_THREAD 0x00000001
// env_render - Flags to indicate masking off various render parameters that are normally copied to the targets /**
* env_render
* @note These are flags to indicate masking off various render parameters that
* are usually copied to the targets
*/
#define SF_RENDER_MASKFX (1<<0) #define SF_RENDER_MASKFX (1<<0)
#define SF_RENDER_MASKAMT (1<<1) #define SF_RENDER_MASKAMT (1<<1)
#define SF_RENDER_MASKMODE (1<<2) #define SF_RENDER_MASKMODE (1<<2)
#define SF_RENDER_MASKCOLOR (1<<3) #define SF_RENDER_MASKCOLOR (1<<3)
// trigger_changelevel /**
* trigger_changelevel
*/
#define SF_CHANGELEVEL_USEONLY 0x0002 #define SF_CHANGELEVEL_USEONLY 0x0002
// trigger_endsection /**
* trigger_endsection
*/
#define SF_ENDSECTION_USEONLY 0x0001 #define SF_ENDSECTION_USEONLY 0x0001
// trigger_camera /**
* trigger_camera
*/
#define SF_CAMERA_PLAYER_POSITION 1 #define SF_CAMERA_PLAYER_POSITION 1
#define SF_CAMERA_PLAYER_TARGET 2 #define SF_CAMERA_PLAYER_TARGET 2
#define SF_CAMERA_PLAYER_TAKECONTROL 4 #define SF_CAMERA_PLAYER_TAKECONTROL 4
// func_rotating /**
* func_rotating
*/
#define SF_BRUSH_ROTATE_Y_AXIS 0 #define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1 #define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2 #define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4 #define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8 #define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16 #define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32 #define SF_PENDULUM_PASSABLE 32
#define SF_BRUSH_ROTATE_SMALLRADIUS 128 #define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256 #define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512 #define SF_BRUSH_ROTATE_LARGERADIUS 512
// triggers /**
#define SF_TRIGGER_ALLOWMONSTERS 1 // Monsters allowed to fire this trigger * triggers
#define SF_TRIGGER_NOCLIENTS 2 // Players not allowed to fire this trigger */
#define SF_TRIGGER_ALLOWMONSTERS 1 // Monsters allowed to fire this trigger
#define SF_TRIGGER_NOCLIENTS 2 // Players not allowed to fire this trigger
#define SF_TRIGGER_PUSHABLES 4 // Only pushables can fire this trigger #define SF_TRIGGER_PUSHABLES 4 // Only pushables can fire this trigger
#define SF_TRIG_PUSH_ONCE 1 #define SF_TRIG_PUSH_ONCE 1
// func_breakable
/**
* func_breakable
*/
#define SF_BREAK_TRIGGER_ONLY 1 // May only be broken by trigger #define SF_BREAK_TRIGGER_ONLY 1 // May only be broken by trigger
#define SF_BREAK_TOUCH 2 // Can be 'crashed through' by running player (plate glass) #define SF_BREAK_TOUCH 2 // Can be 'crashed through' by running player (plate glass)
#define SF_BREAK_PRESSURE 4 // Can be broken by a player standing on it #define SF_BREAK_PRESSURE 4 // Can be broken by a player standing on it
#define SF_BREAK_CROWBAR 256 // Instant break if hit with crowbar #define SF_BREAK_CROWBAR 256 // Instant break if hit with crowbar
// func_pushable (it's also func_breakable, so don't collide with those flags) /**
* func_pushable (also func_breakable, so don't collide with those flags)
*/
#define SF_PUSH_BREAKABLE 128 #define SF_PUSH_BREAKABLE 128
// light_spawn /**
* light_spawn
*/
#define SF_LIGHT_START_OFF 1 #define SF_LIGHT_START_OFF 1
#define SPAWNFLAG_NOMESSAGE 1 #define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1 #define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4 #define SPAWNFLAG_DROIDONLY 4
#define SPAWNFLAG_USEONLY 1 // Can't be touched, must be used (buttons) #define SPAWNFLAG_USEONLY 1 // Can't be touched, must be used (buttons)
// Monster Spawnflags /**
#define SF_MONSTER_WAIT_TILL_SEEN 1 // Spawnflag that makes monsters wait until player can see them before attacking * Monster Spawnflags
#define SF_MONSTER_GAG 2 // No idle noises from this monster */
#define SF_MONSTER_WAIT_TILL_SEEN 1 // Spawnflag that makes monsters wait until player can see them before attacking
#define SF_MONSTER_GAG 2 // No idle noises from this monster
#define SF_MONSTER_HITMONSTERCLIP 4 #define SF_MONSTER_HITMONSTERCLIP 4
#define SF_MONSTER_PRISONER 16 // Monster won't attack anyone, no one will attacke him #define SF_MONSTER_PRISONER 16 // Monster won't attack anyone, no one will attacke him
#define SF_MONSTER_WAIT_FOR_SCRIPT 128 // Spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked #define SF_MONSTER_WAIT_FOR_SCRIPT 128 // Spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked
#define SF_MONSTER_PREDISASTER 256 // This is a predisaster scientist or barney; influences how they speak #define SF_MONSTER_PREDISASTER 256 // This is a predisaster scientist or barney; influences how they speak
#define SF_MONSTER_FADECORPSE 512 // Fade out corpse after death #define SF_MONSTER_FADECORPSE 512 // Fade out corpse after death
#define SF_MONSTER_FALL_TO_GROUND 0x80000000 #define SF_MONSTER_FALL_TO_GROUND 0x80000000
@ -452,62 +585,77 @@
#define SF_MONSTER_TURRET_STARTINACTIVE 64 #define SF_MONSTER_TURRET_STARTINACTIVE 64
#define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // Don't attack the player unless provoked #define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // Don't attack the player unless provoked
// info_decal /**
* info_decal
*/
#define SF_DECAL_NOTINDEATHMATCH 2048 #define SF_DECAL_NOTINDEATHMATCH 2048
// worldspawn /**
* worldspawn
*/
#define SF_WORLD_DARK 0x0001 // Fade from black at startup #define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup #define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams #define SF_WORLD_FORCETEAM 0x0004 // Force teams
// Set this bit on guns and stuff that should never respawn /**
* Set this bit on guns and stuff that should never respawn
*/
#define SF_NORESPAWN (1<<30) #define SF_NORESPAWN (1<<30)
// Valve Mod Weapon Constants /**
#define HLI_HEALTHKIT 1 * @endsection
#define HLI_ANTIDOTE 2 */
#define HLI_SECURITY 3
#define HLI_BATTERY 4
#define HLW_NONE 0 /**
#define HLW_CROWBAR 1 * Valve Mod Weapon Constants
#define HLW_GLOCK 2 */
#define HLW_PYTHON 3 #define HLI_HEALTHKIT 1
#define HLW_MP5 4 #define HLI_ANTIDOTE 2
#define HLW_CHAINGUN 5 #define HLI_SECURITY 3
#define HLW_CROSSBOW 6 #define HLI_BATTERY 4
#define HLW_SHOTGUN 7
#define HLW_RPG 8 #define HLW_NONE 0
#define HLW_GAUSS 9 #define HLW_CROWBAR 1
#define HLW_EGON 10 #define HLW_GLOCK 2
#define HLW_HORNETGUN 11 #define HLW_PYTHON 3
#define HLW_HANDGRENADE 12 #define HLW_MP5 4
#define HLW_TRIPMINE 13 #define HLW_CHAINGUN 5
#define HLW_SATCHEL 14 #define HLW_CROSSBOW 6
#define HLW_SNARK 15 #define HLW_SHOTGUN 7
#define HLW_SUIT 31 #define HLW_RPG 8
#define HLW_ALLWEAPONS (~(1<<HLW_SUIT)) #define HLW_GAUSS 9
#define HLW_EGON 10
#define HLW_HORNETGUN 11
#define HLW_HANDGRENADE 12
#define HLW_TRIPMINE 13
#define HLW_SATCHEL 14
#define HLW_SNARK 15
#define HLW_SUIT 31
#define HLW_ALLWEAPONS (~(1<<HLW_SUIT))
#define FEV_NOTHOST (1<<0) // Skip local host for event send. #define FEV_NOTHOST (1<<0) // Skip local host for event send.
#define FEV_RELIABLE (1<<1) // Send the event reliably. You must specify the origin and angles #define FEV_RELIABLE (1<<1) // Send the event reliably. You must specify the origin and angles
// for this to work correctly on the server for anything // for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not // that depends on the event origin/angles. I.e., the origin/angles are not
// taken from the invoking edict for reliable events. // taken from the invoking edict for reliable events.
#define FEV_GLOBAL (1<<2) // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC #define FEV_GLOBAL (1<<2) // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).
#define FEV_UPDATE (1<<3) // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate #define FEV_UPDATE (1<<3) // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate
#define FEV_HOSTONLY (1<<4) // Only send to entity specified as the invoker #define FEV_HOSTONLY (1<<4) // Only send to entity specified as the invoker
#define FEV_SERVER (1<<5) // Only send if the event was created on the server. #define FEV_SERVER (1<<5) // Only send if the event was created on the server.
#define FEV_CLIENT (1<<6) // Only issue event client side ( from shared code ) #define FEV_CLIENT (1<<6) // Only issue event client side ( from shared code )
// These are caps bits to indicate what an object's capabilities (currently used for save/restore and level transitions) /**
#define FCAP_CUSTOMSAVE 0x00000001 * Cap bits to indicate what an object's capabilities are, currently used for
#define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions * save/restore and level transitions.
#define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore */
#define FCAP_DONT_SAVE 0x80000000 // Don't save this #define FCAP_CUSTOMSAVE 0x00000001
#define FCAP_IMPULSE_USE 0x00000008 // can be used by the player #define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
#define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player #define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore
#define FCAP_ONOFF_USE 0x00000020 // can be used by the player #define FCAP_DONT_SAVE 0x80000000 // Don't save this
#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains) #define FCAP_IMPULSE_USE 0x00000008 // can be used by the player
#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource) #define FCAP_CONTINUOUS_USE 0x00000010 // can be used by the player
#define FCAP_ONOFF_USE 0x00000020 // can be used by the player
#define FCAP_DIRECTIONAL_USE 0x00000040 // Player sends +/- 1 when using (currently only tracktrains)
#define FCAP_MASTER 0x00000080 // Can be used to "master" other entities (like multisource)

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@
* 0 - no error * 0 - no error
* 1 - error while creating socket * 1 - error while creating socket
* 2 - couldn't resolve hostname * 2 - couldn't resolve hostname
* 3 - couldn't connect to given hostname:port * 3 - couldn't connect to given hostname:port
*/ */
native socket_open(const _hostname[], _port, _protocol = SOCKET_TCP, &_error); native socket_open(const _hostname[], _port, _protocol = SOCKET_TCP, &_error);
@ -64,7 +64,7 @@ native socket_send(_socket, const _data[], _length);
native socket_send2(_socket, const _data[], _length); native socket_send2(_socket, const _data[], _length);
/* This function will return true if the state (buffer content) have changed within the last recieve or /* This function will return true if the state (buffer content) have changed within the last recieve or
* the timeout, where timeout is a value in µSeconds, (1 sec =1000000 µsec). * the timeout, where timeout is a value in µSeconds, (1 sec =1000000 µsec).
* Use to check if new data is in your socket. */ * Use to check if new data is in your socket. */
native socket_change(_socket, _timeout=100000); native socket_change(_socket, _timeout=100000);