changed repo to lgsm-cs-funmaps

This commit is contained in:
zino
2023-11-20 16:30:06 +01:00
parent c1e5704385
commit 7639da7306
790 changed files with 0 additions and 14 deletions

View File

@@ -0,0 +1,302 @@
/* AMX Mod X constants
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _amxconst_included
#endinput
#endif
#define _amxconst_included
#include <svn_version>
#define M_PI 3.1415926535
#define ADMIN_ALL 0 /* everyone */
#define ADMIN_IMMUNITY (1<<0) /* flag "a" */
#define ADMIN_RESERVATION (1<<1) /* flag "b" */
#define ADMIN_KICK (1<<2) /* flag "c" */
#define ADMIN_BAN (1<<3) /* flag "d" */
#define ADMIN_SLAY (1<<4) /* flag "e" */
#define ADMIN_MAP (1<<5) /* flag "f" */
#define ADMIN_CVAR (1<<6) /* flag "g" */
#define ADMIN_CFG (1<<7) /* flag "h" */
#define ADMIN_CHAT (1<<8) /* flag "i" */
#define ADMIN_VOTE (1<<9) /* flag "j" */
#define ADMIN_PASSWORD (1<<10) /* flag "k" */
#define ADMIN_RCON (1<<11) /* flag "l" */
#define ADMIN_LEVEL_A (1<<12) /* flag "m" */
#define ADMIN_LEVEL_B (1<<13) /* flag "n" */
#define ADMIN_LEVEL_C (1<<14) /* flag "o" */
#define ADMIN_LEVEL_D (1<<15) /* flag "p" */
#define ADMIN_LEVEL_E (1<<16) /* flag "q" */
#define ADMIN_LEVEL_F (1<<17) /* flag "r" */
#define ADMIN_LEVEL_G (1<<18) /* flag "s" */
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */
#define ADMIN_MENU (1<<20) /* flag "u" */
#define ADMIN_ADMIN (1<<24) /* flag "y" */
#define ADMIN_USER (1<<25) /* flag "z" */
#define FLAG_KICK (1<<0) /* flag "a" */
#define FLAG_TAG (1<<1) /* flag "b" */
#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" */
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */
#define PLUGIN_HANDLED 1 /* stop other plugins */
#define PLUGIN_HANDLED_MAIN 2 /* to use in client_command(), continue all plugins but stop the command */
/* Flags for register_cvar() */
#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_SERVER 4 /* notifies players when changed */
#define FCVAR_EXTDLL 8 /* defined by external 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_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_UNLOGGED 256 /* If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
/* Id of weapons in CS */
#define CSW_P228 1
#define CSW_SCOUT 3
#define CSW_HEGRENADE 4
#define CSW_XM1014 5
#define CSW_C4 6
#define CSW_MAC10 7
#define CSW_AUG 8
#define CSW_SMOKEGRENADE 9
#define CSW_ELITE 10
#define CSW_FIVESEVEN 11
#define CSW_UMP45 12
#define CSW_SG550 13
#define CSW_GALI 14
#define CSW_GALIL 14
#define CSW_FAMAS 15
#define CSW_USP 16
#define CSW_GLOCK18 17
#define CSW_AWP 18
#define CSW_MP5NAVY 19
#define CSW_M249 20
#define CSW_M3 21
#define CSW_M4A1 22
#define CSW_TMP 23
#define CSW_G3SG1 24
#define CSW_FLASHBANG 25
#define CSW_DEAGLE 26
#define CSW_SG552 27
#define CSW_AK47 28
#define CSW_KNIFE 29
#define CSW_P90 30
#define CSW_VEST 31
#define CSW_VESTHELM 32
#define HIW_BERETTA 1
#define HIW_SPAS12 2
#define HIW_M4A1 3
#define HIW_MP5A4 4
#define HIW_MP5SD5 5
#define HIW_AK47 6
#define HIW_AKS74U 7
#define HIW_GLOCK 8
#define HIW_M11 9
#define HIW_M11SD 10
#define HIW_PSG1 11
#define HIW_ZASTAVA 12
#define HIW_M16A2 13
#define HIW_REMINGTON 14
#define HIW_NATOGREN 15
#define HIW_TANGOGREN 16
#define HIW_FLASHBANG 17
/* Parts of body for hits */
#define HIT_GENERIC 0 /* none */
#define HIT_HEAD 1
#define HIT_CHEST 2
#define HIT_STOMACH 3
#define HIT_LEFTARM 4
#define HIT_RIGHTARM 5
#define HIT_LEFTLEG 6
#define HIT_RIGHTLEG 7
/* Constants for emit_sound() */
/* Channels */
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#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_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). */
/* Attenuation values */
#define ATTN_NONE 0.00
#define ATTN_NORM 0.80
#define ATTN_IDLE 2.00
#define ATTN_STATIC 1.25
/* Pitch values */
#define PITCH_NORM 100 /* non-pitch shifted */
#define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */
#define PITCH_HIGH 120
/* Volume values */
#define VOL_NORM 1.0
/* Menu keys */
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7)
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)
#define LANG_SERVER 0
#define LANG_PLAYER -1
/* Destination types for client_print() */
enum {
print_notify = 1,
print_console,
print_chat,
print_center,
};
/* Destination types for engclient_print() */
enum {
engprint_console = 0,
engprint_center,
engprint_chat,
};
/* Render for set_user_rendering() */
enum {
kRenderNormal = 0, /* src */
kRenderTransColor, /* c*a+dest*(1-a) */
kRenderTransTexture, /* src*a+dest*(1-a) */
kRenderGlow, /* src*a+dest -- No Z buffer checks */
kRenderTransAlpha, /* src*srca+dest*(1-srca) */
kRenderTransAdd, /* src*a+dest */
};
/* Fx for set_user_rendering() */
enum {
kRenderFxNone = 0,
kRenderFxPulseSlow,
kRenderFxPulseFast,
kRenderFxPulseSlowWide,
kRenderFxPulseFastWide,
kRenderFxFadeSlow,
kRenderFxFadeFast,
kRenderFxSolidSlow,
kRenderFxSolidFast,
kRenderFxStrobeSlow,
kRenderFxStrobeFast,
kRenderFxStrobeFaster,
kRenderFxFlickerSlow,
kRenderFxFlickerFast,
kRenderFxNoDissipation,
kRenderFxDistort, /* Distort/scale/translate flicker */
kRenderFxHologram, /* kRenderFxDistort + distance fade */
kRenderFxDeadPlayer, /* kRenderAmt is the player index */
kRenderFxExplode, /* Scale up really big! */
kRenderFxGlowShell, /* Glowing Shell */
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
};
/* Type for force_unmodified() */
enum {
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_specifybounds, /* For model files only, the geometry must fit in the specified bbox */
};
/* Status for get_module() */
enum {
module_none = 0,
module_query,
module_badload,
module_loaded,
module_noinfo,
module_noquery,
module_noattach,
module_old,
};
#define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#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_OLDFILE 0x20 /* Old AMX Mod plugin */
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000 /* busy browsing */
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
#define INVALID_PLUGIN_ID -1
#define MENU_EXIT -3
#define MENU_BACK -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
#define AMX_ERR_NONE 0
#define AMX_ERR_BOUNDS 4
#define AMX_ERR_STACKERR 3
#define AMX_ERR_STACKLOW 7
#define AMX_ERR_HEAPLOW 8
#define AMX_ERR_DIVIDE 11
#define AMX_ERR_NOTFOUND 19
#define AMX_ERR_PARAMS 25
#define AMX_ERR_GENERAL 27
#define INVALID_HANDLE -1
#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 FP_CELL 0
#define FP_FLOAT 1
#define FP_STRING 2
#define FP_ARRAY 4
#define FORWARD_ONLY_OLD 1
#define FORWARD_ONLY_NEW 2
#define FORWARD_ALL 3
#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
enum LibType
{
LibType_Library,
LibType_Class
};
enum AdminProp
{
AdminProp_Auth = 0,
AdminProp_Password,
AdminProp_Access,
AdminProp_Flags
};

View File

@@ -0,0 +1,622 @@
/* AMX Mod X misc.
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _amxmisc_included
#endinput
#endif
#define _amxmisc_included
#if !defined _amxmodx_included
#if defined AMXMOD_BCOMPAT
#include <amxmod>
#else
#include <amxmodx>
#endif
#endif
#if defined AMXMOD_BCOMPAT
#if defined _translator_included
#define SIMPLE_T(%1) _T(%1)
#else
#define SIMPLE_T(%1) %1
#endif
#endif
stock is_user_admin(id)
{
new __flags=get_user_flags(id);
return (__flags>0 && !(__flags&ADMIN_USER));
}
stock cmd_access(id, level, cid, num, bool:accesssilent = false)
{
new has_access = 0;
if ( id==(is_dedicated_server()?0:1) )
{
has_access = 1;
}
else if ( level==ADMIN_ADMIN )
{
if ( is_user_admin(id) )
{
has_access = 1;
}
}
else if ( get_user_flags(id) & level )
{
has_access = 1;
}
else if (level == ADMIN_ALL)
{
has_access = 1;
}
if ( has_access==0 )
{
if (!accesssilent)
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("You have no access to that command."));
#else
console_print(id,"%L",id,"NO_ACC_COM");
#endif
}
return 0;
}
if (read_argc() < num)
{
new hcmd[32], hinfo[128], hflag;
get_concmd(cid,hcmd,31,hflag,hinfo,127,level);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Usage: %s %s"), hcmd, SIMPLE_T(hinfo));
#else
console_print(id,"%L: %s %s",id,"USAGE",hcmd,hinfo);
#endif
return 0;
}
return 1;
}
stock access(id,level)
{
if (level==ADMIN_ADMIN)
{
return is_user_admin(id);
}
else if (level==ADMIN_ALL)
{
return 1;
}
return (get_user_flags(id) & level);
}
/* Flags:
* 1 - obey immunity
* 2 - allow yourself
* 4 - must be alive
* 8 - can't be bot */
#define CMDTARGET_OBEY_IMMUNITY (1<<0)
#define CMDTARGET_ALLOW_SELF (1<<1)
#define CMDTARGET_ONLY_ALIVE (1<<2)
#define CMDTARGET_NO_BOTS (1<<3)
stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
{
new player = find_player("bl",arg);
if (player)
{
if ( player != find_player("blj",arg) )
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("There are more clients matching to your argument"));
#else
console_print(id,"%L",id,"MORE_CL_MATCHT");
#endif
return 0;
}
}
else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
{
player = find_player("k",str_to_num(arg[1]));
}
if (!player)
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Client with that name or userid not found"));
#else
console_print(id,"%L",id,"CL_NOT_FOUND");
#endif
return 0;
}
if (flags & CMDTARGET_OBEY_IMMUNITY)
{
if ((get_user_flags(player) & ADMIN_IMMUNITY) &&
((flags & CMDTARGET_ALLOW_SELF) ? (id != player) : true) )
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Client ^"%s^" has immunity"), imname);
#else
console_print(id,"%L",id,"CLIENT_IMM",imname);
#endif
return 0;
}
}
if (flags & CMDTARGET_ONLY_ALIVE)
{
if (!is_user_alive(player))
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("That action can't be performed on dead client ^"%s^""), imname);
#else
console_print(id,"%L",id,"CANT_PERF_DEAD",imname);
#endif
return 0;
}
}
if (flags & CMDTARGET_NO_BOTS)
{
if (is_user_bot(player))
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("That action can't be performed on bot ^"%s^""), imname);
#else
console_print(id,"%L",id,"CANT_PERF_BOT",imname);
#endif
return 0;
}
}
return player;
}
/**
* Standard method to show activity to clients connected to the server.
* This depends on the amx_show_activity cvar. See documentation for more details.
*
* @param id The user id of the person doing the action.
* @param name The name of the person doing the action.
* @param fmt The format string to display. Do not put the "ADMIN:" prefix in this.
*/
stock show_activity( id, const name[], const fmt[], any:... )
{
static __amx_show_activity;
if (__amx_show_activity == 0)
{
__amx_show_activity = get_cvar_pointer("amx_show_activity");
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
#if defined AMXMOD_BCOMPAT
new buffer[128];
format_args( buffer , 127 , 2 );
#else
new prefix[10];
if (is_user_admin(id))
{
copy(prefix, charsmax(prefix), "ADMIN");
}
else
{
copy(prefix, charsmax(prefix), "PLAYER");
}
new buffer[512];
vformat(buffer, charsmax(buffer), fmt, 4);
#endif
switch(get_pcvar_num(__amx_show_activity))
{
#if defined AMXMOD_BCOMPAT
case 2: // show name to all
{
client_print(0, print_chat, "%s %s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), name, buffer);
}
case 1: // hide name to all
{
client_print(0, print_chat, "%s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer);
}
#else
case 5: // hide name only to admins, show nothing to normal users
{
new __maxclients=get_maxplayers();
for (new i=1; i<=__maxclients; i++)
{
if (is_user_connected(i))
{
if (is_user_admin(i))
{
client_print(i, print_chat, "%L: %s", i, prefix, buffer);
}
}
}
}
case 4: // show name only to admins, show nothing to normal users
{
new __maxclients=get_maxplayers();
for (new i=1; i<=__maxclients; i++)
{
if (is_user_connected(i))
{
if (is_user_admin(i))
{
client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer);
}
}
}
}
case 3: // show name only to admins, hide name from normal users
{
new __maxclients=get_maxplayers();
for (new i=1; i<=__maxclients; i++)
{
if (is_user_connected(i))
{
if (is_user_admin(i))
{
client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer);
}
else
{
client_print(i, print_chat, "%L: %s", i, prefix, buffer);
}
}
}
}
case 2: // show name to all
{
client_print(0, print_chat, "%L %s: %s", LANG_PLAYER, prefix , name , buffer );
}
case 1: // hide name to all
{
client_print(0, print_chat, "%L: %s", LANG_PLAYER, prefix, buffer );
}
#endif
}
}
/**
* Standard method to show activity to one single client.
* This is useful for messages that get pieced together by many language keys.
* This depends on the amx_show_activity cvar. See documentation for more details.
*
* @param idtarget The user id of the person to display to. 0 is invalid.
* @param idadmin The user id of the person doing the action.
* @param name The name of the person doing the action.
* @param fmt The format string to display. Do not put the "ADMIN:" prefix in this.
*/
stock show_activity_id(idtarget, idadmin, const name[], const fmt[], any:...)
{
if (idtarget == 0 ||
!is_user_connected(idtarget) )
{
return;
}
static __amx_show_activity;
if (__amx_show_activity == 0)
{
__amx_show_activity = get_cvar_pointer("amx_show_activity");
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
static prefix[10];
if (is_user_admin(idadmin))
{
copy(prefix, charsmax(prefix), "ADMIN");
}
else
{
copy(prefix, charsmax(prefix), "PLAYER");
}
static buffer[512];
vformat(buffer, charsmax(buffer), fmt, 5);
switch(get_pcvar_num(__amx_show_activity))
{
case 5: // hide name only to admins, show nothing to normal users
{
if ( is_user_admin(idtarget) )
{
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
}
}
case 4: // show name only to admins, show nothing to normal users
{
if ( is_user_admin(idtarget) )
{
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
}
}
case 3: // show name only to admins, hide name from normal users
{
if ( is_user_admin(idtarget) )
{
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
}
else
{
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
}
}
case 2: // show name to all
{
client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer);
}
case 1: // hide name to all
{
client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer);
}
}
}
/**
* Standard method to show activity to one single client with normal language keys.
* These keys need to be in the format of standard AMXX keys:
* eg: ADMIN_KICK_1 = ADMIN: kick %s
* ADMIN_KICK_2 = ADMIN %s: kick %s
* This depends on the amx_show_activity cvar. See documentation for more details.
*
* @param KeyWithoutName The language key that does not have the name field.
* @param KeyWithName The language key that does have the name field.
* @param __AdminName The name of the person doing the action.
* @extra Pass any extra format arguments for the language key in the variable arguments list.
*/
stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___AdminName[], any:...)
{
// The variable gets used via vformat, but the compiler doesn't know that, so it still cries.
#pragma unused ___AdminName
static __amx_show_activity;
if (__amx_show_activity == 0)
{
__amx_show_activity = get_cvar_pointer("amx_show_activity");
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
new buffer[512];
new keyfmt[256];
new i;
new __maxclients=get_maxplayers();
switch( get_pcvar_num(__amx_show_activity) )
{
case 5: // hide name to admins, display nothing to normal players
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
client_print(i, print_chat, "%s", buffer);
}
}
}
case 4: // show name only to admins, display nothing to normal players
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
client_print(i, print_chat, "%s", buffer);
}
}
}
case 3: // show name only to admins, hide name from normal users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
if ( is_user_admin(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
}
else
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
}
client_print(i, print_chat, "%s", buffer);
}
}
case 2: // show name to all users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i);
vformat(buffer, charsmax(buffer), keyfmt, 3);
client_print(i, print_chat, "%s", buffer);
}
}
case 1: // hide name from all users
while (i++ < __maxclients)
{
if ( is_user_connected(i) )
{
LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i);
// skip the "adminname" argument if not showing name
vformat(buffer, charsmax(buffer), keyfmt, 4);
client_print(i, print_chat, "%s", buffer);
}
}
}
}
stock colored_menus()
{
new mod_name[32];
get_modname(mod_name,31);
return ( equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"dod") );
}
stock cstrike_running()
{
new mod_name[32];
get_modname(mod_name,31);
return ( equal(mod_name,"cstrike") || equal(mod_name,"czero") || equal(mod_name,"csv15") || equal(mod_name,"cs13") );
}
stock is_running(const mod[])
{
new mod_name[32];
get_modname(mod_name,31);
return equal(mod_name,mod);
}
stock get_basedir(name[],len)
{
return get_localinfo("amxx_basedir",name,len);
}
stock get_configsdir(name[],len)
{
return get_localinfo("amxx_configsdir",name,len);
}
stock get_datadir(name[],len)
{
return get_localinfo("amxx_datadir",name,len);
}
stock register_menu(const title[],keys,const function[],outside=0)
{
register_menucmd(register_menuid(title,outside),keys,function);
}
/* Backwards Compatibility
* don't use it! */
stock get_customdir(name[],len)
{
return get_localinfo("amxx_configsdir",name,len);
}
/* Add a menu item to Menus Front-End plugin ("amxmodmenu"):
* MENU_TEXT: Text that will be shown for this item in menu
* MENU_CMD: Command that should be executed to start menu
* MENU_ACCESS: Access required for menu
* MENU_PLUGIN: The exact case-insensitive name of plugin holding the menu command
*/
stock AddMenuItem(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[])
{
AddMenuItem_call(MENU_TEXT, MENU_CMD, MENU_ACCESS, MENU_PLUGIN, false);
}
/* Just like above, but add menu item to "amx_menu", that should also be accessible by non-admins.
*/
stock AddClientMenuItem(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[])
{
AddMenuItem_call(MENU_TEXT, MENU_CMD, MENU_ACCESS, MENU_PLUGIN, true);
}
// Internal function used by above stocks.
stock AddMenuItem_call(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[], const bool:ADD_TO_CLIENT_MENU)
{
new pluginid = is_plugin_loaded("Menus Front-End");
if (pluginid == -1) {
log_amx("Can't add menu item ^"%s^" from plugin ^"%s^" to menu set because the Menus Front-End plugin itself is not loaded!", MENU_TEXT, MENU_PLUGIN);
return; // Menus Front-End doesn't exist, return.
}
new filename[64], b[1];
get_plugin(pluginid, filename, 63, b, 0, b, 0, b, 0, b, 0);
new status = callfunc_begin(ADD_TO_CLIENT_MENU ? "AddClientMenu" : "AddMenu", filename);
new bool:failed = true;
switch (status)
{
case 1: failed = false;
case 0: log_amx("Run time error! (AddMenuItem_call failed)");
case -2: log_amx("Function not found! (AddMenuItem_call failed)");
case -1: log_amx("Plugin not found! (AddMenuItem_call failed)");
}
if (failed)
{
return;
}
// Item text
callfunc_push_str(MENU_TEXT);
// Cmd
callfunc_push_str(MENU_CMD);
// Access
callfunc_push_int(MENU_ACCESS);
// Menu exists in this plugin
callfunc_push_str(MENU_PLUGIN);
callfunc_end();
}
stock constraint_offset(low, high, seed, offset)
{
new numElements = high - low + 1;
offset += seed - low;
if (offset >= 0)
{
return low + (offset % numElements);
}
else
{
return high - (abs(offset) % numElements) + 1;
}
return 0; // Makes the compiler happy -_-
}
/* Returns true if the user has ANY of the provided flags
* false if they have none
*/
stock has_flag(id, const flags[])
{
return (get_user_flags(id) & read_flags(flags));
}
/* Returns true if the user has ALL of the provided flags
* false otherwise
*/
stock has_all_flags(id, const flags[])
{
new FlagsNumber=read_flags(flags);
return ((get_user_flags(id) & FlagsNumber)==FlagsNumber);
}

View File

@@ -0,0 +1,89 @@
/* VexdUM backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if !defined _fakemeta_included
#include <fakemeta>
#endif
#if !defined _engine_included
#include <engine>
#endif
#if defined _vexd_bcompat_included
#endinput
#endif
#define _vexd_bcompat_included
#include <VexdUM_const>
native radius_damage(inflictor, Float:dmg, Float:orig[3], Float:rad, bit = DMG_BULLET, wpnName[]="", hs = 0);
native take_damage(victim, attacker, Float:orig[3], Float:dmg, bit = DMG_BULLET, wpnName[]="", hs = 0);
native set_user_model(id, const Model[]="");
native entity_use(eUsed, eOther);
native get_num_ents();
native DispatchKeyValue(ent, szKey[], szValue[]);
// Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
// Will return an entindex if an entity is hit.
native trace_line(ent, Float:vStart[3], Float:vEnd[3], Float:vReturn[3]);
native traceline_get_int(iVar);
native traceline_set_int(iVar, iVal);
native Float:traceline_get_float(iVar);
native traceline_set_float(iVar, Float:fVal);
native traceline_get_vector(iVar, Float:vVal[3]);
native traceline_set_vector(iVar, Float:vVal[3]);
native traceline_get_edict(iVar);
native traceline_set_edict(iVar, iEnt);
/* Wrapper around pfn_touch */
forward entity_touch(entity1, entity2);
/* Wrapper around pfn_think */
forward entity_think(entity);
/* Wrapper around pfn_spawn */
forward entity_spawn(entity);
/* Wrapper around client_PreThink */
forward client_prethink(id);
/* Wrapper around client_PostThink */
forward client_postthink(id);
//From AMX Mod:
// Called when an Emitting Sound is played Server-Side
forward emitsound(entity, const sample[]);
//From AMX Mod:
// Called when an Emitting Ambient Sound is played Server-Side
forward emitambientsound(entity, const sample[]);
//From AMX Mod:
// Called when a model spawns
forward set_model(entity, const model[]);
//From AMX Mod:
// Called whatever an entity looks at
forward traceline(entity);
//:TODO: ?
// Called when a monster is hurt by VexdUM damage natives
// forward monster_hurt(monster, attacker, damage);
//From AMX Mod:
// Called when a keyvalue is set on a player
forward setclientkeyvalue(id, key[], value[]);
//From AMX Mod:
// Called when an entity gets a keyvalue set on it from the engine.
// Use copy_keyvalue to get the keyvalue information
forward keyvalue(entity);
#include <VexdUM_stock>

View File

@@ -0,0 +1,30 @@
#if defined _vexdum_const_included
#endinput
#endif
#define _vexdum_const_included
// TraceLine Integer
enum {
TR_INT_fAllSolid, // if true, plane is not valid
TR_INT_fStartSolid, // if true, the initial point was in a solid area
TR_INT_fInOpen,
TR_INT_fInWater,
TR_INT_iHitgroup, // 0 == generic, non zero is specific body part
};
// TraceLine Float
enum {
TR_FL_flFraction, // time completed, 1.0 = didn't hit anything
TR_FL_flPlaneDist,
};
// TraceLine Vector
enum {
TR_VEC_vecEndPos, // final position
TR_VEC_vecPlaneNormal, // surface normal at impact
};
// TraceLine Edict
enum {
TR_ENT_pHit, // entity the surface is on
};

View File

@@ -0,0 +1,135 @@
/* VexdUM stocks backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _vexd_bcompat_stocks_included
#endinput
#endif
#define _vexd_bcompat_stocks_included
#if !defined _engine_included
#include <engine>
#endif
stock is_entity(ent)
{
return pev_valid(ent);
}
stock get_offset_int(ent, offset, linos = 5)
{
return get_pdata_int(ent, offset, linos);
}
stock set_offset_int(ent, offset, value, linos = 5)
{
return set_pdata_int(ent, offset, value, linos);
}
stock in_view_cone(ent, Float:Orig[3])
{
return is_in_viewcone(ent, Orig);
}
stock get_maxentities()
{
return global_get(glb_maxEntities);
}
stock can_see(ent1, ent2)
{
if (is_entity(ent1) && is_entity(ent2))
{
new flags = pev(ent1, pev_flags);
if (flags & EF_NODRAW || flags & FL_NOTARGET)
{
return 0;
}
new Float:lookerOrig[3];
new Float:targetOrig[3];
new Float:temp[3];
pev(ent1, pev_origin, lookerOrig);
pev(ent1, pev_view_ofs, temp);
lookerOrig[0] += temp[0];
lookerOrig[1] += temp[1];
lookerOrig[2] += temp[2];
pev(ent2, pev_origin, targetOrig);
pev(ent2, pev_view_ofs, temp);
targetOrig[0] += temp[0];
targetOrig[1] += temp[1];
targetOrig[2] += temp[2];
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, ent1, 0);
if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
{
return 0;
} else {
new Float:flFraction;
get_tr2(0, TraceResult:TR_flFraction, flFraction);
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == ent2))
{
return 1;
}
}
}
return 0;
}
//From AMX Mod:
// Find an entity in the world, will return -1 if nothing is found
// type = 0: "classname"
// type = 1: "globalname"
// type = 2: "model"
// type = 3: "target"
// type = 4: "targetname"
// type = 5: "netname"
// type = 6: "message"
// type = 7: "noise"
// type = 8: "noise1"
// type = 9: "noise2"
// type = 10: "noise3"
// type = 11: "viewmodel"
// type = 12: "weaponmodel"
stock vexd_find_entity(ent, szValue[], type=0)
{
static _g_FindEntTypes[13][] =
{
"classname",
"globalname",
"model",
"target",
"targetname",
"netname",
"messages",
"noise",
"noise1",
"noise2",
"noise3",
"viewmodel",
"weaponmodel"
};
if (type < 0 || type >= 13)
{
type = 0;
}
return engfunc(EngFunc_FindEntityByString, ent, _g_FindEntTypes[type], szValue);
}
#define find_entity vexd_find_entity
//From AMX Mod:
// Find an entity within a given origin and radius
stock find_entity_sphere(ent, Float:Orig[3], Float:Rad)
{
return engfunc(EngFunc_FindEntityInSphere, ent, Orig, Rad);
}

View File

@@ -0,0 +1,109 @@
/* Vexd Utility backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _Vexd_Utilities_included
#endinput
#endif
#define _Vexd_Utilities_included
#include <engine>
#if defined AMXMOD_BCOMPAT
#if !defined _vexd_bcompat_included
#include <VexdUM>
#endif
#endif
stock Entvars_Get_Int(iIndex, iVariable)
return entity_get_int(iIndex, iVariable);
stock Entvars_Set_Int(iIndex, iVariable, iNewValue)
return entity_set_int(iIndex, iVariable, iNewValue);
stock Float:Entvars_Get_Float(iIndex, iVariable)
return entity_get_float(iIndex, iVariable);
stock Entvars_Set_Float(iIndex, iVariable, Float:fNewValue)
return entity_set_float(iIndex, iVariable, fNewValue);
stock Entvars_Get_Vector(iIndex, iVariable, Float:vRetVector[3])
return entity_get_vector(iIndex, iVariable, vRetVector);
stock Entvars_Set_Vector(iIndex, iVariable, Float:vNewVector[3])
return entity_set_vector(iIndex, iVariable, vNewVector);
stock Entvars_Get_Edict(iIndex, iVariable)
return entity_get_edict(iIndex, iVariable);
stock Entvars_Set_Edict(iIndex, iVariable, iNewIndex)
return entity_set_edict(iIndex, iVariable, iNewIndex);
stock Entvars_Get_String(iIndex, iVariable, szReturnValue[], iReturnLen)
return entity_get_string(iIndex, iVariable, szReturnValue, iReturnLen);
stock Entvars_Set_String(iIndex, iVariable, szNewValue[])
return entity_set_string(iIndex, iVariable, szNewValue);
stock Entvars_Get_Byte(iIndex, iVariable)
return entity_get_byte(iIndex, iVariable);
stock Entvars_Set_Byte(iIndex, iVariable, iNewValue)
return entity_set_byte(iIndex, iVariable, iNewValue);
stock CreateEntity(szClassname[])
return create_entity(szClassname);
stock ENT_SetModel(iIndex, szModel[])
return entity_set_model(iIndex, szModel);
stock ENT_SetOrigin(iIndex, Float:fNewOrigin[3])
return entity_set_origin(iIndex, fNewOrigin);
stock FindEntity(iIndex, szValue[])
return find_ent_by_class(iIndex, szValue);
stock RemoveEntity(iIndex)
return remove_entity(iIndex);
stock TraceLn(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_line(iIgnoreEnt, fStart, fEnd, vReturn);
stock TraceNormal(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_normal(iIgnoreEnt, fStart, fEnd, vReturn);
stock VecToAngles(Float:fVector[3], Float:vReturn[3])
return vector_to_angle(fVector, vReturn);
stock Float:VecLength(Float:vVector[3])
return vector_length(vVector);
stock Float:VecDist(Float:vVector[3], Float:vVector2[3])
return vector_distance(vVector, vVector2);
stock MessageBlock(iMessage, iMessageFlags)
return set_msg_block(iMessage, iMessageFlags);
stock GetMessageBlock(iMessage)
return get_msg_block(iMessage);
stock Float:HLTime()
return halflife_time();
stock FakeTouch(iToucher, iTouched)
return fake_touch(iToucher, iTouched);
stock AttachView(iIndex, iTargetIndex)
return attach_view(iIndex, iTargetIndex);
stock SetView(iIndex, ViewType)
return set_view(iIndex, ViewType);
stock SetSpeak(iIndex, iSpeakFlags)
return set_speak(iIndex, iSpeakFlags);
forward vexd_pfntouch(pToucher, pTouched);
forward ServerFrame();

View File

@@ -0,0 +1,318 @@
/* AMX Mod X Backwards Compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _amxmod_included
#endinput
#endif
#define _amxmod_included
#if !defined AMXMOD_BCOMPAT
#define AMXMOD_BCOMPAT
#endif
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <maths>
stock AMX_VERSION[] = "1.76-BC";
#define ADMIN_PERMBAN ADMIN_BAN //AMX Mod admin flag for permanent ban
#define ADMIN_UNBAN ADMIN_BAN //AMX Mod admin flag for unbanning
#define ADMIN_SUPREME ADMIN_IMMUNITY //AMX Mod admin flag for "super admin" (can kick, slap, ban, slay admins with Immunity)
/* Core will identify us as an "old plugin" this way. */
public __b_old_plugin = 1;
public __b_ident_vers()
{
return __b_old_plugin;
}
stock user_spawn(index)
return spawn(index);
stock get_logfile( name[], len )
return get_time("admin%m%d.log",name,len);
stock get_user_money(index)
return cs_get_user_money(index);
stock set_user_money(index,money,flash=1)
return cs_set_user_money(index,money,flash);
stock numtostr(num,string[],len)
return num_to_str(num,string,len);
stock strtonum(const string[])
return str_to_num(string);
stock build_path(path[], len, {Float,_}:... )
{
format_args(path, len, 2);
new pathlen = strlen(path);
new basedir[32];
if (containi(path, "$basedir") != -1)
{
get_localinfo("amxx_basedir", basedir, 31);
if (!basedir[0])
{
copy(basedir, 31, "addons/amxmodx");
}
if ((pathlen+strlen(basedir)-strlen("$basedir")) < len)
{
replace(path, len, "$basedir", basedir);
}
}
new dir[64], subdir[63];
if (containi(path, "$configdir") != -1)
{
get_localinfo("amxx_configsdir", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/configs", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$configdir")) < len)
{
replace(path, len, "$configdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$langdir") != -1)
{
get_localinfo("amxx_datadir", subdir, 63);
if (!subdir[0])
{
format(subdir, 63, "%s/data", basedir);
}
format(dir, 63, "%s/amxmod-lang", subdir);
if ((pathlen+strlen(basedir)-strlen("$langdir")) < len)
{
replace(path, len, "$langdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$modulesdir") != -1)
{
get_localinfo("amxx_modules", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/modules", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$modulesdir")) < len)
{
replace(path, len, "$modulesdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$pluginsdir") != -1)
{
get_localinfo("amx_pluginsdir", dir, 63);
if( !dir[0])
{
format(dir, 63, "%s/plugins", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$pluginsdir")) < len)
{
replace(path, len, "$pluginsdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$logdir") != -1)
{
get_localinfo("amx_logs", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/logs", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$logdir")) < len)
{
replace(path, len, "$logdir", dir);
}
}
return 1;
}
stock is_user_authorized(id)
{
static auth[32];
get_user_authid(id, auth, 31);
if (auth[0] == 0 || equali(auth, "STEAM_ID_PENDING"))
{
return 0;
}
return 1;
}
/* Vector AMX Mod compatibility */
#define ANGLEVECTORS_FORWARD 1
#define ANGLEVECTORS_RIGHT 2
#define ANGLEVECTORS_UP 3
stock angle_to_vector(Float:vector[3], FRU, Float:ret[3])
{
return angle_vector(vector, FRU, ret);
}
stock get_cmdaccess(cmd[], accessflags[], len)
{
new num = get_concmdsnum(-1);
new command[32], info[3];
new flags;
for (new i=0; i<num; i++)
{
get_concmd(i, command, 31, flags, info, 2, -1);
if (equal(command, cmd))
{
get_flags(flags, accessflags, len);
return 1;
}
}
return 0;
}
stock is_translated(const sentence[])
{
return (GetLangTransKey(sentence) != TransKey_Bad);
}
stock get_plugincmdsnum(plugin[], type=7)
{
new plid = find_plugin_byfile(plugin);
new our_type;
/**
* Whoever wrote this was a bit confused about the type stuff...
*/
if (type == 1) {
our_type = 1;
} else if (type == 4) {
our_type = 0;
} else {
our_type = -1;
}
new found = 0;
new total = get_concmdsnum(-1, our_type);
for (new i=0; i<total; i++)
{
if (plid == get_concmd_plid(i, -1, our_type))
{
found++;
}
}
return found;
}
stock get_plugincmd(plugin[], index, cmd[], len1, accessflags[], len2, info[], len3, destid=-1, type=7)
{
new plid = find_plugin_byfile(plugin);
new our_type;
/**
* Whoever wrote this was a bit confused about the type stuff...
*/
if (type == 1) {
our_type = 1;
} else if (type == 4) {
our_type = 0;
} else {
our_type = -1;
}
new found_iter = 0;
new total = get_concmdsnum(-1, our_type);
for (new i=0; i<total; i++)
{
if (plid == get_concmd_plid(i, -1, our_type))
{
if (found_iter == index)
{
new flags, result;
result = get_concmd(i, cmd, len1, flags, info, len3, -1, our_type);
get_flags(flags, accessflags, len2);
return result;
}
found_iter++;
}
}
/* get rid of a compiler warning */
destid = -1;
return (++destid);
}
stock get_plugincvar(plugin[], index, cvar[], len1, value[], len2, flags=0)
{
new plid = find_plugin_byfile(plugin);
new total = get_plugins_cvarsnum();
new cvar_flags, plugin_id, pcvar_handle;
new iter_id = 0;
for (new i=0; i<total; i++)
{
get_plugins_cvar(i, cvar, len1, cvar_flags, plugin_id, pcvar_handle);
if ((plugin_id == plid)
&& (!flags || (cvar_flags & flags)))
{
if (iter_id == index)
{
get_pcvar_string(pcvar_handle, value, len2);
return 1;
}
iter_id++;
}
}
return 0;
}
stock get_plugincvarsnum(plugin[], flags=0)
{
new plid = find_plugin_byfile(plugin);
new total = get_plugins_cvarsnum();
new cvar_flags, plugin_id;
new cvars_total = 0;
for (new i=0; i<total; i++)
{
get_plugins_cvar(i, "", 0, cvar_flags, plugin_id);
if ((plugin_id == plid)
&& (!flags || (cvar_flags & flags)))
{
cvars_total++;
}
}
return cvars_total;
}
stock is_module_running(const module[])
{
if (strcmp(module, "MySQL Access") == 0)
return LibraryExists("sqlx", LibType_Class);
return is_module_loaded(module) == -1 ? 0 : 1;
}
stock is_plugin_running(const plugin[])
{
new status[8];
new id, filename[1], name[1], version[1], author[1];
id = is_plugin_loaded(plugin);
get_plugin(id, filename, 0, name, 0, version, 0, author, 0, status, 7);
return strcmp(status, "running") == 0 ? id + 1 : 0;
}

View File

@@ -0,0 +1,85 @@
/* AMX Mod math functions backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _maths_bcompat_included
#endinput
#endif
#define _maths_bcompat_included
#if !defined _float_included
#include <float>
#endif
stock Float:fabs(Float:value)
{
return floatabs(value);
}
stock Float:asin(Float:value)
{
return floatasin(value, radian);
}
stock Float:sin(Float:value)
{
return floatsin(value, radian);
}
stock Float:sinh(Float:value)
{
return floatsinh(value, radian);
}
stock Float:acos(Float:value)
{
return floatacos(value, radian);
}
stock Float:cos(Float:value)
{
return floatcos(value, radian);
}
stock Float:cosh(Float:value)
{
return floatcosh(value, radian);
}
stock Float:atan(Float:value)
{
return floatatan(value, radian);
}
stock Float:atan2(Float:value1, Float:value2)
{
return floatatan2(value1, value2, radian);
}
stock Float:tan(Float:value)
{
return floattan(value, radian);
}
stock Float:tanh(Float:value)
{
return floattanh(value, radian);
}
stock Float:fsqroot(Float:value)
{
return floatsqroot(value);
}
stock Float:fpower(Float:value, Float:exponent)
{
return floatpower(value, exponent);
}
stock Float:flog(Float:value, Float:base=10.0)
{
return floatlog(value, base);
}

View File

@@ -0,0 +1,20 @@
#if defined _mysql_included
#endinput
#endif
#define _mysql_included
#include <sqlx>
native mysql_connect(host[], user[], pass[], dbname[], error[], maxlength);
native mysql_query(sql, query[], {Float,_}:... );
native mysql_error(sql, dest[], maxlength);
native mysql_close(sql);
native mysql_nextrow(sql);
native mysql_getfield(sql, fieldnum, {Float,_}:... );
native mysql_getresult(sql, field[], {Float,_}:... );
native mysql_affected_rows(sql);
native mysql_num_fields(sql);
native mysql_num_rows(sql);
native mysql_field_name(sql, field, name[], length);
native mysql_insert_id(sql);

View File

@@ -0,0 +1,86 @@
/* AMX Mod X Backwards Compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _amxmod_translator_included
#endinput
#endif
#define _amxmod_translator_included
#define _translator_included
#include <amxmodx>
#include <amxmod>
#include <amxmisc>
//From AMX Mod. This is implemented in Core due to the nature of the
// translation engine and what AMX Mod did.
/* Translation backend, used by _T (since natives can't return arrays). */
native translate(const string[], destid=-1, forcelang=-1);
stock _T(const string[], destid=-1, forcelang=-1)
{
new TranslationResult[2] = {0, 0};
TranslationResult[0] = translate(string, destid, forcelang);
return TranslationResult;
}
stock load_translations(const file[])
{
static dir[255], path[255];
get_datadir(dir, 254);
format(path, 254, "%s/amxmod-lang/%s.txt", dir, file);
new fp
if (!(fp=fopen(path, "r")))
{
abort(AMX_ERR_NATIVE, "Could not find file: %s", path);
return 0;
}
static buffer[1024];
new lang[3];
new TransKey:bad_key = TransKey:-1;
new TransKey:cur_key = bad_key;
new len;
while (!feof(fp))
{
buffer[0] = 0;
fgets(fp, buffer, 1023);
len = strlen(buffer);
if (len == 0)
{
continue;
}
if (isspace(buffer[len-1]))
{
buffer[--len] = 0;
}
if (buffer[0] == '"')
{
remove_quotes(buffer);
cur_key = CreateLangKey(buffer);
AddTranslation("en", cur_key, buffer);
continue;
}
if (isspace(buffer[0]))
{
continue;
}
if ((cur_key != bad_key) && (buffer[2] == ':' && buffer[3] == '"'))
{
lang[0] = buffer[0];
lang[1] = buffer[1];
lang[2] = 0;
remove_quotes(buffer[3]);
AddTranslation(lang, cur_key, buffer[3]);
}
}
fclose(fp);
return 1;
}

View File

@@ -0,0 +1,97 @@
/* Xtrafun backwards compatibility
*
* by the AMX Mod X Development Team
* These natives were originally made by SpaceDude, EJ, and JustinHoMi.
*
* This file is provided as is (no warranties).
*/
#if !defined _xtrafun_included
#define _xtrafun_included
#if !defined _engine_included
#include <engine.inc>
#endif
/* Gets the velocity of an entity */
stock get_entity_velocity(index, velocity[3]) {
new Float:vector[3];
entity_get_vector(index, EV_VEC_velocity, vector);
FVecIVec(vector, velocity);
}
/* Sets the velocity of an entity */
stock set_entity_velocity(index, velocity[3]) {
new Float:vector[3];
IVecFVec(velocity, vector);
entity_set_vector(index, EV_VEC_velocity, vector);
}
/* Gets the origin of an entity */
stock get_entity_origin(index, origin[3]) {
new Float:vector[3];
entity_get_vector(index, EV_VEC_origin, vector);
FVecIVec(vector, origin);
}
/* Sets the origin of an entity */
stock set_entity_origin(index, origin[3]) {
new Float:vector[3];
IVecFVec(origin, vector);
entity_set_vector(index, EV_VEC_origin, vector);
}
/* Get the index of the grenade belonging to index.
* Model of grenade is returned in model[].
* Specify the grenadeindex to start searching from,
* or leave it at 0 to search from the start.
* Returns grenade index.
* Paths + models of grenades in Counter-Strike:
* HEGRENADE = "models/w_hegrenade.mdl"
* FLASHBANG = "models/w_flashbang.mdl"
* SMOKEGRENADE = "models/w_smokegrenade.mdl" */
stock get_grenade_index(index, model[], len, grenadeindex = 0) {
new entfind = grenadeindex;
new entowner = index;
for (;;) {
entfind = find_ent_by_class(entfind, "grenade");
if (entfind && is_valid_ent(entfind)) {
if (entity_get_edict(entFind, EV_ENT_owner) == entowner) {
entity_get_string(entfind, EV_SZ_model, model);
return entfind;
}
}
else {
// Eventually comes here if loop fails to find a grenade with specified owner.
return 0;
}
}
}
/* Find the number of entities in the game */
stock current_num_ents() {
return entity_count();
}
enum {
classname = 0,
target,
targetname
};
#if !defined _vexd_bcompat_included
/* Find an entity ID from start_from_ent id (use 0 to start from
* the beginning, category is either "classname", "target" or
* "targetname", value is the name you are searching for */
stock find_entity(start_from_ent, category, value[]) {
switch (category) {
case target: return find_ent_by_target(start_from_ent, value);
case targetname: return find_ent_by_tname(start_from_ent, value);
}
return find_ent_by_class(start_from_ent, value);
}
#endif
#endif // _xtrafun_included

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
#if defined _cellarray_included
#endinput
#endif
#define _cellarray_included
enum Array
{
Invalid_Array = 0
};
/**
* These arrays are intended to be used for a form of global storage without
* requiring a #define that needs to be increased each time a person needs more
* storage.
* These are not designed to be used as a replacement for normal arrays, as
* normal arrays are faster and should be used whenever possible.
*/
/**
* 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.
* @param reserved How many blank entries are created immediately when the array is created. These entries are not valid to read from until called with ArraySet.
* @return Handle to the array.
*/
native Array:ArrayCreate(cellsize=1, reserved=32);
/**
* Clears all entries from the array.
*
* @param which The array to clear.
* @return 1 on success, 0 on failure.
*/
native ArrayClear(Array:which);
/**
* Returns the number of elements in the array.
*
* @param which The array to check.
* @return How many elements are in the array.
*/
native ArraySize(Array:which);
/**
* Returns data within an array.
* Make sure the output buffer matches the size the array was created with!
*
* @param which The array to retrieve the item from.
* @param item The item to retrieve (zero-based).
* @param output The output buffer to write.
*/
native ArrayGetArray(Array:which, item, any:output[]);
/**
* Returns a single cell of data from an array.
* Use this only with arrays that were created with a cellsize of 1!
*
* @param which The array to retrieve the item from.
* @param item The item to retrieve (zero-based).
* @return The value of the cell.
*/
native any:ArrayGetCell(Array:which, item);
/**
* Returns a string value from an array.
*
* @param which The array to retrieve the item from.
* @param item The item to retrieve (zero-based).
* @param output The variable to store the value in.
* @param size Character size of the output buffer.
*/
native ArrayGetString(Array:which, item, output[], size);
/**
* Sets an item's data with that of a local buffer.
* 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.
* @param item The item to set (zero-based).
* @param input The input buffer to store.
*/
native ArraySetArray(Array:which, item, const any:input[]);
/**
* Sets an array's single cell value. Use this only on array that were created with a cellsize of 1!
* 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.
* @param item The item to set (zero-based).
* @param input The value to set.
*/
native ArraySetCell(Array:which, item, any:input);
/**
* Sets a string value from an array.
* 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.
* @param item The item to set (zero-based).
* @param input The string to set the item as.
*/
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.
* The buffer size must match what the cellsize that the array was created with!
*
* @param which The array to add the item to.
* @param input The input buffer to store.
*/
native ArrayPushArray(Array:which, const any:input[]);
/**
* Creates a new item and sets the array's single cell value.
* Use this only on array that were created with a cellsize of 1!
*
* @param which The array to add the item to.
* @param input The value to set.
*/
native ArrayPushCell(Array:which, any:input);
/**
* Creates a new element in the array and sets its value to the input buffer.
* The stored string will be truncated if it is longer than the cellsize the array was created with!
*
* @param which The array to add the item to.
* @param input The string to set the item as.
*/
native ArrayPushString(Array:which, const input[]);
/**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
* The buffer size must match what the cellsize that the array was created with!
*
* @param which The array to add the item to.
* @param item The item to insert after.
* @param input The input buffer to store.
*/
native ArrayInsertArrayAfter(Array:which, item, const any:input[]);
/**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
* Use this only on an array that was created with a cellsize of 1!
*
* @param which The array to add the item to.
* @param item The item to insert after.
* @param input The value to set.
*/
native ArrayInsertCellAfter(Array:which, item, any:input);
/**
* Inserts an item after the selected item. All items beyond it get shifted up 1 space.
* The stored string will be truncated if it is longer than the cellsize the array was created with!
*
* @param which The array to add the item to.
* @param item The item to insert after.
* @param input The value to set.
*/
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.
* The buffer size must match what the cellsize that the array was created with!
*
* @param which The array to add the item to.
* @param item The item to insert before.
* @param input The input buffer to store.
*/
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.
* Use this only on an array that was created with a cellsize of 1!
*
* @param which The array to add the item to.
* @param item The item to insert after.
* @param input The value to set.
*/
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.
* The stored string will be truncated if it is longer than the cellsize the array was created with!
*
* @param which The array to add the item to.
* @param item The item to insert before.
* @param input The value to set.
*/
native ArrayInsertStringBefore(Array:which, item, const input[]);
/**
* Swaps the position of two items.
*
* @param which The array that contains the items.
* @param item1 The first item to swap.
* @param item2 The second item to swap.
*/
native ArraySwap(Array:which, item1, item2);
/**
* Deletes an item from the array. All items beyond it get shifted down 1 space.
*
* @param which The array that contains the item to delete.
* @param item The item to delete.
*/
native ArrayDeleteItem(Array:which, item);
/**
* Creates a handle that is passable to a format compliant routine for printing as a string (with the %a format option).
* It is suggested to pass the function directly as a parameter to the format routine.
* The array contents must be a null-terminated string!
*
* An example usage: client_print(id, print_chat, "%a", ArrayGetStringHandle(MessageArray, i));
*
* @param which The array the string is stored in.
* @param item Which item to print the string value of.
* @return Handle to the item directly. Do not use or save stale handles.
*/
native DoNotUse:ArrayGetStringHandle(Array:which, item);
/**
* Destroys the array, and resets the handle to 0 to prevent accidental usage after it is destroyed.
*
* @param which The array to destroy.
*/
native ArrayDestroy(&Array:which);
/**
* Similar to sorting.inc's CustomSort.
* The sorting algorithm then uses your comparison function to sort the data.
* The function is called in the following manner:
*
* public MySortFunc(Array:array, item1, item2, const data[], data_size)
*
* array - Array handle in its current un-sorted state.
* item1, item2 - Current item pair being compared
* data[] - Extra data array you passed to the sort func.
* data_size - Size of extra data you passed to the sort func.
*
* Your function should return:
* -1 if item1 should go before item2
* 0 if item1 and item2 are equal
* 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 that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state.
*/
native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0);

View File

@@ -0,0 +1,26 @@
#if defined _celltrie_included
#endinput
#endif
#define _celltrie_included
enum Trie
{
Invalid_Trie = 0
};
native Trie:TrieCreate();
native TrieClear(Trie:handle);
native TrieSetCell(Trie:handle, const key[], any:value);
native TrieSetString(Trie:handle, const key[], const value[]);
native TrieSetArray(Trie:handle, const key[], const any:buffer[], size);
native bool:TrieGetCell(Trie:handle, const key[], &any:value);
native bool:TrieGetString(Trie:handle, const key[], output[], outputsize);
native bool:TrieGetArray(Trie:handle, const key[], any:output[], outputsize);
native bool:TrieDeleteKey(Trie:handle, const key[]);
native bool:TrieKeyExists(Trie:handle, const key[]);
native TrieDestroy(&Trie:handle);

View File

@@ -0,0 +1,44 @@
/* Core functions
*
* (c) Copyright 1998-2003, ITB CompuPhase
*
* This file is provided as is (no warranties).
*/
#if defined _core_included
#endinput
#endif
#define _core_included
native heapspace();
native funcidx(const name[]);
native numargs();
native getarg(arg, index=0);
native setarg(arg, index=0, value);
native strlen(const string[]);
native tolower(c);
native toupper(c);
native swapchars(c);
native random(max);
native min(value1, value2);
native max(value1, value2);
native clamp(value, min=cellmin, max=cellmax);
native power(value, exponent);
native sqroot(value);
native time(&hour=0,&minute=0,&second=0);
native date(&year=0,&month=0,&day=0);
native tickcount(&granularity=0);
stock abs(x)
{
return x > 0 ? x : -x;
}

View File

@@ -0,0 +1,61 @@
#if defined _csstats_included
#endinput
#endif
#define _csstats_included
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[8],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len,authid[] = "",authidlen = 0);
/* Returns number of all entries in stats. */
native get_statsnum();
/*
* new stats:
* 0 - total defusions
* 1 - bomb defused
* 2 - bomb plants
* 3 - bomb explosions
*/
native get_user_stats2(index,stats[4]);
native get_stats2(index,stats[4],authid[] = "",authidlen = 0);

View File

@@ -0,0 +1,355 @@
/* Counter-Strike functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _cstrike_included
#endinput
#endif
#define _cstrike_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib cstrike
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib cstrike
#endif
#else
#pragma library cstrike
#endif
/* Returns player deaths.
*/
native cs_get_user_deaths(index);
/* Sets player deaths.
*/
native cs_set_user_deaths(index, newdeaths);
/* Returns index of entity (does not have to be a player) which hostage is following. 0 is hostage doesn't follow anything.
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
*/
native cs_get_hostage_foll(index);
/* Set hostage to follow entity specified in followedindex. Does not have to be a player. If followedindex is 0 the hostage will stop following.
* Note: this native does not work on Condition Zero, which has a different hostage AI than CS.
*/
native cs_set_hostage_foll(index, followedindex = 0);
/* Get unique hostage id.
*/
native cs_get_hostage_id(index);
/* Get amount of ammo in backpack on a user for a specific weapon.
* Look in amxconst.inc for weapon types: CSW_*.
* Weapons on the same line uses the same ammo type:
* awm
* scout, ak, g3
* para
* famas, m4a1, aug, sg550, galil, sg552
* m3, xm
* usp, ump, mac
* fiveseven, p90
* deagle
* p228
* glock, mp5, tmp, elites
* flash
* he
* smoke
*/
native cs_get_user_bpammo(index, weapon);
/* Restock/remove ammo in a user's backpack.
*/
native cs_set_user_bpammo(index, weapon, amount);
/* Returns 1 if user has a defuse kit.
*/
native cs_get_user_defuse(index);
/* If defusekit is 1, the user will have a defuse kit.
* You can specify a different colour for the defuse kit icon showing on hud. Default is the normal green.
* You can specify an icon. Default is "defuser". Set flash to 1 if you want the icon to flash red.
*/
native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0);
/* Is user in buyzone? Returns 1 when true, 0 when false.
*/
native cs_get_user_buyzone(index);
/* Returns 1 when user has a primary weapon OR a shield in inventory, else 0.
*/
native cs_get_user_hasprim(index);
/* Get user model.
*/
native cs_get_user_model(index, model[], len);
/* Set user model.
*/
native cs_set_user_model(index, const model[]);
/* Use to reset model to standard selected model.
*/
native cs_reset_user_model(index);
/* Returns users money.
*/
native cs_get_user_money(index);
/* Gives money to user. If flash is 1, the difference between new and old amount will flash red or green.
*/
native cs_set_user_money(index, money, flash = 1);
/* Does user have night vision goggles?
*/
native cs_get_user_nvg(index);
/* Set nvgoggles to 1 to give night vision goggles to index. Set it to 0 to remove them.
*/
native cs_set_user_nvg(index, nvgoggles = 1);
/* Returns 1 if user has the "skill" to plant bomb, else 0. Normally this would only be true for a terrorist carrying a bomb.
*/
native cs_get_user_plant(index);
/* If plant is 1, a user will be set to be able to plant bomb within the usual bomb target areas if having one.
* You should use this if you give a player a weapon_c4, or he won't be able to plant it
* without dropping it and picking it up again (only possible for terrorists).
* If showbombicon is 1, the green C4 icon will be shown on user hud (if plant "skill" was enabled).
*/
native cs_set_user_plant(index, plant = 1, showbombicon = 1);
/* Set user team without killing player.
* If model is anything other than CS_DONTCHANGE, that will be set as player's model.
*/
enum CsInternalModel {
CS_DONTCHANGE = 0,
CS_CT_URBAN = 1,
CS_T_TERROR = 2,
CS_T_LEET = 3,
CS_T_ARCTIC = 4,
CS_CT_GSG9 = 5,
CS_CT_GIGN = 6,
CS_CT_SAS = 7,
CS_T_GUERILLA = 8,
CS_CT_VIP = 9,
CZ_T_MILITIA = 10,
CZ_CT_SPETSNAZ = 11
};
native cs_set_user_team(index, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE);
/* Get team directly from player's entity.
* 1 = terrorist
* 2 = counter-terrorist
* 3 = spectator
*/
enum CsTeams {
CS_TEAM_UNASSIGNED = 0,
CS_TEAM_T = 1,
CS_TEAM_CT = 2,
CS_TEAM_SPECTATOR = 3
};
native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE);
/* Is user vip? Returns 1 if true, 0 if false.
*/
native cs_get_user_vip(index);
/* If vip = 1, user is set to vip.
* If model = 1, then user's model will be changed to VIP model or random CT model if vip = 0.
* If scoreboard = 1, then scoreboard will be updated to show that user is VIP.
* This shouldn't be used for players on teams other than CT.
* NOTE: this is mostly useful for unsetting vips, so they can change teams and/or buy items properly.
* It does not alter game play; the one being VIP at start of round will retain internal status as VIP; terrorists
* can terminate him and accomplish their objective, etc.
*/
native cs_set_user_vip(index, vip = 1, model = 1, scoreboard = 1);
/* Returns 1 of specified user has tk:ed (team killed).
*/
native cs_get_user_tked(index);
/* Returns 1 of specified user has TKed (team killed).
* tk = 1: player has TKed
* tk = 0: player hasn't TKed
* Set subtract to how many frags to subtract. Set subtract to negative value to add frags.
*/
native cs_set_user_tked(index, tk = 1, subtract = 1);
/* Returns different values depending on if user is driving a vehicle - and if so at what speed.
* 0: no driving
* 1: driving, but standing still
* 2-4: driving, different positive speeds
* 5: driving, negative speed (backing)
* Note: these values were tested quickly, they may differ.
*/
native cs_get_user_driving(index);
/* Returns 1 if user has a shield, else 0.
*/
native cs_get_user_shield(index);
/* Returns 1 if user is using a stationary gun, else 0.
*/
native cs_get_user_stationary(index);
/* Returns armor value and sets by reference the armor type in second parameter.
*/
enum CsArmorType {
CS_ARMOR_NONE = 0, // no armor
CS_ARMOR_KEVLAR = 1, // armor
CS_ARMOR_VESTHELM = 2 // armor and helmet
};
native cs_get_user_armor(index, &CsArmorType:armortype);
/* Use this instead of fun's set_user_armor.
* Appropriate message to update client's HUD will be sent if armortype is kevlar or vesthelm.
*/
native cs_set_user_armor(index, armorvalue, CsArmorType:armortype);
/* Returns 1 if specified weapon is in burst mode.
*/
native cs_get_weapon_burst(index);
/* If burstmode = 1, weapon will be changed to burst mode, 0 and non-burst mode (semiautomatic/automatic) will be activated.
* Only GLOCK and FAMAS can enter/leave burst mode.
*/
native cs_set_weapon_burst(index, burstmode = 1);
/* Returns 1 if weapon is silenced, else 0.
*/
native cs_get_weapon_silen(index);
/* If silence = 1, weapon will be silenced, 0 and silencer will be removed. Only USP and M4A1 can be silenced.
*/
native cs_set_weapon_silen(index, silence = 1, draw_animation = 1);
/* Returns amount of ammo in weapon's clip.
*/
native cs_get_weapon_ammo(index);
/* Set amount of ammo in weapon's clip.
*/
native cs_set_weapon_ammo(index, newammo);
/* Get weapon type. Corresponds to CSW_* in amxconst.inc: 1 is CSW_P228, 2 is CSW_SCOUT and so on...
*/
native cs_get_weapon_id(index);
/* Returns 1 if no knives mode is enabled, else 0.
*/
native cs_get_no_knives();
/* Enabled no knives mode by calling this with value 1. Disabled with 0.
* No knives mode means that player will not be given a knife when spawning.
* You can still give knives (ie through fun's give_item).
*/
native cs_set_no_knives(noknives = 0);
/* Spawns a Counter-Strike player
*/
native cs_user_spawn(player);
/* Get what weapon type (CSW_*) an armoury_entity is.
*/
native cs_get_armoury_type(index);
/* Set an armoury_entity to be of specified type. You will have to set the appropriate model.
* The second argument, type, should be a CSW_* constant. Not all weapons are supported by Counter-strike.
* Supported weapons/items: CSW_MP5NAVY, CSW_TMP, CSW_P90, CSW_MAC10, CSW_AK47, CSW_SG552, CSW_M4A1, CSW_AUG, CSW_SCOUT
* CSW_G3SG1, CSW_AWP, CSW_M3, CSW_XM1014, CSW_M249, CSW_FLASHBANG, CSW_HEGRENADE, CSW_VEST, CSW_VESTHELM, CSW_SMOKEGRENADE
*/
native cs_set_armoury_type(index, type);
#define CS_MAPZONE_BUY (1<<0)
#define CS_MAPZONE_BOMBTARGET (1<<1)
#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2)
#define CS_MAPZONE_ESCAPE (1<<3)
#define CS_MAPZONE_VIP_SAFETY (1<<4)
/* Returns in bitwise form if the user is in a specific map zone.
* NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
*/
native cs_get_user_mapzones(index);
/* Zoom type enum. Used for get/set_user_zoom() natives.
*/
enum
{
CS_RESET_ZOOM = 0, // Reset any zoom blocking (when using this type, mode has no effect)
CS_SET_NO_ZOOM, // Disable any sort of zoom (ie: to disable zoom in all weapons use this with mode=0)
CS_SET_FIRST_ZOOM, // Set first zoom (awp style)
CS_SET_SECOND_ZOOM, // Set second zoom (awp style)
CS_SET_AUGSG552_ZOOM, // Set aug/sg552 zoom style
};
/* Sets a weapon zoom type on a player, any zoom type will work for all weapons, so you can even set an awp zoom to pistols :D
* The 2nd param has to be one of the above zoom types in the enum. Mode can only be 0 or 1.
* If mode=0 (blocking mode), the user will be forced to use the zoom type set by the native, and wont be able to change it (even by changing weapon)
* until the native resets the zoom with CS_RESET_ZOOM.
* If mode=1 the user will be able to restore back to a normal view by changing weapon.
*/
native cs_set_user_zoom(index, type, mode);
/* Returns how a user is zooming during the native call. Values correspond to the above enum, but will return 0 if an error occurred.
*/
native cs_get_user_zoom(index);
/* Returns the submodel setting of the player.
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
*/
native cs_get_user_submodel(index);
/* Sets the submodel setting of the player.
* If this is 1, then the user has a backpack or defuser on their model (depending on team)
* 0 removes it.
*/
native cs_set_user_submodel(index, value);
/* Gets or sets the user's last activity time. This is the time that CS's internal afk kicker
* checks to see who has been afk too long.
*/
native Float:cs_get_user_lastactivity(index);
native cs_set_user_lastactivity(index, Float:value);
/* Gets or sets the number of hostages that a user has killed.
*/
native cs_get_user_hostagekills(index);
native cs_set_user_hostagekills(index, value);
/* Gets or sets the time that the hostage was last used.
*/
native Float:cs_get_hostage_lastuse(index);
native cs_set_hostage_lastuse(index, Float:value);
/* Gets or sets the time which the hostage can next be used.
*/
native Float:cs_get_hostage_nextuse(index);
native cs_set_hostage_nextuse(index, Float:value);
/* Gets or sets the time in which the C4 will explode.
*/
native Float:cs_get_c4_explode_time(index);
native cs_set_c4_explode_time(index, Float:value);
/* Gets or sets whether the C4 is being defused.
*/
native bool:cs_get_c4_defusing(c4index);
native cs_set_c4_defusing(c4index, bool:defusing);
/**
* Called when CS internally fires a command to a player. It does this for a few
* functions, most notably rebuy/autobuy functionality. This is also used to pass
* commands to CZ bots internally.
*
* @param id Client index.
* @param cmd Command string.
* @return PLUGIN_HANDLED to block, PLUGIN_CONTINUE for normal operation.
*/
forward CS_InternalCommand(id, const cmd[]);

View File

@@ -0,0 +1,68 @@
/* CSX functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _csx_included
#endinput
#endif
#define _csx_included
#include <csstats>
#if AMXX_VERSION_NUM >= 175
#pragma reqclass xstats
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib xstats csx
#endif
#else
#pragma library csx
#endif
/*
* Forwards
*/
/* Function is called after player to player attacks ,
* if players were damaged by teammate TA is set to 1 */
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer,victim,wpnindex,hitplace,TK);
forward grenade_throw( index,greindex,wId );
forward bomb_planting(planter);
forward bomb_planted(planter);
forward bomb_explode(planter,defuser);
forward bomb_defusing(defuser);
forward bomb_defused(defuser);
/************* Shared Natives Start ********************************/
/* Custom Weapon Support */
/* function will return index of new weapon */
native custom_weapon_add( const wpnname[],melee = 0,const logname[]="" );
/* Function will pass damage done by this custom weapon to stats module and other plugins */
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
/* Function will pass info about custom weapon shot to stats module */
native custom_weapon_shot( weapon,index ); // weapon id , player id
/* function will return 1 if true */
native xmod_is_melee_wpn(wpnindex);
/* Returns weapon name. */
native xmod_get_wpnname(wpnindex,name[],len);
/* Returns weapon logname. */
native xmod_get_wpnlogname(wpnindex,name[],len);
/* Returns weapons array size */
native xmod_get_maxweapons();
/* Returns stats array size */
native xmod_get_stats_size();
/************* Shared Natives End ********************************/

View File

@@ -0,0 +1,145 @@
/* SQL Database API
* By the AMX Mod X Development Team
* Notes - Read the comments! Make sure your plugins use
* nice ANSI SQL and don't use database column names like "key"
* otherwise this API will be a nightmare
* Never do error checking with the not operator! This is bad:
* if (!dbi_query())
* You should do:
* ret = dbi_query()
* if (ret < 0)
* This is because DBI functions can and will return negative numbers
* Negative numbers evaluate to "true" in AMX.
*/
#if defined _dbi_included
#endinput
#endif
#define _dbi_included
// You can't include SQLX first!
// there's really no reason to anyway.
#assert !defined _sqlx_included
#if AMXX_VERSION_NUM >= 175
#pragma reqclass dbi
#else
#pragma library dbi
#endif
enum Sql
{
SQL_FAILED=0,
SQL_OK
};
enum Result
{
RESULT_FAILED=-1,
RESULT_NONE,
RESULT_OK
};
/* This will return a number equal to or below 0 on failure.
* If it does fail, the error will be mirrored in dbi_error()
* The return value will otherwise be a resource handle, not an
* OK code or cell pointer.
*/
native Sql:dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxlength=0);
/* This will do a simple query execution on the SQL server.
* If it fails, it will return a number BELOW ZERO (0)
* If zero, it succeeded with NO RETURN RESULT.
* If greater than zero, make sure to call dbi_free_result() on it!
* The return is a handle to the result set
*/
native Result:dbi_query(Sql:_sql, _query[], any:...);
/* Has the same usage as dbi_query, but this native returns by
* reference the number of rows affected in the query. If the
* query fails rows will be equal to -1.
*/
native Result:dbi_query2(Sql:_sql, &rows, _query[], any:...);
/* Returns 0 on failure or End of Results.
* Advances result pointer by one row.
*/
native dbi_nextrow(Result:_result);
/* Gets a field by number. Returns 0 on failure.
* Although internally fields always start from 0,
* This function takes fieldnum starting from 1.
* No extra params: returns int
* One extra param: returns Float: byref
* Two extra param: Stores string with length
*/
native dbi_field(Result:_result, _fieldnum, {Float,_}:... );
/* Gets a field by name. Returns 0 on failure.
* One extra param: returns Float: byref
* Two extra param: Stores string with length
*/
native dbi_result(Result:_result, _field[], {Float,_}:... );
/* Returns the number of rows returned from a query
*/
native dbi_num_rows(Result:_result);
/* Frees memory used by a result handle. Do this or get memory leaks.
*/
native dbi_free_result(&Result:result);
/* Closes a database handle. Internally, it will also
* mark the handle as free, so this particular handle may
* be re-used in the future to save time.
*/
native dbi_close(&Sql:_sql);
/* Returns an error message set. For PGSQL and MySQL,
* this is a direct error return from the database handle/API.
* For MSSQL, it returns the last error message found from a
* thrown exception.
*/
native dbi_error(Sql:_sql, _error[], _len);
/* Returns the type of database being used. So far:
* "mysql", "pgsql", "mssql", "sqlite"
*/
native dbi_type(_type[], _len);
/* Returns the number of fields/colums in a result set.
* Unlike dbi_nextrow, you must pass a valid result handle.
*/
native dbi_num_fields(Result:result);
/* Retrieves the name of a field/column in a result set.
* Requires a valid result handle, and columns are numbered 1 to n.
*/
native dbi_field_name(Result:result, field, name[], maxLength);
/* This function can be used to find out if a table in a Sqlite database exists.
*/
stock bool:sqlite_table_exists(Sql:sql, table[])
{
new bool:exists;
new query[128];
format(query, 127, "SELECT name FROM sqlite_master WHERE type='table' AND name='%s' LIMIT 1;", table);
new Result:result = dbi_query(sql, query);
if (dbi_nextrow(result))
{
exists = true;
}
else
{
exists = false;
}
if (result > RESULT_NONE)
{
dbi_free_result(result);
}
return exists;
}

View File

@@ -0,0 +1,135 @@
/* DoDX functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _dodconst_included
#endinput
#endif
#define _dodconst_included
/* DoD teams */
#define ALLIES 1
#define AXIS 2
#define FT_NEW 1<<0
#define FT_OLD 1<<1
#define STAMINA_SET 0
#define STAMINA_RESET 1
#define FUSE_SET 0
#define FUSE_RESET 1
#define DODMAX_WEAPONS 46 // 5 slots for custom weapons
// DoD Weapon Types
enum
{
DODWT_PRIMARY = 0,
DODWT_SECONDARY,
DODWT_MELEE,
DODWT_GRENADE,
DODWT_OTHER
};
// Ammo Channels
#define AMMO_SMG 1 // thompson, greasegun, sten, mp40
#define AMMO_ALTRIFLE 2 // carbine, k43, mg34
#define AMMO_RIFLE 3 // garand, enfield, scoped enfield, k98, scoped k98
#define AMMO_PISTOL 4 // colt, webley, luger
#define AMMO_SPRING 5 // springfield
#define AMMO_HEAVY 6 // bar, bren, stg44, fg42, scoped fg42
#define AMMO_MG42 7 // mg42
#define AMMO_30CAL 8 // 30cal
#define AMMO_GREN 9 // grenades (should be all 3 types)
#define AMMO_ROCKET 13 // bazooka, piat, panzerschreck
enum {
PS_NOPRONE =0,
PS_PRONE,
PS_PRONEDEPLOY,
PS_DEPLOY,
};
/* info types for dod_get_map_info native */
enum {
MI_ALLIES_TEAM = 0,
MI_ALLIES_PARAS,
MI_AXIS_PARAS,
};
/* DoD weapons */
enum {
DODW_AMERKNIFE = 1,
DODW_GERKNIFE,
DODW_COLT,
DODW_LUGER,
DODW_GARAND,
DODW_SCOPED_KAR,
DODW_THOMPSON,
DODW_STG44,
DODW_SPRINGFIELD,
DODW_KAR,
DODW_BAR,
DODW_MP40,
DODW_HANDGRENADE,
DODW_STICKGRENADE,
DODW_STICKGRENADE_EX,
DODW_HANDGRENADE_EX,
DODW_MG42,
DODW_30_CAL,
DODW_SPADE,
DODW_M1_CARBINE,
DODW_MG34,
DODW_GREASEGUN,
DODW_FG42,
DODW_K43,
DODW_ENFIELD,
DODW_STEN,
DODW_BREN,
DODW_WEBLEY,
DODW_BAZOOKA,
DODW_PANZERSCHRECK,
DODW_PIAT,
DODW_SCOPED_FG42,
DODW_FOLDING_CARBINE,
DODW_KAR_BAYONET,
DODW_SCOPED_ENFIELD,
DODW_MILLS_BOMB,
DODW_BRITKNIFE,
DODW_GARAND_BUTT,
DODW_ENFIELD_BAYONET,
DODW_MORTAR,
DODW_K43_BUTT,
};
/* DoD Classes */
enum {
DODC_GARAND = 1,
DODC_CARBINE,
DODC_THOMPSON,
DODC_GREASE,
DODC_SNIPER,
DODC_BAR,
DODC_30CAL,
DODC_BAZOOKA,
//DODC_ALLIES_MORTAR,
DODC_KAR = 10,
DODC_K43,
DODC_MP40,
DODC_MP44,
DODC_SCHARFSCHUTZE,
DODC_FG42,
DODC_SCOPED_FG42,
DODC_MG34,
DODC_MG42,
DODC_PANZERJAGER,
//DODC_AXIS_MORTAR,
DODC_ENFIELD = 21,
DODC_STEN,
DODC_MARKSMAN,
DODC_BREN,
DODC_PIAT,
//DODC_BRIT_MORTAR,
};

View File

@@ -0,0 +1,149 @@
/* DoDFun functions
*
* (c) 2004-2005, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _dodfun_included
#endinput
#endif
#define _dodfun_included
#include <dodconst>
#if AMXX_VERSION_NUM >= 175
#pragma reqlib dodfun
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib dodfun
#endif
#else
#pragma library dodfun
#endif
/* Function is called after grenade throw */
forward grenade_throw(index,greindex,wId);
/* Function is called after a rocket is shot */
forward rocket_shoot(index,rocketindex,wId);
/* Example: for full stamina use dod_player_stamina(1,STAMINA_SET,100,100) */
/* value is from 0 - 100 */
native dod_set_stamina(index,set=STAMINA_SET,minvalue=0,maxvalue=100);
/* Sets fuse for grenades. Valid number is from 0.1-20.0 */
/* types : new or preprimed */
native dod_set_fuse(index,set=FUSE_SET,Float:newFuse=5.0, Type=FT_NEW);
/* Sets player class */
native dod_set_user_class(index,classId);
/* Sets player team and random class. Don't work for spectators. */
native dod_set_user_team(index,teamId,refresh=1);
/* Returns next player class. Usefull is player is using random class */
native dod_get_next_class(index);
/* Returns 1 if player choose random class */
native dod_is_randomclass(index);
/* Returns player deaths */
native dod_get_pl_deaths(index);
/* Sets player deaths.
* Note if you opt to refresh the scoreboard, it
* will make the player appear as "DEAD" in the scoreboard.
*/
native dod_set_pl_deaths(index,value,refresh=1);
/* Returns player deaths. */
native dod_get_user_kills(index);
/* Sets player kills. */
native dod_set_user_kills(index,value,refresh=1);
/* Sets player score. */
native dod_set_user_score(index,value,refresh=1);
/* Sets new team name for this player */
native dod_set_pl_teamname(index,const szName[]);
/* Gets player team name */
native dod_get_pl_teamname(index,szName[],len);
/* Returns 1 is player weapon is deployed (bar,mg..) */
native dod_is_deployed(index);
/*Sets the ammo of the specified weapon entity id */
native dod_set_user_ammo(index,wid,value);
/*Gets the ammo of the specified weapon entity id */
native dod_get_user_ammo(index,wid);
/* called after first InitObj */
forward controlpoints_init();
enum CP_VALUE {
CP_edict = 1, // read only
CP_area, // read only
CP_index, // read only
CP_owner,
CP_default_owner,
CP_visible, // reinit after change
CP_icon_neutral, // reinit after change
CP_icon_allies, // reinit after change
CP_icon_axis, // reinit after change
CP_origin_x, // reinit after change
CP_origin_y, // reinit after change
CP_can_touch,
CP_pointvalue,
CP_points_for_cap,
CP_team_points,
CP_model_body_neutral,
CP_model_body_allies,
CP_model_body_axis,
// strings
CP_name,
CP_reset_capsound,
CP_allies_capsound,
CP_axis_capsound,
CP_targetname,
CP_model_neutral,
CP_model_allies,
CP_model_axis,
};
/* returns number of objectives */
native objectives_get_num();
/* use this function to update client(s) hud. You need to do this sometimes. Check CP_VALUE comments.
if player is 0 , all clients will get this message */
native objectives_reinit( player=0 );
/* use this function to get info about specified control point */
native objective_get_data( index, CP_VALUE:key, szValue[]="", len=0 );
/* use this function to change control point's data */
native objective_set_data( index, CP_VALUE:key , iValue=-1, const szValue[]="" );
enum CA_VALUE {
CA_edict = 1,
CA_allies_numcap,
CA_axis_numcap,
CA_timetocap,
CA_can_cap,
// strings
CA_target,
CA_sprite,
};
/* use this function to get info about specified control point's area */
native area_get_data( index, CA_VALUE:key, szValue[]="", len=0 );
/* use this function to change control point's area data */
native area_set_data( index, CA_VALUE:key , iValue=-1, const szValue[]="" );

View File

@@ -0,0 +1,62 @@
/* DoDX Stats functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _dodstats_included
#endinput
#endif
#define _dodstats_included
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* 7 - score
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[9],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[9],bodyhits[8]);
/* Gets life (from spawn to spawn) stats from given weapon index.*/
native get_user_wlstats(index,wpnindex,stats[9],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[9],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[9],bodyhits[8]);
/* Gets life (from spawn to spawn) stats of player. */
native get_user_lstats(index,stats[9],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[9],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[9],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[9],bodyhits[8],name[],len);
/* Returns number of all entries in stats. */
native get_statsnum();

View File

@@ -0,0 +1,158 @@
/* DoDX functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _dodx_included
#endinput
#endif
#define _dodx_included
#include <dodconst>
#include <dodstats>
#if AMXX_VERSION_NUM >= 175
#pragma reqclass xstats
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib xstats dodx
#endif
#else
#pragma library dodx
#endif
/************* Shared Natives Start ********************************/
/* Forward types */
enum {
XMF_DAMAGE = 0,
XMF_DEATH,
XMF_SCORE,
};
/* Use this function to register forwards */
native register_statsfwd(ftype);
/* Function is called after player to player attacks ,
* if players were damaged by teammate TA is set to 1 */
forward client_damage(attacker, victim, damage, wpnindex, hitplace, TA);
/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer, victim, wpnindex, hitplace, TK);
/* Function is called if player scored */
forward client_score(id, score, total);
/* This Forward is called when a player changes team */
forward dod_client_changeteam(id, team, oldteam);
/* This Forward is called if a player changes class, but just after spawn */
forward dod_client_changeclass(id, class, oldclass);
/* This Forward is called when a player spawns */
forward dod_client_spawn(id);
/* This will be called whenever a player scopes or unscopes
value = 1 scope up
value = 0 scope down */
forward dod_client_scope(id, value);
/* This will be called whenever a player drops a weapon
weapon is weapon dropped or picked up
value = 1 picked up
value = 0 dropped */
forward dod_client_weaponpickup(id, weapon, value);
/* Called whenever the the player goes to or comes from prone position
value = 1 going down
value = 0 getting up */
forward dod_client_prone(id, value);
/* This will be called whenever a player switches a weapon */
forward dod_client_weaponswitch(id, wpnew, wpnold);
/* Forward for when a grenade explodes and its location */
forward dod_grenade_explosion(id, pos[3], wpnid);
/* Forward for when a rocket explodes and its location */
forward dod_rocket_explosion(id, pos[3], wpnid);
/* Forward for when a player picks up a object */
forward dod_client_objectpickup(id, objid, pos[3], value);
/* Forward for when a users stamina decreases */
forward dod_client_stamina(id, stamina);
/* We want to get just the weapon of whichever type that the player is on him
Use DODWT_* in dodconst.inc for type */
native dod_weapon_type(id, type);
/* This native will change the position of a weapon within the users slots and its ammo ammount */
native dod_set_weaponlist(id, wpnID, slot, dropslot, totalrds);
/* Sets the model for a player */
native dod_set_model(id, const model[]);
/* Sets the model for a player */
native dod_set_body_number(id, bodynumber);
/* Un-Sets the model for a player */
native dod_clear_model(id);
/* Custom Weapon Support */
/* function will return index of new weapon */
native custom_weapon_add( const wpnname[], melee = 0, const logname[]="" );
/* Function will pass damage done by this custom weapon to stats module and other plugins */
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
/* Function will pass info about custom weapon shot to stats module */
native custom_weapon_shot( weapon, index ); // weapon id , player id
/* function will return 1 if true */
native xmod_is_melee_wpn(wpnindex);
/* Returns weapon name. */
native xmod_get_wpnname(wpnindex, name[], len);
/* Returns weapon logname. */
native xmod_get_wpnlogname(wpnindex, name[], len);
/* Returns weapons array size */
native xmod_get_maxweapons();
/* Returns stats array size ex. 8 in TS , 9 in DoD */
native xmod_get_stats_size();
/* Returns 1 if true */
native xmod_is_custom_wpn(wpnindex);
/************* Shared Natives End ********************************/
/* weapon logname to weapon name convertion */
native dod_wpnlog_to_name(const logname[],name[],len);
/* weapon logname to weapon index convertion */
native dod_wpnlog_to_id(const logname[]);
native dod_get_map_info( info );
/* Returns id of currently carried weapon. Gets also
* ammount of ammo in clip and backpack. */
native dod_get_user_weapon(index,&clip=0,&ammo=0);
/* Returns team score */
native dod_get_team_score(teamId);
/* Returns player class id */
native dod_get_user_class(index);
/* Returns player score */
native dod_get_user_score(index);
/* values are: 0-no prone, 1-prone, 2-prone + w_deploy */
native dod_get_pronestate(index);
/* It is not as safe as original but player deaths will not be increased */
native dod_user_kill(index);

View File

@@ -0,0 +1,241 @@
/* Engine functions
*
* by the AMX Mod X Development Team
* thanks to Vexd and mahnsawce
*
* This file is provided as is (no warranties).
*/
#if defined _engine_included
#endinput
#endif
#define _engine_included
#include <engine_const>
#if AMXX_VERSION_NUM >= 175
#pragma reqlib engine
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib engine
#endif
#else
#pragma library engine
#endif
native traceresult(type,any:...);
/* Registers a client impulse to a function. Function is passed the ID of the user. */
native register_impulse(impulse, const function[]);
/* Registers a touch action to a function by classnames. Use * to specify any classname. */
native register_touch(const Touched[], const Toucher[], const function[]);
/* Registers a think action to a function by classname. */
native register_think(const Classname[], const function[]);
/* NOTE: In old engine versions, this was not the case. Values are now WINDOWS values.
* You must pass with the windows offset (e.g. if 230 on windows, pass 230 no matter what)
* The module will automatically add +5 for Linux.
*/
/* Precaches an event. */
native precache_event(type, const Name[], any:...);
/* set/get a user's speak flags */
native set_speak(iIndex, iSpeakFlags);
native get_speak(iIndex);
/* Drops an entity to the floor (work?) */
native drop_to_floor(entity);
/* Get whole buffer containing keys and their data. */
native get_info_keybuffer(id, buffer[], length);
/* Use an entity with another entity. "entUsed" could be a hostage, "entUser" a player. */
native force_use(entUsed, entUser);
/* Get globals from server. */
native Float:get_global_float(variable);
native get_global_int(variable);
native get_global_string(variable, string[], maxlen);
native get_global_vector(variable, Float:vector[3]);
native get_global_edict(variable);
/* Set entity bounds. */
native entity_set_size(index, const Float:mins[3], const Float:maxs[3]);
/* Get decal index */
native get_decal_index(const szDecalName[]);
/* Returns the distance between two entities. */
native Float:entity_range(ida,idb);
/* Sets/gets things in an entities Entvars Struct. */
native entity_get_int(iIndex, iKey);
native entity_set_int(iIndex, iKey, iVal);
native Float:entity_get_float(iIndex, iKey);
native entity_set_float(iIndex, iKey, Float:iVal);
native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]);
native entity_get_edict(iIndex, iKey);
native entity_set_edict(iIndex, iKey, iNewIndex);
native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
native entity_set_string(iIndex, iKey, const szNewVal[]);
native entity_get_byte(iIndex, iKey);
native entity_set_byte(iIndex, iKey, iVal);
/* Creates an entity, will return the index of the created entity. ClassName must be valid. */
native create_entity(const szClassname[]);
/* Finds an entity in the world, will return 0 if nothing is found */
native find_ent_by_class(iIndex, const szClass[]);
//optionally you can set a jghg2 type
// 1: target, 2:targetname, 0:classname (default)
native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType=0);
native find_ent_by_target(iIndex, const szClass[]);
native find_ent_by_tname(iIndex, const szClass[]);
native find_ent_by_model(iIndex, const szClass[], const szModel[]);
native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius);
//this will CBaseEntity::Think() or something from the entity
native call_think(entity);
/* Is entity valid? */
native is_valid_ent(iIndex);
/* Proper origin setting, keeps updated with Half-Life engine. */
native entity_set_origin(iIndex, const Float:fNewOrigin[3]);
/* Sets the model of an Entity. */
native entity_set_model(iIndex, const szModel[]);
/* Remove an entity from the world. */
native remove_entity(iIndex);
/* Return current number of entities in the map */
native entity_count();
/* Simulate two entities colliding/touching. */
native fake_touch(entTouched, entToucher);
/* 2 formats.
Format: DispatchKeyValue("KeyName","Value") - sets keyvalues for the entity specified in the keyvalue() forward.
Format: DispatchKeyValue(index,"KeyName","Value") - Sets keyvalue for entity not specified in keyvalue() forward. */
#if !defined AMXMOD_BCOMPAT
native DispatchKeyValue(...);
#endif
native get_keyvalue(entity, const szKey[], value[], maxLength);
native copy_keyvalue(szClassName[],sizea,szKeyName[],sizeb,szValue[],sizec);
/* Runs the GameDLL's DispatchSpawn for an entity, I think it's used with DispatchKeyValue. */
native DispatchSpawn(iIndex);
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
#if !defined AMXMOD_BCOMPAT
native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
#endif
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
native point_contents(const Float:fCheckAt[3]);
/* Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
* and an entity index if an entity is hit. */
#if !defined AMXMOD_BCOMPAT
native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
#endif
/* Traces a hull. */
native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0);
/* Traces a line, and returns the normal to the plane hit in vReturn.
* Returns 0 if theres no normal. */
native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
/* Gets the ID of a grenade. */
native get_grenade_id(id, model[], len, grenadeid = 0);
/* Gets gpGlobals->time from Half-Life */
native Float:halflife_time();
/* Sets map lighting, #OFF to disable. */
native set_lights(const Lighting[]);
/* Sets Player's View to entity iTargetIndex. */
native attach_view(iIndex, iTargetIndex);
/* Sets Player's View Mode.
* rpgrocket.mdl must be precached in order for this function to work */
native set_view(iIndex, ViewType);
/* Direct copy of PLAYBACK_EVENT_FULL from Metamod/HLSDK. If you don't know how that works, you probably shouldn't be using it. */
native playback_event(flags,invoker,eventindex,Float:delay,const Float:origin[3],const Float:angles[3],Float:fparam1,Float:fparam2,iparam1,iparam2,bparam1,bparam2);
/* Gets parameters sent from CmdStart.
Note that you will receive modified values if any other plugin have
changed them. */
native get_usercmd(type,any:...);
/* Sets the parameters sent from CmdStart.
Note that your changes will be seen by any other plugin doing get_usercmd() */
native set_usercmd(type,any:...);
/* Converts a string offset into a real string. Some of the forwards in fakemeta
uses string offsets. (FM_CreateNamedEntity) */
native eng_get_string(_string, _returnString[], _len);
/* FORWARDS
**********/
/* Called when 2 entities touch.
* ptr - touched entity
* ptd - toucher entity
*/
forward pfn_touch(ptr, ptd);
/* Called once every server frame. May cause lag. */
forward server_frame();
/* Called when a client types kill in console. */
forward client_kill(id);
/* Forward for PreThink()/PostThink() on a player. */
forward client_PreThink(id);
forward client_PostThink(id);
/* Forward for impulses. */
forward client_impulse(id, impulse);
/* Called when an entity "thinks" (DispatchThink) */
forward pfn_think(entid);
/* Called when an event is played */
forward pfn_playbackevent(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
/* Called when an entity gets a keyvalue set on it from the engine (ie: map load) Use copy_keyvalue to get the keyvalue information */
forward pfn_keyvalue(entid);
/* Called when an entity is spawned */
forward pfn_spawn(entid);
//from jghg2
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
* certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
* If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
* in aroundent.
*/
native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0});
/* SDK function - checks if an origin is in an entity's view cone
* Set use3d to 1 to do the calculation in 3D. Otherwise it will be in 2D.
*/
native is_in_viewcone(entity, const Float:origin[3], use3d = 0);
//SDK function - checks if an entity is visible to an entity
native is_visible(entity, target);
//Added at twistedeuphoria's request, see funcwiki for details
native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);
#include <engine_stocks>

View File

@@ -0,0 +1,261 @@
/* Engine constants
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _engine_const_included
#endinput
#endif
#define _engine_const_included
#include <hlsdk_const>
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4
#define CAMERA_NONE 0
#define CAMERA_3RDPERSON 1
#define CAMERA_UPLEFT 2
#define CAMERA_TOPDOWN 3
/* Int */
enum {
EV_INT_gamestate = 0,
EV_INT_oldbuttons,
EV_INT_groupinfo,
EV_INT_iuser1,
EV_INT_iuser2,
EV_INT_iuser3,
EV_INT_iuser4,
EV_INT_weaponanim,
EV_INT_pushmsec,
EV_INT_bInDuck,
EV_INT_flTimeStepSound,
EV_INT_flSwimTime,
EV_INT_flDuckTime,
EV_INT_iStepLeft,
EV_INT_movetype,
EV_INT_solid,
EV_INT_skin,
EV_INT_body,
EV_INT_effects,
EV_INT_light_level,
EV_INT_sequence,
EV_INT_gaitsequence,
EV_INT_modelindex,
EV_INT_playerclass,
EV_INT_waterlevel,
EV_INT_watertype,
EV_INT_spawnflags,
EV_INT_flags,
EV_INT_colormap,
EV_INT_team,
EV_INT_fixangle,
EV_INT_weapons,
EV_INT_rendermode,
EV_INT_renderfx,
EV_INT_button,
EV_INT_impulse,
EV_INT_deadflag,
};
/* Float */
enum {
EV_FL_impacttime = 0,
EV_FL_starttime,
EV_FL_idealpitch,
EV_FL_pitch_speed,
EV_FL_ideal_yaw,
EV_FL_yaw_speed,
EV_FL_ltime,
EV_FL_nextthink,
EV_FL_gravity,
EV_FL_friction,
EV_FL_frame,
EV_FL_animtime,
EV_FL_framerate,
EV_FL_health,
EV_FL_frags,
EV_FL_takedamage,
EV_FL_max_health,
EV_FL_teleport_time,
EV_FL_armortype,
EV_FL_armorvalue,
EV_FL_dmg_take,
EV_FL_dmg_save,
EV_FL_dmg,
EV_FL_dmgtime,
EV_FL_speed,
EV_FL_air_finished,
EV_FL_pain_finished,
EV_FL_radsuit_finished,
EV_FL_scale,
EV_FL_renderamt,
EV_FL_maxspeed,
EV_FL_fov,
EV_FL_flFallVelocity,
EV_FL_fuser1,
EV_FL_fuser2,
EV_FL_fuser3,
EV_FL_fuser4,
};
/* Vector */
enum {
EV_VEC_origin = 0,
EV_VEC_oldorigin,
EV_VEC_velocity,
EV_VEC_basevelocity,
EV_VEC_clbasevelocity,
EV_VEC_movedir,
EV_VEC_angles,
EV_VEC_avelocity,
EV_VEC_punchangle,
EV_VEC_v_angle,
EV_VEC_endpos,
EV_VEC_startpos,
EV_VEC_absmin,
EV_VEC_absmax,
EV_VEC_mins,
EV_VEC_maxs,
EV_VEC_size,
EV_VEC_rendercolor,
EV_VEC_view_ofs,
EV_VEC_vuser1,
EV_VEC_vuser2,
EV_VEC_vuser3,
EV_VEC_vuser4,
};
/* Edict */
enum {
EV_ENT_chain = 0,
EV_ENT_dmg_inflictor,
EV_ENT_enemy,
EV_ENT_aiment,
EV_ENT_owner,
EV_ENT_groundentity,
EV_ENT_pContainingEntity,
EV_ENT_euser1,
EV_ENT_euser2,
EV_ENT_euser3,
EV_ENT_euser4,
};
/* String */
enum {
EV_SZ_classname = 0,
EV_SZ_globalname,
EV_SZ_model,
EV_SZ_target,
EV_SZ_targetname,
EV_SZ_netname,
EV_SZ_message,
EV_SZ_noise,
EV_SZ_noise1,
EV_SZ_noise2,
EV_SZ_noise3,
EV_SZ_viewmodel,
EV_SZ_weaponmodel,
};
/* Byte */
enum {
EV_BYTE_controller1 = 0,
EV_BYTE_controller2,
EV_BYTE_controller3,
EV_BYTE_controller4,
EV_BYTE_blending1,
EV_BYTE_blending2,
};
#if defined _jghg_enums
#endinput
#endif
#define _jghg_enums
enum {
// Edict
GL_trace_ent = 0,
// Float
GL_coop,
GL_deathmatch,
GL_force_retouch,
GL_found_secrets,
GL_frametime,
GL_serverflags,
GL_teamplay,
GL_time,
GL_trace_allsolid,
GL_trace_fraction,
GL_trace_inopen,
GL_trace_inwater,
GL_trace_plane_dist,
GL_trace_startsolid,
// Int
GL_cdAudioTrack,
GL_maxClients,
GL_maxEntities,
GL_msg_entity,
GL_trace_flags,
GL_trace_hitgroup,
// String
GL_pStringBase,
GL_mapname,
GL_startspot,
// Vector
GL_trace_endpos,
GL_trace_plane_normal,
GL_v_forward,
GL_v_right,
GL_v_up,
GL_vecLandmarkOffset,
// Void (not supported)
GL_pSaveData
};
enum
{
usercmd_float_start,
usercmd_forwardmove, // Float
usercmd_sidemove, // Float
usercmd_upmove, // Float
usercmd_float_end,
usercmd_int_start,
usercmd_lerp_msec, // short
usercmd_msec, // byte
usercmd_lightlevel, // byte
usercmd_buttons, // unsigned short
usercmd_impulse, // byte
usercmd_weaponselect, // byte
usercmd_impact_index, // int
usercmd_int_end,
usercmd_vec_start,
usercmd_viewangles, // Vector
usercmd_impact_position, // vec
usercmd_vec_end
};
// Used by the traceresult() native.
enum
{
TR_AllSolid, // (int) if true, plane is not valid
TR_StartSolid, // (int) if true, the initial point was in a solid area
TR_InOpen, // (int)
TR_InWater, // (int)
TR_Fraction, // (float) time completed, 1.0 = didn't hit anything
TR_EndPos, // (vector) final position
TR_PlaneDist, // (float)
TR_PlaneNormal, // (vector) surface normal at impact
TR_Hit, // (entity) entity the surface is on
TR_Hitgroup // (int) 0 == generic, non zero is specific body part
};

View File

@@ -0,0 +1,255 @@
/* Engine stocks
*
* by the AMX Mod X Development Team
* thanks to AssKicR, Freecode and T(+)rget
*
* This file is provided as is (no warranties).
*/
#if defined _engine_stocks_included
#endinput
#endif
#define _engine_stocks_included
#if !defined _amxmodx_included
#include <amxmodx>
#endif
#if !defined _engine_included
#include <engine>
#endif
stock fakedamage(idvictim,const szClassname[],Float:takedmgdamage,damagetype)
{
new entity = create_entity("trigger_hurt");
if (entity)
{
DispatchKeyValue(entity,"classname","trigger_hurt");
new szDamage[16];
// Takedamages only do half damage per attack (damage is damage per second, and it's triggered in 0.5 second intervals).
// Compensate for that.
format(szDamage,15,"%f",takedmgdamage * 2);
DispatchKeyValue(entity,"dmg",szDamage);
format(szDamage,15,"%i",damagetype);
DispatchKeyValue(entity,"damagetype",szDamage);
DispatchKeyValue(entity,"origin","8192 8192 8192");
DispatchSpawn(entity);
entity_set_string(entity, EV_SZ_classname, szClassname);
fake_touch(entity,idvictim);
remove_entity(entity);
return 1;
}
return 0;
}
//wrapper for find_ent_by_class
stock find_ent(iStart, const szClassname[])
{
return find_ent_by_class(iStart, szClassname);
}
/* Get the Button(s) user is pressing */
stock get_user_button(id)
{
return entity_get_int(id, EV_INT_button);
}
stock get_user_oldbutton(id)
{
return entity_get_int(id, EV_INT_oldbuttons);
}
/* Get flags an entity is flagged with */
stock get_entity_flags(ent)
{
return entity_get_int(ent, EV_INT_flags);
}
/* Get the distance between two entities */
stock get_entity_distance(ent1, ent2)
{
return floatround(entity_range(ent1, ent2));
}
/* Get grenade thrown by this user */
stock get_grenade(id)
{
new iGrenade = find_ent_by_class(-1, "grenade");
while(iGrenade > 0)
{
if(entity_get_edict(iGrenade, EV_ENT_owner) == id)
return iGrenade;
iGrenade = find_ent_by_class(iGrenade, "grenade");
}
return 0;
}
/* Get origin of a brush entity */
stock get_brush_entity_origin(ent, Float:orig[3])
{
new Float:Min[3], Float:Max[3];
entity_get_vector(ent, EV_VEC_origin, orig);
entity_get_vector(ent, EV_VEC_mins, Min);
entity_get_vector(ent, EV_VEC_maxs, Max);
orig[0] += (Min[0] + Max[0]) * 0.5;
orig[1] += (Min[1] + Max[1]) * 0.5;
orig[2] += (Min[2] + Max[2]) * 0.5;
return 1;
}
/* Remove entity by name */
stock remove_entity_name(const eName[])
{
new iEntity = find_ent_by_class(-1, eName);
while (iEntity > 0)
{
remove_entity(iEntity);
iEntity = find_ent_by_class(-1, eName);
}
return 1;
}
/* Get the contents of the point a user is aiming at */
stock ViewContents(id)
{
new origin[3], Float:Orig[3];
get_user_origin(id, origin, 3);
Orig[0] = float(origin[0]);
Orig[1] = float(origin[1]);
Orig[2] = float(origin[2]);
return point_contents(Orig);
}
stock get_speed(ent)
{
new Float:Vel[3];
entity_get_vector(ent, EV_VEC_velocity, Vel);
return floatround(vector_length(Vel));
}
/* Set rendering of an entity */
stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
{
entity_set_int(index,EV_INT_renderfx,fx);
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);
entity_set_vector(index,EV_VEC_rendercolor,RenderColor);
entity_set_int(index,EV_INT_rendermode,render);
entity_set_float(index,EV_FL_renderamt,float(amount));
return 1;
}
/* Set flags on an entity */
stock set_entity_flags(ent,flag,onoff)
{
if ((entity_get_int(ent,EV_INT_flags)&flag) > 0)
{
if (onoff == 1)
{
return 2;
}
else
{
entity_set_int(ent,EV_INT_flags,entity_get_int(ent,EV_INT_flags)-flag);
return 1;
}
}
else
{
if (onoff == 0)
{
return 2;
}
else
{
entity_set_int(ent,EV_INT_flags,entity_get_int(ent,EV_INT_flags)+flag);
return 1;
}
}
return 0;
}
/* If visible = 1, entity will be set to be visible, else invisible. */
stock set_entity_visibility(entity, visible = 1)
{
entity_set_int(entity, EV_INT_effects, visible == 1 ? entity_get_int(entity, EV_INT_effects) & ~EF_NODRAW : entity_get_int(entity, EV_INT_effects) | EF_NODRAW);
return 1;
}
/* Returns 1 if entity is visible. */
stock get_entity_visibility(entity)
{
return !(entity_get_int(entity, EV_INT_effects) & EF_NODRAW);
}
stock set_user_velocity(entity, const Float:vec[3])
{
return entity_set_vector(entity, EV_VEC_velocity, vec);
}
stock get_user_velocity(entity, Float:vec[3])
{
return entity_get_vector(entity, EV_VEC_velocity, vec);
}
/* Backwards compatible */
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
{
return radius_damage(fExplodeAt, iDamageMultiplier, iRadiusMultiplier);
}
/* Gives you a velocity in the direction a player is looking, iVelocity is the multiplier. */
stock VelocityByAim(iIndex,iVelocity, Float:vRetValue[3])
{
return velocity_by_aim(iIndex,iVelocity,vRetValue);
}
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
stock PointContents(const Float:fCheckAt[3])
{
return point_contents(fCheckAt);
}
stock set_size(index, const Float:mins[3], const Float:maxs[3])
{
return entity_set_size(index,mins,maxs);
}
//by Twilight Suzuka, request addition at29428
//"Lifted from HLSDK"
stock IsInWorld( ent )
{
new Float:origin[3];
entity_get_vector(ent,EV_VEC_origin,origin);
if (origin[0] >= 4096.0) return 0;
if (origin[1] >= 4096.0) return 0;
if (origin[2] >= 4096.0) return 0;
if (origin[0] <= -4096.0) return 0;
if (origin[1] <= -4096.0) return 0;
if (origin[2] <= -4096.0) return 0;
new Float:velocity[3];
entity_get_vector(ent,EV_VEC_velocity,velocity);
if (velocity[0] >= 2000) return 0;
if (velocity[1] >= 2000) return 0;
if (velocity[2] >= 2000) return 0;
if (velocity[0] <= -2000) return 0;
if (velocity[1] <= -2000) return 0;
if (velocity[2] <= -2000) return 0;
return 1;
}

View File

@@ -0,0 +1,70 @@
/***********************************************
[ Corona-Bytes.NET ] EvolutionX Core Plugin
(c) Corona - Bytes .NET coders :: coders@corona-bytes.net
> 2005 Corona Bytes :: http://www.corona-bytes.net
***********************************************/
#if defined __EVOLUTION_CORE__
#endinput
#endif
#define __EVOLUTION_CORE__
#pragma library EvolutionXCore
native setClientPL ( Client, PowerLevel );
native getClientPL ( Client );
native setClientACPL ( Client, ActualPowerLevel );
native getClientACPL ( Client );
native setClientADPL ( Client, AfterDeathPowerLevel );
native getClientADPL ( Client );
native setClientSPL ( Client, PowerLevel );
native setClientPLtoADPL ( Client );
native setClientKI ( Client, Ki );
native getClientKI ( Client );
native setClientHP ( Client, Health );
native getClientHP ( Client );
native setClientMHP ( Client, MaximumHealth );
native getClientMHP ( Client );
native setClientSPEED ( Client, Speed );
native getClientSPEED ( Client );
native setClientSWOOPSPEED ( Client, SwoopSpeed );
native getClientSWOOPSPEED ( Client );
native setClientPROTECT ( Client, bool:Enable = true );
native getClientPROTECT ( Client );
native setClientFROZEN ( Client, bool:Enable = true );
native getClientFROZEN ( Client );
native setClientGOD ( Client, bool:Enable = true );
native getClientGOD ( Client );
native getClientFLY ( Client );
native setClientHiddenTURBO ( Client, bool:Enable = true );
native getClientTURBO ( Client );
native getClientBLOCK ( Client );
native setClientHiddenPOWERUP ( Client, bool:Enable = true );
native getClientPOWERUP ( Client );
native getClientSWOOPING ( Client );
native getClientATKSHOOT ( Client );
native getClientATKCHARGE ( Client );
native getClientMELEE ( Client );
native getClientTHROWAWAY ( Client );
native getClientTHROW ( Client );
native getClientWALLGND ( Client );
native getClientINFREEFALL ( Client );
native getClientBEAMJUMP ( Client );
// kills a player without score/death msg
native silentClientKILL ( Client );

View File

@@ -0,0 +1,71 @@
/**
* (C)2004-2005 AMX Mod X Development Team
* based on the stocks and information provided by LynX
* organized and released by BAILOPAN
* This file is provided as is (no warranties).
*/
#if defined _esfconst_included
#endinput
#endif
#define _esfconst_included
enum
{
Character_Buu = 1,
Character_Goku = 2,
Character_Gohan = 3, //my favorite :)
Character_Krillin = 4,
Character_Frieza = 5,
Character_Piccolo = 6,
Character_Trunks = 7,
Character_Vegeta = 8,
Character_Cell = 9,
};
enum
{
Explosion_Blue = 0,
Explosion_Green,
Explosion_Orange,
Explosion_Purple,
Explosion_Yellow,
Explosion_Red,
Explosion_White,
Explosions_Total,
};
enum
{
Attack_Kamehameha=1,
Attack_SpiritBomb,
Attack_GalletGun,
Attack_FinalFlash,
Attack_Renzoku,
Attack_Kametorpedo,
Attack_GenericBeam,
Attack_Throw,
};
enum
{
Direction_Left=1,
Direction_Right,
Direction_Up,
Direction_Down,
Direction_Forward,
Direction_Backward,
};
enum
{
Recovery_Kicked=1,
Recovery_Tumbled,
Recovery_Lying,
Recovery_Thrown,
};
#define ESF_CHARGING 1
#define ESF_CONTROLLING 2
#define ESF_SHOOTING 3
#define ESF_SHOT 4

View File

@@ -0,0 +1,260 @@
/* FakeMeta functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _fakemeta_included
#endinput
#endif
#define _fakemeta_included
#include <fakemeta_const>
#if AMXX_VERSION_NUM >= 175
#pragma reqlib fakemeta
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib fakemeta
#endif
#else
#pragma library fakemeta
#endif
/**
* Returns entvar data from an entity. Use the pev_* enum (in fakemeta_const.inc) to specify which data you want retrieved.
*
* @note This function uses "read_data" style data syntax. It returns integer values,
* by-references float data, and sets a buffer for string data.
*
* @note If retrieving strings, you may optionally get a pointer into the global string table. Depending on
* your situation, there are two ways to do this.
* 1: This simply gets the pointer.
* new ptr = pev(entid, pev_classname)
* 2: The pointer will be stored in ptr AND the actual string is retrieved.
* new ptr, classname[32]
* pev(entid, pev_classname, ptr, classname, 31)
*
* @param _index The entity index to lookup.
* @param _value The pev field to lookup (look in fakemeta_const.inc)
*/
native pev(_index,_value,any:...);
/**
* Sets entvar data for an entity. Use the pev_* enum from fakemeta_const.inc for reference.
*
* @note Setting string data will automatically allocate a new string (via AllocString)
* If you have a string already allocated with your own call to AllocString, use
* set_pev_string_ptr instead.
*
* @param _index The entity index to set the value on.
* @param _value The pev field to set, (look in fakemeta_const.inc)
*/
native set_pev(_index,_value,any:...);
/**
* Use this native to set a pev field to a string that is already allocated (via a function such
* as EngFunc_AllocString).
*
* @note If you specify _value as anything other than string fields, an error will be thrown.
* @note Pass 0 as the _string field to set it to an empty string.
*
* @param _index The entity index to set the value on.
* @param _value The pev field to set - MUST be a string field.
* @param _string The string handle, retrieved from places like AllocString.
*/
native set_pev_string(_index, _value, _string);
/**
* Checks the validity of an entity.
*
* @param entindex The entity id to check.
*
* @return 0 on invalid entity
* 1 on entity is valid
* 2 on entity is valid and it has private data (safe to use pdata natives on).
*/
native pev_valid(entindex);
/**
* Returns the serial number for each entity. The serial number is a unique identity
* generated when an entity is created.
*
* @param entindex The entity id.
*
* @return The serial number for the entity.
*/
native pev_serial(entindex);
/* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
*
* When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
* in order to get different strings.
* Example:
* new model[128]
* new ptr = pev(id, pev_viewmodel)
* global_get(glb_pStringBase, ptr, model, 127)
*/
native global_get(_value, any:...);
/* Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
native get_pdata_int(_index,_Offset,_linuxdiff=5,_macdiff=5);
/* Sets an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
native set_pdata_int(_index,_Offset,_Value,_linuxdiff=5,_macdiff=5);
/* Returns a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
native Float:get_pdata_float(_index,_Offset,_linuxdiff=5,_macdiff=5);
/* Sets a float from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */
native set_pdata_float(_index,_Offset,Float:_Value,_linuxdiff=5,_macdiff=5);
/**
* Tries to retrieve an edict (entity encapsulation) pointer from an entity's private data.
*
* This function is byte-addressable. Unlike get_pdata_int() which searches in byte increments of 4,
* get_pdata_end searches in increments of 1.
*
* @param _index Entity index.
* @param _offset Offset to search.
* @param _linuxdiff Linux difference.
* @param _macdiff Mac OS X difference.
* @return -2 if an invalid entity was found.
* -1 if an empty entity was found.
* Otherwise, an entity index is returned.
*/
native get_pdata_ent(_index, _offset, _linuxdiff=20, _macdiff=20);
/* Registers a forward.
* Returns an id you can pass to unregister_forward
*/
native register_forward(_forwardType,const _function[],_post=0);
/* Unregisters a forward.
* The registerId must be from register_forward, and
* post/forwardtype must match what you registered the forward as.
*/
native unregister_forward(_forwardType, registerId, post=0);
/* Returns data for metamod */
native forward_return(type,any:...);
/* Returns the original return value of an engine function.
* This is only valid in forwards that were registered as post.
*
* get_orig_retval() - no params, retrieves integer return value
* get_orig_retval(&Float:value) - retrieves float return value by reference
* get_orig_retval(value[], len) - retrives string return value
*/
native get_orig_retval({Float,_}:...);
native engfunc(type,any:...);
native dllfunc(type,any:...);
//only use this with functions that pass a Trace
// get: zero extra params - return int, one extra param = byref float or vector
// set: use anything
native get_tr(TraceResult:tr_member, {Float,_}:...);
native set_tr(TraceResult:tr_member, {Float,_}:...);
//Upgraded version takes in a TraceResult handle, optionally passed in as the last parameter to the
//TraceResult forward. Use 0 to specify the global traceresult handle set from calling
// some of the Engfucs.
native get_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
native set_tr2(tr_handle, {TraceResult,_}:tr_member, {Float,_}:...);
/**
* Creates a traceresult handle. This value should never be altered.
* The handle can be used in get/set_tr2 and various traceresult engine functions.
*
* NOTE: You must call free_tr2() on every handle made with create_tr2().
*
* @return A new TraceResult handle.
*/
native create_tr2();
/**
* Frees a traceresult handle created with free_tr2(). Do not call
* this more than once per handle, or on handles not created through
* create_tr2().
*
* @param tr_handle TraceResult handle created via create_tr2().
* @noreturn
*/
native free_tr2(tr_handle);
//Same as above, use either a kvd_handle or 0 for global reserved kvd data
//kvd_handle is passed by the kvd hook, last param
native get_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
//Using set_kvd with the handle from the hook for anything under KV_fHandled
// is considered an undefined operation (it could crash). You should fire a new
// keyvalues structure rather than changing the internal engine strings.
native set_kvd(kvd_handle, KeyValueData:member, {Float,_}:...);
// These functions are used with the clientdata data structure (FM_UpdateClientData)
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector; 2 extra params - string and length
// Set: Use anything
// Use 0 for cd_handle to specify the global clientdata handle
native get_cd(cd_handle, ClientData:member, {Float,_}:...);
native set_cd(cd_handle, ClientData:member, {Float,_}:...);
// These functions are used with the entity_state data structure (FM_AddToFullPack)
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector or array
// Set: Use anything
// Use 0 for es_handle to specify the global entity_state handle
native get_es(es_handle, EntityState:member, {Float,_}:...);
native set_es(es_handle, EntityState:member, {Float,_}:...);
// These functions are used with the usercmd data structure (FM_CmdStart)
// Get: 0 extra params - Return integer; 1 extra param - by ref float or vector
// Set: Use anything
// Use 0 for uc_handle to specify the global usercmd handle
native get_uc(uc_handle, UserCmd:member, {Float,_}:...);
native set_uc(uc_handle, UserCmd:member, {Float,_}:...);
//NOTE that for the string offsets below, on AMD64, a byref (char **) offset is NOT the same as an int offset
//In fact it's QWORD aligned rather than DWORD aligned, so the offset will be exactly half.
//Gets a string from a private offset. If byref is false, the string is treated as static rather than dynamic.
//linux value is what to add to the offset for linux servers.
//mac value is what to add to the offset for os x servers. Default (cellmin) means that linux value will be used.
//this cannot use a default value due to older version using an awkward default value.
native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux, mac=cellmin);
//Sets a string in a private offset.
//realloc = -1 - nonbyref copy (static
//realloc = 0 - copy byref, no realloc *(char **)
//realloc = 1 - reallocate new string with free+malloc
//realloc = 2 - reallocate new string with delete[]+new[]
//linux value is what to add to the offset for linux servers.
//mac value iswhat to add to the offset for os x servers.
//this cannot use a default value due to older version using an awkward default value.
native set_pdata_string(entity, offset, const source[], realloc=2, linux, mac=cellmin);
// Copies the given infoBuffer pointer into out[]
// An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer
native copy_infokey_buffer(infoBuffer, out[], maxlen);
/**
* Looks up the sequence for the entity.
*
* @param entity The entity id to lookup.
* @param name The sequence name to lookup, case insensitive. ("JUMP" would match "jump")
* @param framerate The framerate of the sequence, if found.
* @param loops Whether or not the sequence loops.
* @param groundspeed The groundspeed setting of the sequence.
* @return -1 on failed lookup, the sequence number on successful lookup.
*/
native lookup_sequence(entity, const name[], &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
/**
* Sets a bone controller with the specified value.
*
* @param entity The entity id to set the value on.
* @param controller Which controller to set (0 through 3).
* @param value The value to set it to.
* @return The percentage that the controller is extended (0.0 through 1.0)
*/
native Float:set_controller(entity, controller, Float:value);

View File

@@ -0,0 +1,749 @@
/* FakeMeta constants
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _fakemeta_const_included
#endinput
#endif
#define _fakemeta_const_included
// For forward_return
#define FMV_STRING 1
#define FMV_FLOAT 2
#define FMV_CELL 3
#include <hlsdk_const>
/* The actual return value of the function, use these instead of PLUGIN_HANDLED etc when
* returning from registered forwards.
*/
#define FMRES_IGNORED 1 // Calls target function, returns normal value
#define FMRES_HANDLED 2 // Tells metamod you did something, still calls target function and returns normal value
#define FMRES_OVERRIDE 3 // Supposed to still call the target function but return your value instead
// however this does not work properly with metamod; use supercede instead.
#define FMRES_SUPERCEDE 4 // Block the target call, and use your return value (if applicable)
// Use this with GetInfoKeyBuffer if you want the server's localinfo buffer
#define FM_NULLENT -1
/* Used with engfunc()
*/
enum {
EngFunc_PrecacheModel, // int ) (char *s);
EngFunc_PrecacheSound, // int ) (char *s);
EngFunc_SetModel, // void ) (edict_t *e, const char *m);
EngFunc_ModelIndex, // int ) (const char *m);
EngFunc_ModelFrames, // int ) (int modelIndex);
EngFunc_SetSize, // void ) (edict_t *e, const float *rgflMin, const float *rgflMax);
EngFunc_ChangeLevel, // void ) (char* s1, char* s2);
EngFunc_VecToYaw, // float) (const float *rgflVector);
EngFunc_VecToAngles, // void ) (const float *rgflVectorIn, float *rgflVectorOut);
EngFunc_MoveToOrigin, // void ) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
EngFunc_ChangeYaw, // void ) (edict_t* ent);
EngFunc_ChangePitch, // void ) (edict_t* ent);
EngFunc_FindEntityByString, // edict) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
EngFunc_GetEntityIllum, // int ) (edict_t* pEnt);
EngFunc_FindEntityInSphere, // edict) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
EngFunc_FindClientInPVS, // edict) (edict_t *pEdict);
EngFunc_EntitiesInPVS, // edict) (edict_t *pplayer);
EngFunc_MakeVectors, // void ) (const float *rgflVector);
EngFunc_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up);
EngFunc_CreateEntity, // edict) (void);
EngFunc_RemoveEntity, // void ) (edict_t *e);
EngFunc_CreateNamedEntity, // edict) (int className);
EngFunc_MakeStatic, // void ) (edict_t *ent);
EngFunc_EntIsOnFloor, // int ) (edict_t *e);
EngFunc_DropToFloor, // int ) (edict_t *e);
EngFunc_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
EngFunc_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin);
EngFunc_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
//With 1.71 you can pass an optional TraceLine ptr for trace natives
// it can be 0, for meaning "global tr handle" (for get/set_tr2), or
// it can be any other TR handle (such as one from a TR hook)
EngFunc_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceToss, // void ) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
EngFunc_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
EngFunc_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 );
EngFunc_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_GetAimVector, // void ) (edict_t *ent, float speed, float *rgflReturn);
EngFunc_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count);
EngFunc_LightStyle, // void ) (int style, char *val);
EngFunc_DecalIndex, // int ) (const char *name);
EngFunc_PointContents, // int ) (const float *rgflVector);
EngFunc_FreeEntPrivateData, // void ) (edict_t *pEdict);
EngFunc_SzFromIndex, // const char *) (int iString);
EngFunc_AllocString, // int ) (const char *szValue);
EngFunc_RegUserMsg, // int ) (const char *pszName, int iSize);
EngFunc_AnimationAutomove, // void ) (const edict_t *pEdict, float flTime);
EngFunc_GetBonePosition, // void ) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
EngFunc_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles);
EngFunc_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent);
EngFunc_Time, // float) ( void );
EngFunc_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw);
EngFunc_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
EngFunc_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed);
EngFunc_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created
EngFunc_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
EngFunc_NumberOfEntities, // int ) ( void );
EngFunc_StaticDecal, // void ) (const float *origin, int decalIndex, int entityIndex, int modelIndex);
EngFunc_PrecacheGeneric, // int ) (char* s);
EngFunc_BuildSoundMsg, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
EngFunc_GetPhysicsKeyValue, // const char *) (const edict_t *pClient, const char *key);
EngFunc_SetPhysicsKeyValue, // void ) (const edict_t *pClient, const char *key, const char *value);
EngFunc_GetPhysicsInfoString, // const char *) (const edict_t *pClient);
EngFunc_PrecacheEvent, // unsigned short) (int type, const char*psz);
EngFunc_PlaybackEvent, // void ) (int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
EngFunc_CheckVisibility, // int ) (const edict_t *entity, unsigned char *pset);
EngFunc_GetCurrentPlayer, // int ) ( void );
EngFunc_CanSkipPlayer, // int ) (const edict_t *player);
EngFunc_SetGroupMask, // void ) (int mask, int op);
EngFunc_GetClientListening, // bool ) (int iReceiver, int iSender)
EngFunc_SetClientListening, // bool ) (int iReceiver, int iSender, bool Listen)
EngFunc_MessageBegin, // void ) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
EngFunc_WriteCoord, // void ) (float flValue)
EngFunc_WriteAngle, // void ) (float flValue)
EngFunc_InfoKeyValue, // char*) (char *infobuffer, char *key);
EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
EngFunc_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value);
EngFunc_CreateInstBaseline, // int ) (int classname, struct entity_state_s *baseline);
// Returns pointer to info buffer that can be used with the infobuffer param of InfoKeyValue, SetKeyValue, and SetClientKeyValue
EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e);
EngFunc_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...);
EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ServerPrint // void ) (const char *szMsg);
};
/* Used with dllfunc()
*/
enum
{
DLLFunc_GameInit, // void ) ( void );
DLLFunc_Spawn, // int ) (edict_t *pent);
DLLFunc_Think, // void ) (edict_t *pent);
DLLFunc_Use, // void ) (edict_t *pentUsed, edict_t *pentOther);
DLLFunc_Touch, // void ) (edict_t *pentTouched, edict_t *pentOther);
DLLFunc_Blocked, // void ) (edict_t *pentBlocked, edict_t *pentOther);
//You can pass in 0 for glb kvd handle or a kvd handle here
DLLFunc_KeyValue, // void ) (edict_t *pentKeyvalue, KeyValueData *pkvd);
DLLFunc_SetAbsBox, // void ) (edict_t *pent);
DLLFunc_ClientConnect, // bool ) (edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
DLLFunc_ClientDisconnect, // void ) (edict_t *pEntity);
DLLFunc_ClientKill, // void ) (edict_t *pEntity);
DLLFunc_ClientPutInServer, // void ) (edict_t *pEntity);
DLLFunc_ClientCommand, // void ) (edict_t *pEntity);
DLLFunc_ServerDeactivate, // void ) ( void );
DLLFunc_PlayerPreThink, // void ) (edict_t *pEntity);
DLLFunc_PlayerPostThink, // void ) (edict_t *pEntity);
DLLFunc_StartFrame, // void ) ( void );
DLLFunc_ParmsNewLevel, // void ) ( void );
DLLFunc_ParmsChangeLevel, // void ) ( void );
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
// This also gets called when the server is queried for information (for example, by a server browser tool)
DLLFunc_GetGameDescription, // const char *) ( void );
// Spectator funcs
DLLFunc_SpectatorConnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorDisconnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorThink, // void ) (edict_t *pEntity);
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
DLLFunc_Sys_Error, // void ) (const char *error_string);
DLLFunc_PM_FindTextureType, // char ) (char *name);
DLLFunc_RegisterEncoders, // void ) ( void );
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
DLLFunc_GetHullBounds, // int ) (int hullnumber, float *mins, float *maxs);
// Create baselines for certain "unplaced" items.
DLLFunc_CreateInstBaselines, // void ) ( void );
DLLFunc_pfnAllowLagCompensation, // int ) ( void );
// I know this does not fit with DLLFUNC(), but I don't want another native just for it.
MetaFunc_CallGameEntity, // bool ) (plid_t plid, const char *entStr,entvars_t *pev);
DLLFunc_ClientUserInfoChanged, // void ) (edict *pEntity, char *infobuffer);
// You can pass in 0 for global cd handle or another cd handle here
DLLFunc_UpdateClientData, // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
// You can pass in 0 for global entity state handle or another entity state handle here
DLLFunc_AddToFullPack, // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
// You can pass in 0 for global usercmd handle or another usercmd handle here
DLLFunc_CmdStart, // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
DLLFunc_CmdEnd, // void ) (const edict_t *player);
DLLFunc_CreateBaseline // void ) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
};
enum {
pev_string_start = 0,
pev_classname,
pev_globalname,
pev_model,
pev_target,
pev_targetname,
pev_netname,
pev_message,
pev_noise,
pev_noise1,
pev_noise2,
pev_noise3,
pev_string_end,
pev_edict_start,
pev_chain,
pev_dmg_inflictor,
pev_enemy,
pev_aiment,
pev_owner,
pev_groundentity,
pev_euser1,
pev_euser2,
pev_euser3,
pev_euser4,
pev_edict_end,
pev_float_start,
pev_impacttime,
pev_starttime,
pev_idealpitch,
pev_ideal_yaw,
pev_pitch_speed,
pev_yaw_speed,
pev_ltime,
pev_nextthink,
pev_gravity,
pev_friction,
pev_frame,
pev_animtime,
pev_framerate,
pev_scale,
pev_renderamt,
pev_health,
pev_frags,
pev_takedamage,
pev_max_health,
pev_teleport_time,
pev_armortype,
pev_armorvalue,
pev_dmg_take,
pev_dmg_save,
pev_dmg,
pev_dmgtime,
pev_speed,
pev_air_finished,
pev_pain_finished,
pev_radsuit_finished,
pev_maxspeed,
pev_fov,
pev_flFallVelocity,
pev_fuser1,
pev_fuser2,
pev_fuser3,
pev_fuser4,
pev_float_end,
pev_int_start,
pev_fixangle,
pev_modelindex,
pev_viewmodel,
pev_weaponmodel,
pev_movetype,
pev_solid,
pev_skin,
pev_body,
pev_effects,
pev_light_level,
pev_sequence,
pev_gaitsequence,
pev_rendermode,
pev_renderfx,
pev_weapons,
pev_deadflag,
pev_button,
pev_impulse,
pev_spawnflags,
pev_flags,
pev_colormap,
pev_team,
pev_waterlevel,
pev_watertype,
pev_playerclass,
pev_weaponanim,
pev_pushmsec,
pev_bInDuck,
pev_flTimeStepSound,
pev_flSwimTime,
pev_flDuckTime,
pev_iStepLeft,
pev_gamestate,
pev_oldbuttons,
pev_groupinfo,
pev_iuser1,
pev_iuser2,
pev_iuser3,
pev_iuser4,
pev_int_end,
pev_byte_start,
pev_controller_0,
pev_controller_1,
pev_controller_2,
pev_controller_3,
pev_blending_0,
pev_blending_1,
pev_byte_end,
pev_bytearray_start,
pev_controller,
pev_blending,
pev_bytearray_end,
pev_vecarray_start,
pev_origin,
pev_oldorigin,
pev_velocity,
pev_basevelocity,
pev_clbasevelocity,
pev_movedir,
pev_angles,
pev_avelocity,
pev_v_angle,
pev_endpos,
pev_startpos,
pev_absmin,
pev_absmax,
pev_mins,
pev_maxs,
pev_size,
pev_rendercolor,
pev_view_ofs,
pev_vuser1,
pev_vuser2,
pev_vuser3,
pev_vuser4,
pev_punchangle,
pev_vecarray_end,
pev_string2_begin, /* anything after here are string corrections */
pev_weaponmodel2,
pev_viewmodel2,
pev_string2_end,
pev_edict2_start, /* edict corrections */
pev_pContainingEntity,
pev_absolute_end
};
/* Used with global_get()
*/
enum
{
glb_start_int = 0,
glb_trace_hitgroup,
glb_trace_flags,
glb_msg_entity,
glb_cdAudioTrack,
glb_maxClients,
glb_maxEntities,
glb_end_int,
glb_start_float,
glb_time,
glb_frametime,
glb_force_retouch,
glb_deathmatch,
glb_coop,
glb_teamplay,
glb_serverflags,
glb_found_secrets,
glb_trace_allsolid,
glb_trace_startsolid,
glb_trace_fraction,
glb_trace_plane_dist,
glb_trace_inopen,
glb_trace_inwater,
glb_end_float,
glb_start_edict,
glb_trace_ent,
glb_end_edict,
glb_start_vector,
glb_v_forward,
glb_v_up,
glb_v_right,
glb_trace_endpos,
glb_trace_plane_normal,
glb_vecLandmarkOffset,
glb_end_vector,
glb_start_string,
glb_mapname,
glb_startspot,
glb_end_string,
glb_start_pchar,
glb_pStringBase,
glb_end_pchar
};
/* Used with register_forward()
*/
enum {
FM_PrecacheModel = 1,
FM_PrecacheSound,
FM_SetModel,
FM_ModelIndex,
FM_ModelFrames,
FM_SetSize,
FM_ChangeLevel,
FM_VecToYaw,
FM_VecToAngles,
FM_MoveToOrigin,
FM_ChangeYaw,
FM_ChangePitch,
FM_FindEntityByString,
FM_GetEntityIllum,
FM_FindEntityInSphere,
FM_FindClientInPVS,
FM_EntitiesInPVS,
FM_MakeVectors,
FM_AngleVectors,
FM_CreateEntity,
FM_RemoveEntity,
FM_CreateNamedEntity,
FM_MakeStatic,
FM_EntIsOnFloor,
FM_DropToFloor,
FM_WalkMove,
FM_SetOrigin,
FM_EmitSound,
FM_EmitAmbientSound,
FM_TraceLine,
FM_TraceToss,
FM_TraceMonsterHull,
FM_TraceHull,
FM_TraceModel,
FM_TraceTexture,
FM_TraceSphere,
FM_GetAimVector,
FM_ParticleEffect,
FM_LightStyle,
FM_DecalIndex,
FM_PointContents,
FM_MessageBegin,
FM_MessageEnd,
FM_WriteByte,
FM_WriteChar,
FM_WriteShort,
FM_WriteLong,
FM_WriteAngle,
FM_WriteCoord,
FM_WriteString,
FM_WriteEntity,
FM_CVarGetFloat,
FM_CVarGetString,
FM_CVarSetFloat,
FM_CVarSetString,
FM_FreeEntPrivateData,
FM_SzFromIndex,
FM_AllocString,
FM_RegUserMsg,
FM_AnimationAutomove,
FM_GetBonePosition,
FM_GetAttachment,
FM_SetView,
FM_Time,
FM_CrosshairAngle,
FM_FadeClientVolume,
FM_SetClientMaxspeed,
FM_CreateFakeClient,
FM_RunPlayerMove,
FM_NumberOfEntities,
FM_StaticDecal,
FM_PrecacheGeneric,
FM_BuildSoundMsg,
FM_GetPhysicsKeyValue,
FM_SetPhysicsKeyValue,
FM_GetPhysicsInfoString,
FM_PrecacheEvent,
FM_PlaybackEvent,
FM_CheckVisibility,
FM_GetCurrentPlayer,
FM_CanSkipPlayer,
FM_SetGroupMask,
FM_Voice_GetClientListening,
FM_Voice_SetClientListening,
FM_InfoKeyValue,
FM_SetKeyValue,
FM_SetClientKeyValue,
FM_GetPlayerAuthId,
FM_GetPlayerWONId,
FM_IsMapValid,
FM_Spawn,
FM_Think,
FM_Use,
FM_Touch,
FM_Blocked,
FM_KeyValue,
FM_SetAbsBox,
FM_ClientConnect,
FM_ClientDisconnect,
FM_ClientKill,
FM_ClientPutInServer,
FM_ClientCommand,
FM_ServerDeactivate,
FM_PlayerPreThink,
FM_PlayerPostThink,
FM_StartFrame,
FM_ParmsNewLevel,
FM_ParmsChangeLevel,
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
// This also gets called when the server is queried for information (for example, by a server browser tool)
FM_GetGameDescription,
// Spectator funcs
FM_SpectatorConnect,
FM_SpectatorDisconnect,
FM_SpectatorThink,
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
FM_Sys_Error,
FM_PM_FindTextureType,
FM_RegisterEncoders,
// Create baselines for certain "unplaced" items.
FM_CreateInstBaselines,
FM_AllowLagCompensation,
FM_AlertMessage,
// NEW_DLL_FUNCTIONS:
FM_OnFreeEntPrivateData,
FM_GameShutdown,
FM_ShouldCollide,
// LATE ADDITIONS (v1.71)
FM_ClientUserInfoChanged,
// LATE ADDITIONS (v1.75)
FM_UpdateClientData,
FM_AddToFullPack,
FM_CmdStart,
FM_CmdEnd,
FM_CreateInstBaseline,
FM_CreateBaseline,
FM_GetInfoKeyBuffer,
FM_ClientPrintf,
// LATE ADDITIONS (v1.80)
FM_ServerPrint
};
enum TraceResult
{
TR_AllSolid, // int
TR_StartSolid, // int
TR_InOpen, // int
TR_InWater, // int
TR_flFraction, // float
TR_vecEndPos, // float array[3]
TR_flPlaneDist, // float
TR_vecPlaneNormal, // float array[3]
TR_pHit, // int (edict_t*)
TR_iHitgroup, // int
};
enum KeyValueData
{
KV_ClassName, // string
KV_KeyName, // string
KV_Value, // string
KV_fHandled // int
};
enum ClientData
{
CD_Origin, // float array[3]
CD_Velocity, // float array[3]
CD_ViewModel, // int
CD_PunchAngle, // float array[3]
CD_Flags, // int
CD_WaterLevel, // int
CD_WaterType, // int
CD_ViewOfs, // float array[3]
CD_Health, // float
CD_bInDuck, // int
CD_Weapons, // int
CD_flTimeStepSound, // int
CD_flDuckTime, // int
CD_flSwimTime, // int
CD_WaterJumpTime, // int
CD_MaxSpeed, // float
CD_FOV, // float
CD_WeaponAnim, // int
CD_ID, // int
CD_AmmoShells, // int
CD_AmmoNails, // int
CD_AmmoCells, // int
CD_AmmoRockets, // int
CD_flNextAttack, // float
CD_tfState, // int
CD_PushMsec, // int
CD_DeadFlag, // int
CD_PhysInfo, // string[256]
CD_iUser1, // int
CD_iUser2, // int
CD_iUser3, // int
CD_iUser4, // int
CD_fUser1, // float
CD_fUser2, // float
CD_fUser3, // float
CD_fUser4, // float
CD_vUser1, // float array[3]
CD_vUser2, // float array[3]
CD_vUser3, // float array[3]
CD_vUser4 // float array[3]
};
enum EntityState
{
// Fields which are filled in by routines outside of delta compression
ES_EntityType, // int
// Index into cl_entities array for this entity
ES_Number, // int
ES_MsgTime, // float
// Message number last time the player/entity state was updated
ES_MessageNum, // int
// Fields which can be transitted and reconstructed over the network stream
ES_Origin, // float array[3]
ES_Angles, // float array[3]
ES_ModelIndex, // int
ES_Sequence, // int
ES_Frame, // float
ES_ColorMap, // int
ES_Skin, // short
ES_Solid, // short
ES_Effects, // int
ES_Scale, // float
ES_eFlags, // byte
// Render information
ES_RenderMode, // int
ES_RenderAmt, // int
ES_RenderColor, // byte array[3], RGB value
ES_RenderFx, // int
ES_MoveType, // int
ES_AnimTime, // float
ES_FrameRate, // float
ES_Body, // int
ES_Controller, // byte array[4]
ES_Blending, // byte array[4]
ES_Velocity, // float array[3]
// Send bbox down to client for use during prediction
ES_Mins, // float array[3]
ES_Maxs, // float array[3]
ES_AimEnt, // int
// If owned by a player, the index of that player (for projectiles)
ES_Owner, // int
// Friction, for prediction
ES_Friction, // float
// Gravity multiplier
ES_Gravity, // float
// PLAYER SPECIFIC
ES_Team, // int
ES_PlayerClass, // int
ES_Health, // int
ES_Spectator, // bool
ES_WeaponModel, // int
ES_GaitSequence, // int
// If standing on conveyor, e.g.
ES_BaseVelocity, // float array[3]
// Use the crouched hull, or the regular player hull
ES_UseHull, // int
// Latched buttons last time state updated
ES_OldButtons, // int
// -1 = in air, else pmove entity number
ES_OnGround, // int
ES_iStepLeft, // int
// How fast we are falling
ES_flFallVelocity, // float
ES_FOV, // float
ES_WeaponAnim, // int
// Parametric movement overrides
ES_StartPos, // float array[3]
ES_EndPos, // float array[3]
ES_ImpactTime, // float
ES_StartTime, // float
// For mods
ES_iUser1, // int
ES_iUser2, // int
ES_iUser3, // int
ES_iUser4, // int
ES_fUser1, // float
ES_fUser2, // float
ES_fUser3, // float
ES_fUser4, // float
ES_vUser1, // float array[3]
ES_vUser2, // float array[3]
ES_vUser3, // float array[3]
ES_vUser4 // float array[3]
};
enum UserCmd
{
// Interpolation time on client
UC_LerpMsec, // short
// Duration in ms of command
UC_Msec, // byte
// Command view angles
UC_ViewAngles, // float array[3]
// Intended velocities
// Forward velocity
UC_ForwardMove, // float
// Sideways velocity
UC_SideMove, // float
// Upward velocity
UC_UpMove, // float
// Light level at spot where we are standing
UC_LightLevel, // byte
// Attack buttons
UC_Buttons, // unsigned short
// Impulse command issued
UC_Impulse, // byte
// Current weapon id
UC_WeaponSelect, // byte
// Experimental player impact stuff
UC_ImpactIndex, // int
UC_ImpactPosition // float array[3]
};
enum AlertType
{
at_notice = 0,
at_console, // same as at_notice, but forces a ConPrintf, not a message box
at_aiconsole, // same as at_console, but only shown if developer level is 2!
at_warning,
at_error,
at_logged // Server print to console (only in multiplayer games)
};

View File

@@ -0,0 +1,275 @@
/* FakeMeta stocks
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if !defined _fakemeta_included
#include <fakemeta>
#endif
#if defined _fakemeta_stocks_included
#endinput
#endif
#define _fakemeta_stocks_included
// EngFuncs
stock EF_PrecacheModel(const string[])
return engfunc(EngFunc_PrecacheModel, string);
stock EF_PrecacheSound(const string[])
return engfunc(EngFunc_PrecacheSound, string);
stock EF_SetModel(const ID, const STRING[])
return engfunc(EngFunc_SetModel, ID, STRING);
stock EF_ModelIndex(const STRING[])
return engfunc(EngFunc_ModelIndex, STRING);
stock EF_ModelFrames(modelIndex)
return engfunc(EngFunc_ModelFrames, modelIndex);
stock EF_SetSize(const ENTITY, const Float:MIN[3], const Float:MAX[3])
return engfunc(EngFunc_SetSize, ENTITY, MIN, MAX);
stock EF_ChangeLevel(const S1[], const S2[])
return engfunc(EngFunc_ChangeLevel, S1, S2);
stock EF_VecToYaw(const Float:VECTOR[3], &Float:returnValue)
return engfunc(EngFunc_VecToYaw, VECTOR, returnValue);
stock EF_VecToAngles(const Float:VECTORIN[3], const Float:VECTOROUT[3])
return engfunc(EngFunc_VecToAngles, VECTORIN, VECTOROUT);
stock EF_MoveToOrigin(const ENTITY, const Float:GOAL[3], const Float:DISTANCE, const MOVETYPE)
return engfunc(EngFunc_MoveToOrigin, ENTITY, GOAL, DISTANCE, MOVETYPE);
stock EF_ChangeYaw(const ENTITY)
return engfunc(EngFunc_ChangeYaw, ENTITY);
stock EF_ChangePitch(const ENTITY)
return engfunc(EngFunc_ChangePitch, ENTITY);
stock EF_FindEntityByString(const STARTSEARCHAFTER, const FIELD[], const VALUE[])
return engfunc(EngFunc_FindEntityByString, STARTSEARCHAFTER, FIELD, VALUE);
stock EF_GetEntityIllum(const ENTITY)
return engfunc(EngFunc_GetEntityIllum, ENTITY);
stock EF_FindEntityInSphere(const STARTSEARCHAFTER, const Float:ORIGIN[3], Float:radius)
return engfunc(EngFunc_FindEntityInSphere, STARTSEARCHAFTER, ORIGIN, radius);
stock EF_FindClientInPVS(const CLIENT)
return engfunc(EngFunc_FindClientInPVS, CLIENT);
stock EF_EntitiesInPVS(const CLIENT)
return engfunc(EngFunc_EntitiesInPVS, CLIENT);
stock EF_MakeVectors(const Float:VECTOR[3])
return engfunc(EngFunc_MakeVectors, VECTOR);
stock EF_AngleVectors(const Float:VECTOR[3], Float:forward_[3], Float:right[3], Float:up[3])
return engfunc(EngFunc_AngleVectors, VECTOR, forward_, right, up);
stock EF_CreateEntity()
return engfunc(EngFunc_CreateEntity);
stock EF_RemoveEntity(const ENTITY)
return engfunc(EngFunc_RemoveEntity, ENTITY);
stock EF_CreateNamedEntity(const CLASSNAME)
return engfunc(EngFunc_CreateNamedEntity, CLASSNAME);
stock EF_MakeStatic(const ENTITY)
return engfunc(EngFunc_MakeStatic, ENTITY);
stock EF_EntIsOnFloor(const ENTITY)
return engfunc(EngFunc_EntIsOnFloor, ENTITY);
stock EF_DropToFloor(const ENTITY)
return engfunc(EngFunc_DropToFloor, ENTITY);
stock EF_WalkMove(const ENTITY, Float:yaw, Float:distance, iMode)
return engfunc(EngFunc_WalkMove, ENTITY, yaw, distance, iMode);
stock EF_SetOrigin(const ENTITY, const Float:ORIGIN[3])
return engfunc(EngFunc_SetOrigin, ENTITY, ORIGIN);
stock EF_EmitSound(const ENTITY, channel, const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch)
return engfunc(EngFunc_EmitSound, ENTITY, channel, SAMPLE, volume, attenuation, fFlags, pitch);
stock EF_EmitAmbientSound(const ENTITY, Float:pos[3], const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch)
return engfunc(EngFunc_EmitAmbientSound, ENTITY, pos, SAMPLE, volume, attenuation, fFlags, pitch);
stock EF_TraceLine(const Float:V1[3], const Float:V2[3], fNoMonsters, const ENT_TO_SKIP)
return engfunc(EngFunc_TraceLine, V1, V2, fNoMonsters, ENT_TO_SKIP);
stock EF_TraceToss(const ENTITY, const ENTITY_TO_IGNORE)
return engfunc(EngFunc_TraceToss, ENTITY, ENTITY_TO_IGNORE);
stock EF_TraceMonsterHull(const ENTITY, const Float:V1[3], const Float:V2[3], fNoMonsters, const ENTITY_TO_SKIP)
return engfunc(EngFunc_TraceMonsterHull, ENTITY, V1, V2, fNoMonsters, ENTITY_TO_SKIP);
stock EF_TraceHull(const Float:V1[3], const Float:V2[3], fNoMonsters, hullNumber, const ENTITY_TO_SKIP)
return engfunc(EngFunc_TraceHull, V1, V2, fNoMonsters, hullNumber, ENTITY_TO_SKIP);
stock EF_TraceModel(const Float:V1[3], const Float:V2[3], hullNumber, const ENTITY)
return engfunc(EngFunc_TraceModel, V1, V2, hullNumber, ENTITY);
stock EF_TraceTexture(const TEXTURE_ENTITY, const Float:V1[3], const Float:V2[3])
return engfunc(EngFunc_TraceTexture, TEXTURE_ENTITY, V1, V2);
stock EF_TraceSphere(const Float:V1[3], const Float:V2[3], fNoMonsters, Float:radius, const ENTITY_TO_SKIP)
return engfunc(EngFunc_TraceSphere, V1, V2, fNoMonsters, radius, ENTITY_TO_SKIP);
stock EF_GetAimVector(const ENTITY, Float:speed, Float:returnVector[3])
return engfunc(EngFunc_GetAimVector, ENTITY, speed, returnVector);
stock EF_ParticleEffect(const Float:ORIGIN[3], const Float:DIRECTION[3], Float:color, Float:count)
return engfunc(EngFunc_ParticleEffect, ORIGIN, DIRECTION, color, count);
stock EF_LightStyle(style, val[])
return engfunc(EngFunc_LightStyle, style, val);
stock EF_DecalIndex(const NAME[])
return engfunc(EngFunc_DecalIndex, NAME);
stock EF_PointContents(const Float:VECTOR[3])
return engfunc(EngFunc_PointContents, VECTOR);
stock EF_FreeEntPrivateData(const ENTITY)
return engfunc(EngFunc_FreeEntPrivateData, ENTITY);
stock EF_SzFromIndex(iString)
return engfunc(EngFunc_SzFromIndex, iString);
stock EF_AllocString(const STRING[])
return engfunc(EngFunc_AllocString, STRING);
stock EF_RegUserMsg(const NAME[], iSize)
return engfunc(EngFunc_RegUserMsg, NAME, iSize);
stock EF_AnimationAutomove(const ENTITY, Float:flTime)
return engfunc(EngFunc_AnimationAutomove, ENTITY, flTime);
stock EF_GetBonePosition(const ENTITY, iBone, Float:origin[3], Float:angles[3])
return engfunc(EngFunc_GetBonePosition, ENTITY, iBone, origin, angles);
stock EF_GetAttachment(const ENTITY, iAttachment, Float:origin[3], Float:angles[3])
return engfunc(EngFunc_GetAttachment, ENTITY, iAttachment, origin, angles);
stock EF_SetView(const CLIENT, const VIEW_ENTITY)
return engfunc(EngFunc_SetView, CLIENT, VIEW_ENTITY);
stock EF_Time(&Float:returnValue)
return engfunc(EngFunc_Time, returnValue);
stock EF_CrosshairAngle(const CLIENT, Float:pitch, Float:yaw)
return engfunc(EngFunc_CrosshairAngle, CLIENT, pitch, yaw);
stock EF_FadeClientVolume(const ENTITY, fadePercent, fadeOutSeconds, holdTime, fadeInSeconds)
return engfunc(EngFunc_FadeClientVolume, ENTITY, fadePercent, fadeOutSeconds, holdTime, fadeInSeconds);
stock EF_SetClientMaxspeed(const ENTITY, Float:newMaxspeed)
return engfunc(EngFunc_SetClientMaxspeed, ENTITY, newMaxspeed);
stock EF_CreateFakeClient(const NETNAME[])
return engfunc(EngFunc_CreateFakeClient, NETNAME);
stock EF_RunPlayerMove(const FAKECLIENT, const Float:VIEWANGLES[3], Float:forwardmove, Float:sidemove, Float:upmove, buttons, impulse, msec)
return engfunc(EngFunc_RunPlayerMove, FAKECLIENT, VIEWANGLES, forwardmove, sidemove, upmove, buttons, impulse, msec);
stock EF_NumberOfEntities()
return engfunc(EngFunc_NumberOfEntities);
stock EF_StaticDecal(const Float:ORIGIN[3], decalIndex, entityIndex, modelIndex)
return engfunc(EngFunc_StaticDecal, ORIGIN, decalIndex, entityIndex, modelIndex);
stock EF_PrecacheGeneric(const STRING[])
return engfunc(EngFunc_PrecacheGeneric, STRING);
stock EF_BuildSoundMSG(const ENTITY, channel, const SAMPLE[], Float:volume, Float:attenuation, fFlags, pitch, msg_dest, msg_type, const Float:ORIGIN[3], const ED)
return engfunc(EngFunc_BuildSoundMsg, ENTITY, channel, SAMPLE, volume, attenuation, fFlags, pitch, msg_dest, msg_type, ORIGIN, ED);
stock EF_GetPhysicsKeyValue(const CLIENT, const KEY[])
return engfunc(EngFunc_GetPhysicsKeyValue, CLIENT, KEY);
stock EF_SetPhysicsKeyValue(const CLIENT, const KEY[], const VALUE[])
return engfunc(EngFunc_SetPhysicsKeyValue, CLIENT, KEY, VALUE);
stock EF_GetPhysicsInfoString(const CLIENT, returnString[], maxLength)
return engfunc(EngFunc_GetPhysicsInfoString, CLIENT, returnString, maxLength);
stock EF_PrecacheEvent(type, const STRING[])
return engfunc(EngFunc_PrecacheEvent, type, STRING);
stock EF_PlaybackEvent(flags, const INVOKER, eventindex, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2)
return engfunc(EngFunc_PlaybackEvent, flags, INVOKER, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);
stock EF_CheckVisibility(const ENTITY, set)
return engfunc(EngFunc_CheckVisibility, ENTITY, set);
stock EF_GetCurrentPlayer()
return engfunc(EngFunc_GetCurrentPlayer);
stock EF_CanSkipPlayer(const PLAYER)
return engfunc(EngFunc_CanSkipPlayer, PLAYER);
stock EF_SetGroupMask(mask, op)
return engfunc(EngFunc_SetGroupMask, mask, op);
stock EF_GetClientListening(receiver, sender)
return engfunc(EngFunc_GetClientListening, receiver, sender);
stock EF_SetClientListening(receiver, sender, bool:listen)
return engfunc(EngFunc_SetClientListening, receiver, sender, listen);
stock EF_MessageBegin(msg_dest, msg_type, const Float:ORIGIN[3], const ED)
return engfunc(EngFunc_MessageBegin, msg_dest, msg_type, ORIGIN, ED);
stock EF_WriteCoord(Float:value)
return engfunc(EngFunc_WriteCoord, value);
stock EF_WriteAngle(Float:value)
return engfunc(EngFunc_WriteAngle, value);
stock EF_InfoKeyValue(const INFOBUFFER, const KEY[], returnValue[], maxLength)
return engfunc(EngFunc_InfoKeyValue, INFOBUFFER, KEY, returnValue, maxLength);
stock EF_SetKeyValue(const INFOBUFFER, const KEY[], const VALUE[])
return engfunc(EngFunc_SetKeyValue, INFOBUFFER, KEY, VALUE);
stock EF_SetClientKeyValue(const ID, const INFOBUFFER, const KEY[], const VALUE[])
return engfunc(EngFunc_SetClientKeyValue, ID, INFOBUFFER, KEY, VALUE);
stock EF_CreateInstBaseline(CLASSNAME, baseline)
return engfunc(EngFunc_CreateInstBaseline, CLASSNAME, baseline);
// Returns pointer to info buffer that can be used with the INFOBUFFER param
// of EF_InfoKeyValue, EF_SetKeyValue, and EF_SetClientKeyValue
stock EF_GetInfoKeyBuffer(const ENTITY)
return engfunc(EngFunc_GetInfoKeyBuffer, ENTITY);
stock EF_ClientPrintf(const ENTITY, const printType, const MESSAGE[])
return engfunc(EngFunc_ClientPrintf, ENTITY, printType, MESSAGE);
stock EF_ServerPrint(const MESSAGE[])
return engfunc(EngFunc_ServerPrint, MESSAGE);
// DLLFuncs
stock DF_GameInit()
return dllfunc(DLLFunc_GameInit);
stock DF_Spawn(const ENTITY)
return dllfunc(DLLFunc_Spawn, ENTITY);
stock DF_Think(const ENTITY)
return dllfunc(DLLFunc_Think, ENTITY);
stock DF_Use(const ENT_Used, const ENT_User)
return dllfunc(DLLFunc_Use, ENT_Used, ENT_User);
stock DF_Touch(const ENT_Touched, const ENT_Toucher)
return dllfunc(DLLFunc_Touch, ENT_Touched, ENT_Toucher);
stock DF_Blocked(const ENT_Blocked, const ENT_Other)
return dllfunc(DLLFunc_Blocked, ENT_Blocked, ENT_Other);
stock DF_SetAbsBox(const ENTITY)
return dllfunc(DLLFunc_SetAbsBox, ENTITY);
stock DF_ClientConnect(const ENTITY, const NAME[], const ADDRESS[], RejectReason[128])
return dllfunc(DLLFunc_ClientConnect, ENTITY, NAME, ADDRESS, RejectReason);
stock DF_ClientDisconnect(const ENTITY)
return dllfunc(DLLFunc_ClientDisconnect, ENTITY);
stock DF_ClientKill(const ENTITY)
return dllfunc(DLLFunc_ClientKill, ENTITY);
stock DF_ClientPutInServer(const ENTITY)
return dllfunc(DLLFunc_ClientPutInServer, ENTITY);
stock DF_ClientCommand(const ENTITY)
return dllfunc(DLLFunc_ClientCommand, ENTITY);
stock DF_ServerDeactivate()
return dllfunc(DLLFunc_ServerDeactivate);
stock DF_PlayerPreThink(const ENTITY)
return dllfunc(DLLFunc_PlayerPreThink, ENTITY);
stock DF_PlayerPostThink(const ENTITY)
return dllfunc(DLLFunc_PlayerPostThink, ENTITY);
stock DF_StartFrame()
return dllfunc(DLLFunc_StartFrame);
stock DF_ParmsNewLevel()
return dllfunc(DLLFunc_ParmsNewLevel);
stock DF_ParmsChangeLevel()
return dllfunc(DLLFunc_ParmsChangeLevel);
stock DF_GetGameDescription()
return dllfunc(DLLFunc_GetGameDescription);
stock DF_SpectatorConnect(const ENTITY)
return dllfunc(DLLFunc_SpectatorConnect, ENTITY);
stock DF_SpectatorDisconnect(const ENTITY)
return dllfunc(DLLFunc_SpectatorDisconnect, ENTITY);
stock DF_SpectatorThink(const ENTITY)
return dllfunc(DLLFunc_SpectatorThink, ENTITY);
stock DF_Sys_Error(const ERROR_STRING[])
return dllfunc(DLLFunc_Sys_Error, ERROR_STRING);
stock DF_PM_FindTextureType(name[])
return dllfunc(DLLFunc_PM_FindTextureType, name);
stock DF_RegisterEncoders()
return dllfunc(DLLFunc_RegisterEncoders);
stock DF_GetHullBounds(hullnumber, Float:mins[3], Float:maxs[3])
return dllfunc(DLLFunc_GetHullBounds, hullnumber, mins, maxs);
stock DF_CreateInstBaselines()
return dllfunc(DLLFunc_CreateInstBaselines);
stock DF_pfnAllowLagCompensation()
return dllfunc(DLLFunc_pfnAllowLagCompensation);
stock DF_MetaFunc_CallGameEntity(const STRING[], const ENTITY)
return dllfunc(MetaFunc_CallGameEntity, STRING, ENTITY);
stock DF_ClientUserInfoChanged(const IDPLAYER)
return dllfunc(DLLFunc_ClientUserInfoChanged, IDPLAYER);
stock DF_UpdateClientData(const ENTITY, sendweapons, const cd/* = 0*/)
return dllfunc(DLLFunc_UpdateClientData, ENTITY, sendweapons, cd);
stock DF_AddToFullPack(const STATE/* = 0*/, e, ENT, HOST, hostflags, player, set)
return dllfunc(DLLFunc_AddToFullPack, STATE, e, ENT, HOST, hostflags, player, set);
stock DF_CmdStart(const PLAYER, const CMD/* = 0*/, randomSeed)
return dllfunc(DLLFunc_CmdStart, PLAYER, CMD, randomSeed);
stock DF_CmdEnd(const PLAYER)
return dllfunc(DLLFunc_CmdEnd, PLAYER);
stock DF_CreateBaseline(PLAYER, eIndex, baseline, playerModelIndex, Float:playerMins[3], Float:playerMaxs[3])
return dllfunc(DLLFunc_CreateBaseline, PLAYER, eIndex, baseline, playerModelIndex, playerMins, playerMaxs);

View File

@@ -0,0 +1,882 @@
/**
* This file provides various utility functions that use the Fakemeta module.
* This file is created and maintained by VEN.
* For support and issues, see:
* http://forums.alliedmods.net/showthread.php?t=28284
*/
/* Fakemeta Utilities
*
* by VEN
*
* This file is provided as is (no warranties).
*/
#if !defined _fakemeta_included
#include <fakemeta>
#endif
#if defined _fakemeta_util_included
#endinput
#endif
#define _fakemeta_util_included
#include <xs>
/* Engine functions */
#define fm_precache_generic(%1) engfunc(EngFunc_PrecacheGeneric, %1)
/* stock fm_precache_generic(const file[])
return engfunc(EngFunc_PrecacheGeneric, file) */
#define fm_precache_event(%1,%2) engfunc(EngFunc_PrecacheEvent, %1, %2)
/* stock fm_precache_event(type, const name[])
return engfunc(EngFunc_PrecacheEvent, type, name) */
// ported by v3x
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor, %1)
/* stock fm_drop_to_floor(entity)
return engfunc(EngFunc_DropToFloor, entity) */
#define fm_force_use(%1,%2) dllfunc(DLLFunc_Use, %2, %1)
/* stock fm_force_use(user, used)
return dllfunc(DLLFunc_Use, used, user) */
#define fm_entity_set_size(%1,%2,%3) engfunc(EngFunc_SetSize, %1, %2, %3)
/* stock fm_entity_set_size(index, const Float:mins[3], const Float:maxs[3])
return engfunc(EngFunc_SetSize, index, mins, maxs) */
#define fm_get_decal_index(%1) engfunc(EngFunc_DecalIndex, %1)
/* stock fm_get_decal_index(const decalname[])
return engfunc(EngFunc_DecalIndex, decalname) */
stock Float:fm_entity_range(ent1, ent2) {
new Float:origin1[3], Float:origin2[3];
pev(ent1, pev_origin, origin1);
pev(ent2, pev_origin, origin2);
return get_distance_f(origin1, origin2);
}
// based on KoST's port, upgraded version fits into the macros
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
/* stock fm_create_entity(const classname[])
return engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname)) */
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
/* stock fm_find_ent_by_class(index, const classname[])
return engfunc(EngFunc_FindEntityByString, index, "classname", classname) */
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
new strtype[11] = "classname", ent = index;
switch (jghgtype) {
case 1: strtype = "target";
case 2: strtype = "targetname";
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent;
}
#define fm_find_ent_by_target(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "target", %2)
/* stock fm_find_ent_by_target(index, const target[])
return engfunc(EngFunc_FindEntityByString, index, "target", target) */
#define fm_find_ent_by_tname(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "targetname", %2)
/* stock fm_find_ent_by_tname(index, const targetname[])
return engfunc(EngFunc_FindEntityByString, index, "targetname", targetname) */
stock fm_find_ent_by_model(index, const classname[], const model[]) {
new ent = index, mdl[72];
while ((ent = fm_find_ent_by_class(ent, classname))) {
pev(ent, pev_model, mdl, sizeof mdl - 1);
if (equal(mdl, model))
return ent;
}
return 0;
}
#define fm_find_ent_in_sphere(%1,%2,%3) engfunc(EngFunc_FindEntityInSphere, %1, %2, %3)
/* stock fm_find_ent_in_sphere(index, const Float:origin[3], Float:radius)
return engfunc(EngFunc_FindEntityInSphere, index, origin, radius) */
#define fm_call_think(%1) dllfunc(DLLFunc_Think, %1)
/* stock fm_call_think(entity)
return dllfunc(DLLFunc_Think, entity) */
#define fm_is_valid_ent(%1) pev_valid(%1)
/* stock fm_is_valid_ent(index)
return pev_valid(index) */
stock fm_entity_set_origin(index, const Float:origin[3]) {
new Float:mins[3], Float:maxs[3];
pev(index, pev_mins, mins);
pev(index, pev_maxs, maxs);
engfunc(EngFunc_SetSize, index, mins, maxs);
return engfunc(EngFunc_SetOrigin, index, origin);
}
#define fm_entity_set_model(%1,%2) engfunc(EngFunc_SetModel, %1, %2)
/* stock fm_entity_set_model(index, const model[])
return engfunc(EngFunc_SetModel, index, model) */
// ported by v3x
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
/* stock fm_remove_entity(index)
return engfunc(EngFunc_RemoveEntity, index) */
#define fm_entity_count() engfunc(EngFunc_NumberOfEntities)
/* stock fm_entity_count()
return engfunc(EngFunc_NumberOfEntities) */
#define fm_fake_touch(%1,%2) dllfunc(DLLFunc_Touch, %1, %2)
/* stock fm_fake_touch(toucher, touched)
return dllfunc(DLLFunc_Touch, toucher, touched) */
#define fm_DispatchSpawn(%1) dllfunc(DLLFunc_Spawn, %1)
/* stock fm_DispatchSpawn(entity)
return dllfunc(DLLFunc_Spawn, entity) */
// ported by v3x
#define fm_point_contents(%1) engfunc(EngFunc_PointContents, %1)
/* stock fm_point_contents(const Float:point[3])
return engfunc(EngFunc_PointContents, point) */
stock fm_trace_line(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
engfunc(EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0);
new ent = get_tr2(0, TR_pHit);
get_tr2(0, TR_vecEndPos, ret);
return pev_valid(ent) ? ent : 0;
}
stock fm_trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0) {
new result = 0;
engfunc(EngFunc_TraceHull, origin, origin, ignoremonsters, hull, ignoredent > 0 ? ignoredent : 0, 0);
if (get_tr2(0, TR_StartSolid))
result += 1;
if (get_tr2(0, TR_AllSolid))
result += 2;
if (!get_tr2(0, TR_InOpen))
result += 4;
return result;
}
stock fm_trace_normal(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
engfunc(EngFunc_TraceLine, start, end, 0, ignoreent, 0);
get_tr2(0, TR_vecPlaneNormal, ret);
new Float:fraction;
get_tr2(0, TR_flFraction, fraction);
if (fraction >= 1.0)
return 0;
return 1;
}
// note that for CS planted C4 has a "grenade" classname as well
stock fm_get_grenade_id(id, model[], len, grenadeid = 0) {
new ent = fm_find_ent_by_owner(grenadeid, "grenade", id);
if (ent && len > 0)
pev(ent, pev_model, model, len);
return ent;
}
#define fm_halflife_time() get_gametime()
/* stock Float:fm_halflife_time()
return get_gametime() */
#define fm_attach_view(%1,%2) engfunc(EngFunc_SetView, %1, %2)
/* stock fm_attach_view(index, entity)
return engfunc(EngFunc_SetView, index, entity) */
stock fm_playback_event(flags, invoker, eventindex, Float:delay, const Float:origin[3], const Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2) {
return engfunc(EngFunc_PlaybackEvent, flags, invoker, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2);
}
#define fm_eng_get_string(%1,%2,%3) engfunc(EngFunc_SzFromIndex, %1, %2, %3)
/* stock fm_eng_get_string(istring, string[], len)
return engfunc(EngFunc_SzFromIndex, istring, string, len) */
/* HLSDK functions */
// the dot product is performed in 2d, making the view cone infinitely tall
stock bool:fm_is_in_viewcone(index, const Float:point[3]) {
new Float:angles[3];
pev(index, pev_angles, angles);
engfunc(EngFunc_MakeVectors, angles);
global_get(glb_v_forward, angles);
angles[2] = 0.0;
new Float:origin[3], Float:diff[3], Float:norm[3];
pev(index, pev_origin, origin);
xs_vec_sub(point, origin, diff);
diff[2] = 0.0;
xs_vec_normalize(diff, norm);
new Float:dot, Float:fov;
dot = xs_vec_dot(norm, angles);
pev(index, pev_fov, fov);
if (dot >= floatcos(fov * M_PI / 360))
return true;
return false;
}
stock bool:fm_is_visible(index, const Float:point[3], ignoremonsters = 0) {
new Float:start[3], Float:view_ofs[3];
pev(index, pev_origin, start);
pev(index, pev_view_ofs, view_ofs);
xs_vec_add(start, view_ofs, start);
engfunc(EngFunc_TraceLine, start, point, ignoremonsters, index, 0);
new Float:fraction;
get_tr2(0, TR_flFraction, fraction);
if (fraction == 1.0)
return true;
return false;
}
/* Engine_stocks functions */
stock fm_fakedamage(victim, const classname[], Float:takedmgdamage, damagetype) {
new class[] = "trigger_hurt";
new entity = fm_create_entity(class);
if (!entity)
return 0;
new value[16];
float_to_str(takedmgdamage * 2, value, sizeof value - 1);
fm_set_kvd(entity, "dmg", value, class);
num_to_str(damagetype, value, sizeof value - 1);
fm_set_kvd(entity, "damagetype", value, class);
fm_set_kvd(entity, "origin", "8192 8192 8192", class);
fm_DispatchSpawn(entity);
set_pev(entity, pev_classname, classname);
fm_fake_touch(entity, victim);
fm_remove_entity(entity);
return 1;
}
#define fm_find_ent(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
/* stock fm_find_ent(index, const classname[])
return engfunc(EngFunc_FindEntityByString, index, "classname", classname) */
#define fm_get_user_button(%1) pev(%1, pev_button)
/* stock fm_get_user_button(index)
return pev(index, pev_button) */
#define fm_get_user_oldbutton(%1) pev(%1, pev_oldbuttons)
/* stock fm_get_user_oldbutton(index)
return pev(index, pev_oldbuttons) */
#define fm_get_entity_flags(%1) pev(%1, pev_flags)
/* stock fm_get_entity_flags(index)
return pev(index, pev_flags) */
#define fm_get_entity_distance(%1,%2) floatround(fm_entity_range(%1, %2))
/* stock fm_get_entity_distance(ent1, ent2)
return floatround(fm_entity_range(ent1, ent2)) */
#define fm_get_grenade(%1) fm_get_grenade_id(%1, "", 0)
/* stock fm_get_grenade(id)
return fm_get_grenade_id(id, "", 0) */
// optimization idea by Orangutanz
stock fm_get_brush_entity_origin(index, Float:origin[3]) {
new Float:mins[3], Float:maxs[3];
pev(index, pev_origin, origin);
pev(index, pev_mins, mins);
pev(index, pev_maxs, maxs);
origin[0] += (mins[0] + maxs[0]) * 0.5;
origin[1] += (mins[1] + maxs[1]) * 0.5;
origin[2] += (mins[2] + maxs[2]) * 0.5;
return 1;
}
// based on v3x's port, upgraded version returns number of removed entities
stock fm_remove_entity_name(const classname[]) {
new ent = -1, num = 0;
while ((ent = fm_find_ent_by_class(ent, classname)))
num += fm_remove_entity(ent);
return num;
}
stock fm_ViewContents(id) {
new origin[3], Float:Orig[3];
get_user_origin(id, origin, 3);
IVecFVec(origin, Orig);
return fm_point_contents(Orig);
}
stock fm_get_speed(entity) {
new Float:Vel[3];
pev(entity, pev_velocity, Vel);
return floatround(vector_length(Vel));
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);
set_pev(entity, pev_renderfx, fx);
set_pev(entity, pev_rendercolor, RenderColor);
set_pev(entity, pev_rendermode, render);
set_pev(entity, pev_renderamt, float(amount));
return 1;
}
stock fm_set_entity_flags(index, flag, onoff) {
new flags = pev(index, pev_flags);
if ((flags & flag) > 0)
return onoff == 1 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags - flag);
else
return onoff == 0 ? 2 : 1 + 0 * set_pev(index, pev_flags, flags + flag);
return 0;
}
stock fm_set_entity_visibility(index, visible = 1) {
set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW);
return 1;
}
#define fm_get_entity_visibility(%1) (!(pev(%1, pev_effects) & EF_NODRAW))
/* stock fm_get_entity_visibility(index)
return !(pev(index, pev_effects) & EF_NODRAW) */
stock fm_set_user_velocity(entity, const Float:vector[3]) {
set_pev(entity, pev_velocity, vector);
return 1;
}
#define fm_get_user_velocity(%1,%2) pev(%1, pev_velocity, %2)
/* stock fm_get_user_velocity(entity, Float:vector[3])
return pev(entity, pev_velocity, vector) */
/* Fun functions */
#define fm_get_client_listen(%1,%2) engfunc(EngFunc_GetClientListening, %1, %2)
/* stock fm_get_client_listen(receiver, sender)
return engfunc(EngFunc_GetClientListening, receiver, sender) */
#define fm_set_client_listen(%1,%2,%3) engfunc(EngFunc_SetClientListening, %1, %2, %3)
/* stock fm_set_client_listen(receiver, sender, listen)
return engfunc(EngFunc_SetClientListening, receiver, sender, listen) */
stock fm_get_user_godmode(index) {
new Float:val;
pev(index, pev_takedamage, val);
return (val == DAMAGE_NO);
}
stock fm_set_user_godmode(index, godmode = 0) {
set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM);
return 1;
}
stock fm_set_user_armor(index, armor) {
set_pev(index, pev_armorvalue, float(armor));
return 1;
}
stock fm_set_user_health(index, health) {
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);
return 1;
}
stock fm_set_user_origin(index, /* const */ origin[3]) {
new Float:orig[3];
IVecFVec(origin, orig);
return fm_entity_set_origin(index, orig);
}
stock fm_set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
return fm_set_rendering(index, fx, r, g, b, render, amount);
}
stock fm_give_item(index, const item[]) {
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
return 0;
new ent = fm_create_entity(item);
if (!pev_valid(ent))
return 0;
new Float:origin[3];
pev(index, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, index);
if (pev(ent, pev_solid) != save)
return ent;
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
stock fm_set_user_maxspeed(index, Float:speed = -1.0) {
engfunc(EngFunc_SetClientMaxspeed, index, speed);
set_pev(index, pev_maxspeed, speed);
return 1;
}
stock Float:fm_get_user_maxspeed(index) {
new Float:speed;
pev(index, pev_maxspeed, speed);
return speed;
}
stock fm_set_user_gravity(index, Float:gravity = 1.0) {
set_pev(index, pev_gravity, gravity);
return 1;
}
stock Float:fm_get_user_gravity(index) {
new Float:gravity;
pev(index, pev_gravity, gravity);
return gravity;
}
/* interferes with FM_Spawn enum, just use fm_DispatchSpawn
stock fm_spawn(entity) {
return dllfunc(DLLFunc_Spawn, entity)
}
*/
stock fm_set_user_noclip(index, noclip = 0) {
set_pev(index, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK);
return 1;
}
#define fm_get_user_noclip(%1) (pev(%1, pev_movetype) == MOVETYPE_NOCLIP)
/* stock fm_get_user_noclip(index)
return (pev(index, pev_movetype) == MOVETYPE_NOCLIP) */
// note: get_user_weapon will still return former weapon index
stock fm_strip_user_weapons(index) {
new ent = fm_create_entity("player_weaponstrip");
if (!pev_valid(ent))
return 0;
dllfunc(DLLFunc_Spawn, ent);
dllfunc(DLLFunc_Use, ent, index);
engfunc(EngFunc_RemoveEntity, ent);
return 1;
}
stock fm_set_user_frags(index, frags) {
set_pev(index, pev_frags, float(frags));
return 1;
}
/* Cstrike functions */
stock fm_cs_user_spawn(index) {
set_pev(index, pev_deadflag, DEAD_RESPAWNABLE);
dllfunc(DLLFunc_Spawn, index);
set_pev(index, pev_iuser1, 0);
return 1;
}
/* Custom functions */
// based on Basic-Master's set_keyvalue, upgraded version accepts an optional classname (a bit more efficient if it is passed)
stock fm_set_kvd(entity, const key[], const value[], const classname[] = "") {
if (classname[0])
set_kvd(0, KV_ClassName, classname);
else {
new class[32];
pev(entity, pev_classname, class, sizeof class - 1);
set_kvd(0, KV_ClassName, class);
}
set_kvd(0, KV_KeyName, key);
set_kvd(0, KV_Value, value);
set_kvd(0, KV_fHandled, 0);
return dllfunc(DLLFunc_KeyValue, entity, 0);
}
stock fm_find_ent_by_integer(index, pev_field, value) {
static maxents;
if (!maxents)
maxents = global_get(glb_maxEntities);
for (new i = index + 1; i < maxents; ++i) {
if (pev_valid(i) && pev(i, pev_field) == value)
return i;
}
return 0;
}
stock fm_find_ent_by_flags(index, pev_field, flags) {
static maxents;
if (!maxents)
maxents = global_get(glb_maxEntities);
for (new i = index + 1; i < maxents; ++i) {
if (pev_valid(i) && (pev(i, pev_field) & flags) == flags)
return i;
}
return 0;
}
stock Float:fm_distance_to_box(const Float:point[3], const Float:mins[3], const Float:maxs[3]) {
new Float:dist[3];
for (new i = 0; i < 3; ++i) {
if (point[i] > maxs[i])
dist[i] = point[i] - maxs[i];
else if (mins[i] > point[i])
dist[i] = mins[i] - point[i];
}
return vector_length(dist);
}
stock Float:fm_boxes_distance(const Float:mins1[3], const Float:maxs1[3], const Float:mins2[3], const Float:maxs2[3]) {
new Float:dist[3];
for (new i = 0; i < 3; ++i) {
if (mins1[i] > maxs2[i])
dist[i] = mins1[i] - maxs2[i];
else if (mins2[i] > maxs1[i])
dist[i] = mins2[i] - maxs1[i];
}
return vector_length(dist);
}
stock Float:fm_distance_to_boxent(entity, boxent) {
new Float:point[3];
pev(entity, pev_origin, point);
new Float:mins[3], Float:maxs[3];
pev(boxent, pev_absmin, mins);
pev(boxent, pev_absmax, maxs);
return fm_distance_to_box(point, mins, maxs);
}
stock Float:fm_boxents_distance(boxent1, boxent2) {
new Float:mins1[3], Float:maxs1[3];
pev(boxent1, pev_absmin, mins1);
pev(boxent1, pev_absmax, maxs1);
new Float:mins2[3], Float:maxs2[3];
pev(boxent2, pev_absmin, mins2);
pev(boxent2, pev_absmax, maxs2);
return fm_boxes_distance(mins1, maxs1, mins2, maxs2);
}
// projects a center of a player's feet base (originally by P34nut, improved)
stock Float:fm_distance_to_floor(index, ignoremonsters = 1) {
new Float:start[3], Float:dest[3], Float:end[3];
pev(index, pev_origin, start);
dest[0] = start[0];
dest[1] = start[1];
dest[2] = -8191.0;
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0);
get_tr2(0, TR_vecEndPos, end);
pev(index, pev_absmin, start);
new Float:ret = start[2] - end[2];
return ret > 0 ? ret : 0.0;
}
// potential to crash (?) if used on weaponbox+weapon_* entity pair (use fm_remove_weaponbox instead)
stock fm_kill_entity(index) {
set_pev(index, pev_flags, pev(index, pev_flags) | FL_KILLME);
return 1;
}
// if weapon index isn't passed then assuming that it's the current weapon
stock fm_get_user_weapon_entity(id, wid = 0) {
new weap = wid, clip, ammo;
if (!weap && !(weap = get_user_weapon(id, clip, ammo)))
return 0;
new class[32];
get_weaponname(weap, class, sizeof class - 1);
return fm_find_ent_by_owner(-1, class, id);
}
// only weapon index or its name can be passed, if neither is passed then the current gun will be stripped
stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") {
new ent_class[32];
if (!wid && wname[0])
copy(ent_class, sizeof ent_class - 1, wname);
else {
new weapon = wid, clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
}
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
if (!ent_weap)
return false;
engclient_cmd(index, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index)
return false;
dllfunc(DLLFunc_Think, ent_box);
return true;
}
// only weapon index or its name can be passed, if neither is passed then the current gun will be transferred
stock bool:fm_transfer_user_gun(index1, index2, wid = 0, const wname[] = "") {
new ent_class[32];
if (!wid && wname[0])
copy(ent_class, sizeof ent_class - 1, wname);
else {
new weapon = wid, clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index1, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
}
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index1);
if (!ent_weap)
return false;
engclient_cmd(index1, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index1)
return false;
set_pev(ent_box, pev_flags, pev(ent_box, pev_flags) | FL_ONGROUND);
dllfunc(DLLFunc_Touch, ent_box, index2);
if (pev(ent_weap, pev_owner) != index2)
return false;
return true;
}
stock bool:fm_is_ent_visible(index, entity, ignoremonsters = 0) {
new Float:start[3], Float:dest[3];
pev(index, pev_origin, start);
pev(index, pev_view_ofs, dest);
xs_vec_add(start, dest, start);
pev(entity, pev_origin, dest);
engfunc(EngFunc_TraceLine, start, dest, ignoremonsters, index, 0);
new Float:fraction;
get_tr2(0, TR_flFraction, fraction);
if (fraction == 1.0 || get_tr2(0, TR_pHit) == entity)
return true;
return false;
}
// ported from AMXX's core get_user_origin(..., 3) (suggested by Greenberet)
stock fm_get_aim_origin(index, Float:origin[3]) {
new Float:start[3], Float:view_ofs[3];
pev(index, pev_origin, start);
pev(index, pev_view_ofs, view_ofs);
xs_vec_add(start, view_ofs, start);
new Float:dest[3];
pev(index, pev_v_angle, dest);
engfunc(EngFunc_MakeVectors, dest);
global_get(glb_v_forward, dest);
xs_vec_mul_scalar(dest, 9999.0, dest);
xs_vec_add(start, dest, dest);
engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
get_tr2(0, TR_vecEndPos, origin);
return 1;
}
stock bool:fm_get_user_longjump(index) {
new value[2];
engfunc(EngFunc_GetPhysicsKeyValue, index, "slj", value, 1);
switch (value[0]) {
case '1': return true;
}
return false;
}
stock fm_set_user_longjump(index, bool:longjump = true, bool:tempicon = true) {
if (longjump == fm_get_user_longjump(index))
return;
if (longjump) {
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "1");
if (tempicon) {
static msgid_itempickup;
if (!msgid_itempickup)
msgid_itempickup = get_user_msgid("ItemPickup");
message_begin(MSG_ONE, msgid_itempickup, _, index);
write_string("item_longjump");
message_end();
}
}
else
engfunc(EngFunc_SetPhysicsKeyValue, index, "slj", "0");
}
#define WEAPON_SUIT 31
stock bool:fm_get_user_suit(index) {
return bool:(!(!(pev(index, pev_weapons) & (1<<WEAPON_SUIT)))); // i'm not insane, this is a trick!
}
stock fm_set_user_suit(index, bool:suit = true, bool:sound = true) {
new weapons = pev(index, pev_weapons);
if (!suit)
set_pev(index, pev_weapons, weapons & ~(1<<WEAPON_SUIT));
else if (!(weapons & (1<<WEAPON_SUIT))) {
set_pev(index, pev_weapons, weapons | (1<<WEAPON_SUIT));
if (sound)
emit_sound(index, CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
}
#define FEV_RELIABLE (1<<1)
#define FEV_GLOBAL (1<<2)
// removes all created decals and players' corpses from the world
// set a specific index to remove decals only for the given client
stock fm_cs_remove_decals(index = 0) {
static eventindex_decal_reset;
if (!eventindex_decal_reset)
eventindex_decal_reset = engfunc(EngFunc_PrecacheEvent, 1, "events/decal_reset.sc");
new flags = FEV_RELIABLE;
if (!index)
flags |= FEV_GLOBAL;
engfunc(EngFunc_PlaybackEvent, flags, index, eventindex_decal_reset, 0.0, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}, 0.0, 0.0, 0, 0, 0, 0);
}
// checks whether the entity's classname is equal to the passed classname
stock bool:fm_is_ent_classname(index, const classname[]) {
if (!pev_valid(index))
return false;
new class[32];
pev(index, pev_classname, class, sizeof class - 1);
if (equal(class, classname))
return true;
return false;
}
// the same as AMXX's core user_kill but fixes the issue when the scoreboard doesn't update immediately if flag is set to 1
stock fm_user_kill(index, flag = 0) {
if (flag) {
new Float:frags;
pev(index, pev_frags, frags);
set_pev(index, pev_frags, ++frags);
}
dllfunc(DLLFunc_ClientKill, index);
return 1;
}
// returns a degree angle between player-to-point and player's view vectors
stock Float:fm_get_view_angle_diff(index, const Float:point[3]) {
new Float:vec[3], Float:ofs[3], Float:aim[3];
pev(index, pev_origin, vec);
pev(index, pev_view_ofs, ofs);
xs_vec_add(vec, ofs, vec);
xs_vec_sub(point, vec, vec);
xs_vec_normalize(vec, vec);
pev(index, pev_v_angle, aim);
engfunc(EngFunc_MakeVectors, aim);
global_get(glb_v_forward, aim);
return xs_vec_angle(vec, aim);
}
// gets a weapon type of the linked to weaponbox weapon_* entity
stock fm_get_weaponbox_type(entity) {
static max_clients, max_entities;
if (!max_clients)
max_clients = global_get(glb_maxClients);
if (!max_entities)
max_entities = global_get(glb_maxEntities);
for (new i = max_clients + 1; i < max_entities; ++i) {
if (pev_valid(i) && entity == pev(i, pev_owner)) {
new wname[32];
pev(i, pev_classname, wname, sizeof wname - 1);
return get_weaponid(wname);
}
}
return 0;
}
// safe removal of weaponbox+weapon_* entity pair (delay =~= 0.03 second)
#define fm_remove_weaponbox(%1) dllfunc(DLLFunc_Think, %1)
/* stock fm_remove_weaponbox(entity)
return dllfunc(DLLFunc_Think, entity) */

View File

@@ -0,0 +1,143 @@
/* Files functions
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _file_included
#endinput
#endif
#define _file_included
/* Reads content from directory.
* Returns index of next element or 0 when end of dir. is reached. */
native read_dir(const dirname[],pos,output[],len,&outlen);
/* Reads line from file. Returns index of next line or 0 when end of file is reached. */
native read_file(const file[],line,text[],len,&txtlen);
/* Writes text to file. Function returns 0 on failure.
* When line is set to -1, the text is added at the end of file. */
native write_file(const file[],const text[],line = -1);
/* Deletes file. Function returns 1 on success, 0 on failure. */
native delete_file(const file[]);
/* Checks for file. If file exists function returns 1, in other case 0. */
native file_exists(const file[]);
/* renames a file. returns 0 on failure, 1 on success.
* if relative true, rename_file will act like other natives which
* use the moddir as a base directory. otherwise, the current directory is
* undefined (but assumed to be hlds).
*/
native rename_file(const oldname[], const newname[], relative=0);
/* Checks if a directory exists */
native dir_exists(const dir[]);
/* Returns a file size in bytes if flag is set to 0.
* When flag is set to 1 returns number of lines in the file,
* and when flags is 2, function returns 1 if the file ends
* with line feed. If file doesn't exist returns -1. */
native file_size(const file[], flag=0);
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
//Open a file, returns a handle or 0 on failure
native fopen(const filename[],const mode[]);
//Closes a file handle
native fclose(file);
#define BLOCK_INT 4
#define BLOCK_SHORT 2
#define BLOCK_CHAR 1
#define BLOCK_BYTE 1
//The following functions work as such:
// RAW - means the array you pass is a raw bytestream, for experts only
// BLOCK - means you are passing in an array where each element will be written
// NORMAL - means you are writing only one element
// RAW and BLOCK return the number of blocks acted upon successfully
// NORMAL returns 1 on success
native fread(file, &data, mode);
native fread_blocks(file, data[], blocks, mode);
native fread_raw(file, stream[], blocksize, blocks);
native fwrite(file, data, mode);
native fwrite_blocks(file, const data[], blocks, mode);
native fwrite_raw(file, const stream[], blocksize, mode);
//Returns 1 if the file is ended, 0 otherwise
native feof(file);
//Reads a line from a text file -- includes newline!
native fgets(file, buffer[], maxlength);
//Writes a line to a text file. Returns # of characters written.
native fputs(file, const text[]);
//Writes a line to the file
native fprintf(file, const fmt[], any:...);
//Sets the current position in a file (see SEEK_ values above)
native fseek(file, position, start);
//Returns the current position in a file
native ftell(file);
//These are straight from the C standard.
native fgetc(file);
native fputc(file, data);
native fungetc(file, data);
//Return the size of a file
native filesize(const filename[], any:...);
//Attempts to remove a directory.
//Note that you cannot remove a directory that has files on most
// operating systems.
native rmdir(const path[]);
/* Returns 0 on success, like the POSIX specification */
native mkdir(const dirname[]);
//Delete a file (delete_file macro)
native unlink(const filename[]);
//Returns a handle to a directory
native open_dir(dir[], firstfile[], length);
native next_file(dirh, buffer[], length);
native close_dir(dirh);
/**
* Loads a file using the LoadFileForMe engine function.
*
* The data is truncated if there is not enough space. No null-terminator
* is applied; the data is the raw contents of the file.
*
* @param file File to load (may be a file from the GCF).
* @param buffer Buffer to store file contents.
* @param maxlength Maximum size of the file buffer.
* @param length Variable to store the file length. This may return
* a number larger than the buffer size.
* @return -1 if the file could not be loaded. Otherwise,
* the number of cells actually written to the buffer
* are returned.
*/
native LoadFileForMe(const file[], buffer[], maxlength, &length=0);
/**
* Flushes a buffered output stream.
*
* @param file File handle, or 0 for all open streams.
* @return 0 on success, -1 on failure.
*/
native fflush(file);

View File

@@ -0,0 +1,213 @@
/* Float arithmetic
*
* (c) Copyright 1999, Artran, Inc.
* Written by Greg Garner (gmg@artran.com)
* Modified in March 2001 to include user defined
* operators for the floating point functions.
*
* This file is provided as is (no warranties).
*/
#if defined _float_included
#endinput
#endif
#define _float_included
/* Different methods of rounding */
enum floatround_method {
floatround_round = 0,
floatround_floor,
floatround_ceil,
floatround_tozero
};
enum anglemode {
radian = 0,
degrees,
grades
};
/* Convert an integer into a floating point value */
native Float:float(value);
/* Convert a string into a floating point value */
native Float:floatstr(const string[]);
/* Multiple two floats together */
native Float:floatmul(Float:oper1, Float:oper2);
/* Divide the dividend float by the divisor float */
native Float:floatdiv(Float:dividend, Float:divisor);
/* Add two floats together */
native Float:floatadd(Float:dividend, Float:divisor);
/* Subtract oper2 float from oper1 float */
native Float:floatsub(Float:oper1, Float:oper2);
/* Return the fractional part of a float */
native Float:floatfract(Float:value);
/* Round a float into a integer value */
native floatround(Float:value, floatround_method:method=floatround_round);
/* Compare two integers. If the two elements are equal, return 0.
* If the first argument is greater than the second argument, return 1,
* If the first argument is less than the second argument, return -1. */
native floatcmp(Float:fOne, Float:fTwo);
/* Return the square root of the input value, same as floatpower(value, 0.5) */
native Float:floatsqroot(Float:value);
/* Return the value raised to the power of the exponent */
native Float:floatpower(Float:value, Float:exponent);
/* Return the logarithm */
native Float:floatlog(Float:value, Float:base=10.0);
/* Return the sine, cosine or tangent.
* The input angle may be in radians, degrees or grades. */
native Float:floatsin(Float:value, anglemode:mode=radian);
native Float:floatcos(Float:value, anglemode:mode=radian);
native Float:floattan(Float:value, anglemode:mode=radian);
/* Return the hyperbolic sine, cosine or tangent.
* The input angle may be in radians, degrees or grades. */
native Float:floatsinh(Float:angle, anglemode:mode=radian);
native Float:floatcosh(Float:angle, anglemode:mode=radian);
native Float:floattanh(Float:angle, anglemode:mode=radian);
/* Return the absolute value */
native Float:floatabs(Float:value);
/* Return the angle of a sine, cosine or tangent.
* The output angle may be in radians, degrees, or grades. */
native Float:floatatan(Float:angle, {anglemode,_}:radix);
native Float:floatacos(Float:angle, {anglemode,_}:radix);
native Float:floatasin(Float:angle, {anglemode,_}:radix);
native Float:floatatan2(Float:x, Float:y, {anglemode,_}:radix);
#pragma rational Float
/* user defined operators */
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
stock Float:operator++(Float:oper)
return oper+1.0;
stock Float:operator--(Float:oper)
return oper-1.0;
stock Float:operator-(Float:oper)
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
stock Float:operator*(Float:oper1, oper2)
return floatmul(oper1, float(oper2)); /* "*" is commutative */
stock Float:operator/(Float:oper1, oper2)
return floatdiv(oper1, float(oper2));
stock Float:operator/(oper1, Float:oper2)
return floatdiv(float(oper1), oper2);
stock Float:operator+(Float:oper1, oper2)
return floatadd(oper1, float(oper2)); /* "+" is commutative */
stock Float:operator-(Float:oper1, oper2)
return floatsub(oper1, float(oper2));
stock Float:operator-(oper1, Float:oper2)
return floatsub(float(oper1), oper2);
stock bool:operator==(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) == 0;
stock bool:operator==(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
stock bool:operator!=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) != 0;
stock bool:operator!=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) != 0; /* "==" is commutative */
stock bool:operator>(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) > 0;
stock bool:operator>(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) > 0;
stock bool:operator>(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) > 0;
stock bool:operator>=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) >= 0;
stock bool:operator>=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) >= 0;
stock bool:operator>=(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) >= 0;
stock bool:operator<(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) < 0;
stock bool:operator<(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) < 0;
stock bool:operator<(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) < 0;
stock bool:operator<=(Float:oper1, Float:oper2)
return floatcmp(oper1, oper2) <= 0;
stock bool:operator<=(Float:oper1, oper2)
return floatcmp(oper1, float(oper2)) <= 0;
stock bool:operator<=(oper1, Float:oper2)
return floatcmp(float(oper1), oper2) <= 0;
stock bool:operator!(Float:oper)
return (_:oper & ((-1)/2)) == 0; /* -1 = all bits to 1; /2 = remove most significant bit (sign)
works on both 32bit and 64bit systems; no constant required */
/* forbidden operations */
forward operator%(Float:oper1, Float:oper2);
forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2);
stock Float:floatmin(Float:ValueA, Float:ValueB)
{
if (ValueA<=ValueB)
{
return ValueA;
}
return ValueB;
}
stock Float:floatmax(Float:ValueA, Float:ValueB)
{
if (ValueA>=ValueB)
{
return ValueA;
}
return ValueB;
}
stock Float:floatclamp(Float:Value, Float:MinValue, Float:MaxValue)
{
if (Value<=MinValue)
{
return MinValue;
}
if (Value>=MaxValue)
{
return MaxValue;
}
return Value;
}

View File

@@ -0,0 +1,99 @@
/* Fun functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _fun_included
#endinput
#endif
#define _fun_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib fun
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib fun
#endif
#else
#pragma library fun
#endif
/* Returns 1 if receiver hears sender via voice communication. */
native get_client_listen(receiver, sender);
/* Sets who can listen who. Function returns 0
* if for some reasons this setting can't be done. */
native set_client_listen(receiver, sender, listen);
/* Sets player godmode. If you want to disable godmode set only first parameter. */
native set_user_godmode(index, godmode = 0);
/* Returns 1 if godmode is set. */
native get_user_godmode(index);
/* Sets player armor. */
native set_user_armor(index, armor);
/* Sets player health. */
native set_user_health(index, health);
/* Move player to origin. */
native set_user_origin(index, const origin[3]);
/* Sets player rendering mode. */
native set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16);
/* Gives item to player, name of item can start
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
native give_item(index, const item[]);
/* Sets hit zones for player.
* Parts of body are as bits:
* 1 - generic
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg */
native set_user_hitzones(index = 0, target = 0, body = 255);
/* Get user hitzones. */
native get_user_hitzones(index, target);
/* Sets users max. speed. */
native set_user_maxspeed(index, Float:speed = -1.0);
/* Returns users max. speed. */
native Float:get_user_maxspeed(index);
/* Sets users gravity. */
native set_user_gravity(index, Float:gravity = 1.0);
/* Returns users gravity. */
native Float:get_user_gravity(index);
/* Spawns entity. */
native spawn(index);
/* Sets player noclip. If you want to disable noclip set only first parameter. */
native set_user_noclip(index, noclip = 0);
/* Returns 1 if noclip is set. */
native get_user_noclip(index);
/* Returns 1 if player has silent footsteps, 0 if footsteps are set to normal */
native get_user_footsteps(index);
/* Gives player silent footsteps.
* if set = 0 it will return footsteps to normal */
native set_user_footsteps(id, set = 1);
/* Strips all weapons from user. */
native strip_user_weapons(index);
/* Sets player frags. */
native set_user_frags(index, frags);

View File

@@ -0,0 +1,74 @@
/* GeoIP module functions for AMX Mod X
by David "BAILOPAN" Anderson
(C)Copyrighted under the GNU General Public License, Version 2
*/
#if defined geoip_included
#endinput
#endif
#define _geoip_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib geoip
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib geoip
#endif
#else
#pragma library geoip
#endif
/// IP addresses passed to these natives can contain ports, the ports will be ignored.
/**
* Lookup the two character country code for a given IP address.
* e.g: "US", "CA", etc.
*
* @param ip The IP address to lookup.
* @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
* @return true on a successful lookup, false on a failed lookup.
*/
native bool:geoip_code2_ex(const ip[], result[3]);
/**
* Lookup the three character country code for a given IP address.
* e.g: "USA", "cAN", etc.
*
* @param ip The IP address to lookup.
* @param result The result buffer. If the lookup does not succeed, the buffer is not modified.
* @return true on a successful lookup, false on a failed lookup.
*/
native bool:geoip_code3_ex(const ip[], result[4]);
/**
* @deprecated
* Lookup the two character country code for a given IP address.
*
* @note This native will overflow the buffer by one cell on an unknown ip lookup!
* @note Use geoip_code2_ex instead!
*
* @param ip The IP address to lookup.
* @param result The result buffer.
*/
native geoip_code2(const ip[], ccode[3]);
/**
* @deprecated
* Lookup the three character country code for a given IP address.
*
* @note This native will overflow the buffer by one cell on an unknown ip lookup!
* @note Use geoip_code3_ex instead!
*
* @param ip The IP address to lookup.
* @param result The result buffer.
*/
native geoip_code3(const ip[], result[4]);
/**
* Lookup the full country name for the given IP address. Sets the buffer to "error" on
* an unsuccessful lookup.
*
* @param ip The IP address to lookup.
* @param result The result of the geoip lookup.
* @param len The maximum length of the result buffer.
*/
native geoip_country(const ip[], result[], len=45);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,382 @@
/**
* Ham Sandwich module include file.
* (c) 2007, The AMX Mod X Development Team
*
* -
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
/**
* Ham Sandwich is a module that is used to hook and call virtual functions of
* entities.
* Virtual functions are mod-specific functions. This means that in order
* for this to work on a mod, it needs to be configured with the hamdata.ini
* file.
* Be very careful with parameter passing to these functions.
*/
#if defined _hamsandwich_included
#endinput
#endif
#define _hamsandwich_included
#include <ham_const>
#if AMXX_VERSION_NUM >= 175
#pragma reqlib hamsandwich
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib hamsandwich
#endif
#else
#pragma library hamsandwich
#endif
/**
* Hooks the virtual table for the specified entity class.
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
* Look at the Ham enum for parameter lists.
*
* @param function The function to hook.
* @param EntityClass The entity classname to hook.
* @param callback The forward to call.
* @param post Whether or not to forward this in post.
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
*/
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
/**
* Hooks the virtual table for the specified entity's class.
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
* Look at the Ham enum for parameter lists.
* Note: This will cause hooks for the entire internal class that the entity is
* not exclusively for the provided entity.
*
* @param function The function to hook.
* @param EntityId The entity classname to hook.
* @param callback The forward to call.
* @param post Whether or not to forward this in post.
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
*/
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
/**
* Stops a ham forward from triggering.
* Use the return value from RegisterHam as the parameter here!
*
* @param fwd The forward to stop.
*/
native DisableHamForward(HamHook:fwd);
/**
* Starts a ham forward back up.
* Use the return value from RegisterHam as the parameter here!
*
* @param fwd The forward to re-enable.
*/
native EnableHamForward(HamHook:fwd);
/**
* Executes the virtual function on the entity.
* Look at the Ham enum for parameter lists.
*
* @param function The function to call.
* @param id The id of the entity to execute it on.
*/
native ExecuteHam(Ham:function, this, any:...);
/**
* Executes the virtual function on the entity, this will trigger all hooks on that function.
* Be very careful about recursion!
* Look at the Ham enum for parameter lists.
*
* @param function The function to call.
* @param id The id of the entity to execute it on.
*/
native ExecuteHamB(Ham:function, this, any:...);
/**
* Gets the return status of the current hook.
* This is useful to determine what return natives to use.
*
* @return The current status of the hook (such as HAM_SUPERCEDE).
*/
native GetHamReturnStatus();
/**
* Gets the return value of a hook for hooks that return integers or booleans.
*
* @param output The variable to store the value in.
*/
native GetHamReturnInteger(&output);
/**
* Gets the return value of a hook for hooks that return float.
*
* @param output The variable to store the value in.
*/
native GetHamReturnFloat(&Float:output);
/**
* Gets the return value of a hook for hooks that return Vectors.
*
* @param output The variable to store the value in.
*/
native GetHamReturnVector(Float:output[3]);
/**
* Gets the return value of a hook for hooks that return entities.
*
* @param output The variable to store the value in. Will be -1 on null.
*/
native GetHamReturnEntity(&output);
/**
* Gets the return value of a hook for hooks that return strings.
*
* @param output The buffer to store the string in.
* @param size The string size of the buffer.
*/
native GetHamReturnString(output[], size);
/**
* Gets the original return value of a hook for hooks that return integers or booleans.
*
* @param output The variable to store the value in.
*/
native GetOrigHamReturnInteger(&output);
/**
* Gets the original return value of a hook for hooks that return floats.
*
* @param output The variable to store the value in.
*/
native GetOrigHamReturnFloat(&Float:output);
/**
* Gets the original return value of a hook for hooks that return Vectors.
*
* @param output The variable to store the value in.
*/
native GetOrigHamReturnVector(Float:output[3]);
/**
* Gets the original return value of a hook for hooks that return entities.
*
* @param output The variable to store the value in. -1 on null.
*/
native GetOrigHamReturnEntity(&output);
/**
* Gets the original return value of a hook for hooks that return strings.
*
* @param output The buffer to store the string in.
* @param size The size of the buffer.
*/
native GetOrigHamReturnString(output[], size);
/**
* Sets the return value of a hook that returns an integer or boolean.
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
*
* @param value The value to set the return to.
*/
native SetHamReturnInteger(value);
/**
* Sets the return value of a hook that returns a float.
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
*
* @param value The value to set the return to.
*/
native SetHamReturnFloat(Float:value);
/**
* Sets the return value of a hook that returns a Vector.
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
*
* @param value The value to set the return to.
*/
native SetHamReturnVector(const Float:value[3]);
/**
* Sets the return value of a hook that returns an entity. Set to -1 for null.
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
*
* @param value The value to set the return to.
*/
native SetHamReturnEntity(value);
/**
* Sets the return value of a hook that returns a string.
* This needs to be used in conjunction with HAM_OVERRIDE or HAM_SUPERCEDE.
*
* @param value The value to set the return to.
*/
native SetHamReturnString(const value[]);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are integers.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamInteger(which, value);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are floats.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamFloat(which, Float:value);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are Vectors.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamVector(which, const Float:value[3]);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are entities.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamEntity(which, value);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are strings.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamString(which, const output[]);
/**
* Sets a parameter on the fly of the current hook. This has no effect in post hooks.
* Use this on parameters that are trace result handles.
*
* @param which Which parameter to change. Starts at 1, and works up from the left to right. 1 is always "this".
* @param value The value to change it to.
*/
native SetHamParamTraceResult(which, tr_handle);
/**
* Returns whether or not the function for the specified Ham is valid.
* Things that would make it invalid would be bounds (an older module version
* may not have all of the functions), and the function not being found in
* the mod's hamdata.ini file.
*
* @param function The function to look up.
* @return true if the function is valid, false otherwise.
*/
native bool:IsHamValid(Ham:function);
/**
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
* This requires the mod to have the pev and base fields set in hamdata.ini.
* Note this dereferences memory! Improper use of this will crash the server.
* This will return an index of the corresponding cbase field in private data.
* Returns -1 on a null entry.
*
* @param id The entity to examine the private data.
* @param offset The windows offset of the data.
* @param linuxdiff The linux difference of the data.
* @param macdiff The mac os x difference of the data.
* @return The index of the corresponding pdata field. -1 for none set.
*/
native get_pdata_cbase(id, offset, linuxdiff=5, macdiff=5);
/**
* This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}.
* This requires the mod to have the pev and base fields set in hamdata.ini.
* This will set the corresponding cbase field in private data with the index.
* Pass -1 to null the entry.
*
* @param id The entity to examine the private data.
* @param offset The windows offset of the data.
* @param value The index to store, -1 for invalid
* @param linuxdiff The linux difference of the data.
* @param macdiff The mac os x difference of the data.
*/
native set_pdata_cbase(id, offset, value, linuxdiff=5, macdiff=5);
/**
* This is similar to the get_pdata_cbase, however it does not dereference memory.
* This is many times slower than get_pdata_cbase, and this should only be used
* for testing and finding of offsets, not actual release quality plugins.
* This will return an index of the corresponding cbase field in private data.
* Returns -1 on a null entry. -2 on an invalid entry.
*
* @param id Entry to examine the private data.
* @param offset The windows offset of the data.
* @param linuxdiff The linux difference of the data.
* @param macdiff The mac os x difference of the data.
* @return The index of the corresponding pdata field, -1 for null, -2 for invalid.
*/
native get_pdata_cbase_safe(id, offset, linuxdiff=5, macdiff=5);
// This is the callback from the module, this handles any fatal errors.
// This will in turn call the "HamFilter(Ham:id, HamError:err, const reason[])" public, if it exists.
// Return PLUGIN_HANDLED from within the HamFilter to stop the plugin from failing.
// Any other return value will fail the plugin.
// You do not need to have a HamFilter, if there is none, all fatal errors will fail the plugin.
// Do not modify this!
public __fatal_ham_error(Ham:id, HamError:err, const reason[])
{
new func=get_func_id("HamFilter", -1);
new bool:fail=true;
if (func != -1 && callfunc_begin_i(func, -1)==1)
{
callfunc_push_int(_:id);
callfunc_push_int(_:err);
callfunc_push_str(reason, false);
if (callfunc_end()==PLUGIN_HANDLED)
{
fail=false;
}
}
if (fail)
{
set_fail_state(reason);
}
}

View File

@@ -0,0 +1,492 @@
/* Half-Life Software Development Kit constants
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*
*/
#if defined _hlsdk_const_included
#endinput
#endif
#define _hlsdk_const_included
// pev(entity, pev_button) or pev(entity, pev_oldbuttons) values
#define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1)
#define IN_DUCK (1<<2)
#define IN_FORWARD (1<<3)
#define IN_BACK (1<<4)
#define IN_USE (1<<5)
#define IN_CANCEL (1<<6)
#define IN_LEFT (1<<7)
#define IN_RIGHT (1<<8)
#define IN_MOVELEFT (1<<9)
#define IN_MOVERIGHT (1<<10)
#define IN_ATTACK2 (1<<11)
#define IN_RUN (1<<12)
#define IN_RELOAD (1<<13)
#define IN_ALT1 (1<<14)
#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
#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_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#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_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_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_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#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_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#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
// 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_CHECKONLY 2 // Move, but don't touch triggers
// pev(entity, pev_movetype) values
#define MOVETYPE_NONE 0 // Never moves
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // Gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // Gravity/Collisions
#define MOVETYPE_PUSH 7 // No clip to world, push and crush
#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_FOLLOW 12 // Track movement of aiment
#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
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#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
#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_DISCARDBODY 4
// new Float:takedamage, pev(entity, pev_takedamage, takedamage) values
#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
#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_NOINTERP 32 // Don't interpolate the next frame
#define EF_LIGHT 64 // Rocket flare glow sprite
#define EF_NODRAW 128 // Don't draw entity
// engfunc(EngFunc_PointContents, Float:origin) return values
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_ORIGIN -7 // Removed at csg time
#define CONTENTS_CLIP -8 // Changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
// Instant damage values for use with gmsgDamage 3rd value write_long(BIT)
#define DMG_GENERIC 0 // Generic damage was done
#define DMG_CRUSH (1<<0) // Crushed by falling or moving object
#define DMG_BULLET (1<<1) // Shot
#define DMG_SLASH (1<<2) // Cut, clawed, stabbed
#define DMG_BURN (1<<3) // Heat burned
#define DMG_FREEZE (1<<4) // Frozen
#define DMG_FALL (1<<5) // Fell too far
#define DMG_BLAST (1<<6) // Explosive blast damage
#define DMG_CLUB (1<<7) // Crowbar, punch, headbutt
#define DMG_SHOCK (1<<8) // Electric shock
#define DMG_SONIC (1<<9) // Sound pulse shockwave
#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_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_PARALYZE (1<<15) // Slows affected creature down
#define DMG_NERVEGAS (1<<16) // Nerve toxins, very bad
#define DMG_POISON (1<<17) // Blood poisioning
#define DMG_RADIATION (1<<18) // Radiation exposure
#define DMG_DROWNRECOVER (1<<19) // Drowning recovery
#define DMG_ACID (1<<20) // Toxic chemicals or acid burns
#define DMG_SLOWBURN (1<<21) // In an oven
#define DMG_SLOWFREEZE (1<<22) // In a subzero freezer
#define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)
#define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage
// The fNoMonsters parameter of EngFunc_TraceLine, EngFunc_TraceMonsterHull, EngFunc_TraceHull, and EngFunc_TraceSphere
#define DONT_IGNORE_MONSTERS 0
#define IGNORE_MONSTERS 1
#define IGNORE_MISSILE 2
#define IGNORE_GLASS 0x100
// The hullnumber paramater of EngFunc_TraceHull, EngFunc_TraceModel and DLLFunc_GetHullBounds
#define HULL_POINT 0
#define HULL_HUMAN 1
#define HULL_LARGE 2
#define HULL_HEAD 3
// global_get(glb_trace_flags)
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
// Used with get/set_es(es_handle, ES_eFlags, ...) (entity_state data structure)
#define EFLAG_SLERP 1 // Do studio interpolation of this entity
// pev(entity, pev_spawnflags) values
// Many of these flags apply to specific entities
// func_train
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// func_wall_toggle
#define SF_WALL_START_OFF 0x0001
// func_converyor
#define SF_CONVEYOR_VISUAL 0x0001
#define SF_CONVEYOR_NOTSOLID 0x0002
// func_button
#define SF_BUTTON_DONTMOVE 1
#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_TOUCH_ONLY 256 // Button only fires as a result of USE key.
// func_rot_button
#define SF_ROTBUTTON_NOTSOLID 1
// env_global
#define SF_GLOBAL_SET 1 // Set global state to initial state on spawn
// multisource
#define SF_MULTI_INIT 1
// momentary_rot_button
#define SF_MOMENTARY_DOOR 0x0001
// button_target
#define SF_BTARGET_USE 0x0001
#define SF_BTARGET_ON 0x0002
// func_door, func_water, func_door_rotating, momementary_door
#define SF_DOOR_ROTATE_Y 0
#define SF_DOOR_START_OPEN 1
#define SF_DOOR_ROTATE_BACKWARDS 2
#define SF_DOOR_PASSABLE 8
#define SF_DOOR_ONEWAY 16
#define SF_DOOR_NO_AUTO_RETURN 32
#define SF_DOOR_ROTATE_Z 64
#define SF_DOOR_ROTATE_X 128
#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_SILENT 0x80000000
// gibshooter
#define SF_GIBSHOOTER_REPEATABLE 1 // Allows a gibshooter to be refired
// env_funnel
#define SF_FUNNEL_REVERSE 1 // Funnel effect repels particles instead of attracting them
// env_bubbles
#define SF_BUBBLES_STARTOFF 0x0001
// env_blood
#define SF_BLOOD_RANDOM 0x0001
#define SF_BLOOD_STREAM 0x0002
#define SF_BLOOD_PLAYER 0x0004
#define SF_BLOOD_DECAL 0x0008
// env_shake
#define SF_SHAKE_EVERYONE 0x0001 // Don't check radius
#define SF_SHAKE_DISRUPT 0x0002 // Disrupt controls
#define SF_SHAKE_INAIR 0x0004 // Shake players in air
// env_fade
#define SF_FADE_IN 0x0001 // Fade in, not out
#define SF_FADE_MODULATE 0x0002 // Modulate, don't blend
#define SF_FADE_ONLYONE 0x0004
// env_beam, env_lightning
#define SF_BEAM_STARTON 0x0001
#define SF_BEAM_TOGGLE 0x0002
#define SF_BEAM_RANDOM 0x0004
#define SF_BEAM_RING 0x0008
#define SF_BEAM_SPARKSTART 0x0010
#define SF_BEAM_SPARKEND 0x0020
#define SF_BEAM_DECALS 0x0040
#define SF_BEAM_SHADEIN 0x0080
#define SF_BEAM_SHADEOUT 0x0100
#define SF_BEAM_TEMPORARY 0x8000
// env_sprite
#define SF_SPRITE_STARTON 0x0001
#define SF_SPRITE_ONCE 0x0002
#define SF_SPRITE_TEMPORARY 0x8000
// env_message
#define SF_MESSAGE_ONCE 0x0001 // Fade in, not out
#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
#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_NOSMOKE (1<<3) // Don't draw the smoke
#define SF_ENVEXPLOSION_NODECAL (1<<4) // Don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS (1<<5) // Don't make a scorch mark
// func_tank
#define SF_TANK_ACTIVE 0x0001
#define SF_TANK_PLAYER 0x0002
#define SF_TANK_HUMANS 0x0004
#define SF_TANK_ALIENS 0x0008
#define SF_TANK_LINEOFSIGHT 0x0010
#define SF_TANK_CANCONTROL 0x0020
#define SF_TANK_SOUNDON 0x8000
// grenade
#define SF_DETONATE 0x0001
// item_suit
#define SF_SUIT_SHORTLOGON 0x0001
// game_score
#define SF_SCORE_NEGATIVE 0x0001
#define SF_SCORE_TEAM 0x0002
// game_text
#define SF_ENVTEXT_ALLPLAYERS 0x0001
// game_team_master
#define SF_TEAMMASTER_FIREONCE 0x0001
#define SF_TEAMMASTER_ANYTEAM 0x0002
// game_team_set
#define SF_TEAMSET_FIREONCE 0x0001
#define SF_TEAMSET_CLEARTEAM 0x0002
// game_player_hurt
#define SF_PKILL_FIREONCE 0x0001
// game_counter
#define SF_GAMECOUNT_FIREONCE 0x0001
#define SF_GAMECOUNT_RESET 0x0002
// game_player_equip
#define SF_PLAYEREQUIP_USEONLY 0x0001
// game_player_team
#define SF_PTEAM_FIREONCE 0x0001
#define SF_PTEAM_KILL 0x0002
#define SF_PTEAM_GIB 0x0004
// func_trackchange
#define SF_PLAT_TOGGLE 0x0001
#define SF_TRACK_ACTIVATETRAIN 0x00000001
#define SF_TRACK_RELINK 0x00000002
#define SF_TRACK_ROTMOVE 0x00000004
#define SF_TRACK_STARTBOTTOM 0x00000008
#define SF_TRACK_DONT_MOVE 0x00000010
// func_tracktrain
#define SF_TRACKTRAIN_NOPITCH 0x0001
#define SF_TRACKTRAIN_NOCONTROL 0x0002
#define SF_TRACKTRAIN_FORWARDONLY 0x0004
#define SF_TRACKTRAIN_PASSABLE 0x0008
#define SF_PATH_DISABLED 0x00000001
#define SF_PATH_FIREONCE 0x00000002
#define SF_PATH_ALTREVERSE 0x00000004
#define SF_PATH_DISABLE_TRAIN 0x00000008
#define SF_PATH_ALTERNATE 0x00008000
#define SF_CORNER_WAITFORTRIG 0x001
#define SF_CORNER_TELEPORT 0x002
#define SF_CORNER_FIREONCE 0x004
// trigger_push
#define SF_TRIGGER_PUSH_START_OFF 2 // Spawnflag that makes trigger_push spawn turned OFF
// trigger_hurt
#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_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_CLIENTONLYTOUCH 32 // Only clients may touch this trigger
// trigger_auto
#define SF_AUTO_FIREONCE 0x0001
// trigger_relay
#define SF_RELAY_FIREONCE 0x0001
// multi_manager
#define SF_MULTIMAN_CLONE 0x80000000
#define SF_MULTIMAN_THREAD 0x00000001
// env_render - Flags to indicate masking off various render parameters that are normally copied to the targets
#define SF_RENDER_MASKFX (1<<0)
#define SF_RENDER_MASKAMT (1<<1)
#define SF_RENDER_MASKMODE (1<<2)
#define SF_RENDER_MASKCOLOR (1<<3)
// trigger_changelevel
#define SF_CHANGELEVEL_USEONLY 0x0002
// trigger_endsection
#define SF_ENDSECTION_USEONLY 0x0001
// trigger_camera
#define SF_CAMERA_PLAYER_POSITION 1
#define SF_CAMERA_PLAYER_TARGET 2
#define SF_CAMERA_PLAYER_TAKECONTROL 4
// func_rotating
#define SF_BRUSH_ROTATE_Y_AXIS 0
#define SF_BRUSH_ROTATE_INSTANT 1
#define SF_BRUSH_ROTATE_BACKWARDS 2
#define SF_BRUSH_ROTATE_Z_AXIS 4
#define SF_BRUSH_ROTATE_X_AXIS 8
#define SF_PENDULUM_AUTO_RETURN 16
#define SF_PENDULUM_PASSABLE 32
#define SF_BRUSH_ROTATE_SMALLRADIUS 128
#define SF_BRUSH_ROTATE_MEDIUMRADIUS 256
#define SF_BRUSH_ROTATE_LARGERADIUS 512
// triggers
#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_TRIG_PUSH_ONCE 1
// func_breakable
#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_PRESSURE 4 // Can be broken by a player standing on it
#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)
#define SF_PUSH_BREAKABLE 128
// light_spawn
#define SF_LIGHT_START_OFF 1
#define SPAWNFLAG_NOMESSAGE 1
#define SPAWNFLAG_NOTOUCH 1
#define SPAWNFLAG_DROIDONLY 4
#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
#define SF_MONSTER_GAG 2 // No idle noises from this monster
#define SF_MONSTER_HITMONSTERCLIP 4
#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_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_FALL_TO_GROUND 0x80000000
#define SF_MONSTER_TURRET_AUTOACTIVATE 32
#define SF_MONSTER_TURRET_STARTINACTIVE 64
#define SF_MONSTER_WAIT_UNTIL_PROVOKED 64 // Don't attack the player unless provoked
// info_decal
#define SF_DECAL_NOTINDEATHMATCH 2048
// worldspawn
#define SF_WORLD_DARK 0x0001 // Fade from black at startup
#define SF_WORLD_TITLE 0x0002 // Display game title at startup
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
// Set this bit on guns and stuff that should never respawn
#define SF_NORESPAWN (1<<30)
// Valve Mod Weapon Constants
#define HLI_HEALTHKIT 1
#define HLI_ANTIDOTE 2
#define HLI_SECURITY 3
#define HLI_BATTERY 4
#define HLW_NONE 0
#define HLW_CROWBAR 1
#define HLW_GLOCK 2
#define HLW_PYTHON 3
#define HLW_MP5 4
#define HLW_CHAINGUN 5
#define HLW_CROSSBOW 6
#define HLW_SHOTGUN 7
#define HLW_RPG 8
#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_RELIABLE (1<<1) // Send the event reliably. You must specify the origin and angles
// for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not
// 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
// 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_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_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
#define FCAP_ACROSS_TRANSITION 0x00000002 // should transfer between transitions
#define FCAP_MUST_SPAWN 0x00000004 // Spawn after restore
#define FCAP_DONT_SAVE 0x80000000 // Don't save this
#define FCAP_IMPULSE_USE 0x00000008 // can be used by the player
#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)

View File

@@ -0,0 +1,56 @@
/* Language functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _lang_included
#endinput
#endif
#define _lang_included
//return the number of languages loaded
native get_langsnum();
//sets name to the two-letter name of a language returned by get_langsnum
//index starts at 0
native get_lang(id, name[3]);
//registers a dictionary file, making sure the words are in the dictionary
// the file should be in "addons/amxx/data/lang/", but only the name needs to be
// given. (e.g. register_dictionary("file.txt") will be addons/amxx/data/file.txt).
native register_dictionary(const filename[]);
//returns 1 if the language is loaded, 0 otherwise.
native lang_exists(const name[]);
enum TransKey
{
TransKey_Bad = -1,
};
/**
* Adds or finds a translation key.
*/
native TransKey:CreateLangKey(const key[]);
/**
* Finds a translation key id without adding on failure.
* Returns -1 on not found.
*/
native TransKey:GetLangTransKey(const key[]);
/**
* Adds a translation.
*/
native AddTranslation(const lang[3], TransKey:key, const phrase[]);
/**
* Looks up the translation of the key for the given type
* This does NOT format the output text.
* eg: If the key includes %s, the outputted text will also contain %s.
* NOTE: LANG_PLAYER is invalid in this, use a player index
* or LANG_SERVER
*/
native LookupLangKey(Output[], OutputSize, const Key[], const &id);

View File

@@ -0,0 +1,803 @@
/* Message constants
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*
*/
#if defined _message_const_included
#endinput
#endif
#define _message_const_included
/* Destination types for message_begin() */
#define MSG_BROADCAST 0 // Unreliable to all
#define MSG_ONE 1 // Reliable to one (msg_entity)
#define MSG_ALL 2 // Reliable to all
#define MSG_INIT 3 // Write to the init string
#define MSG_PVS 4 // Ents in PVS of org
#define MSG_PAS 5 // Ents in PAS of org
#define MSG_PVS_R 6 // Reliable to PVS
#define MSG_PAS_R 7 // Reliable to PAS
#define MSG_ONE_UNRELIABLE 8 // Send to one client, but don't put in reliable stream, put in unreliable datagram (could be dropped)
#define MSG_SPEC 9 // Sends to all spectator proxies
/* Hardcoded message types for message_begin()
* Look in the actual HLSDK for details!
*/
#define SVC_NOP 1
#define SVC_DISCONNECT 2
#define SVC_EVENT 3
#define SVC_VERSION 4
#define SVC_SETVIEW 5
#define SVC_SOUND 6
#define SVC_TIME 7
#define SVC_PRINT 8
#define SVC_STUFFTEXT 9
#define SVC_SETANGLE 10
#define SVC_SERVERINFO 11
#define SVC_LIGHTSTYLE 12
#define SVC_UPDATEUSERINFO 13
#define SVC_DELTADESCRIPTION 14
#define SVC_CLIENTDATA 15
#define SVC_STOPSOUND 16
#define SVC_PINGS 17
#define SVC_PARTICLE 18
#define SVC_DAMAGE 19
#define SVC_SPAWNSTATIC 20
#define SVC_EVENT_RELIABLE 21
#define SVC_SPAWNBASELINE 22
#define SVC_TEMPENTITY 23
#define SVC_SETPAUSE 24
#define SVC_SIGNONNUM 25
#define SVC_CENTERPRINT 26
#define SVC_KILLEDMONSTER 27
#define SVC_FOUNDSECRET 28
#define SVC_SPAWNSTATICSOUND 29
#define SVC_INTERMISSION 30
#define SVC_FINALE 31
#define SVC_CDTRACK 32
#define SVC_RESTORE 33
#define SVC_CUTSCENE 34
#define SVC_WEAPONANIM 35
#define SVC_DECALNAME 36
#define SVC_ROOMTYPE 37
#define SVC_ADDANGLE 38
#define SVC_NEWUSERMSG 39
#define SVC_PACKETENTITIES 40
#define SVC_DELTAPACKETENTITIES 41
#define SVC_CHOKE 42
#define SVC_RESOURCELIST 43
#define SVC_NEWMOVEVARS 44
#define SVC_RESOURCEREQUEST 45
#define SVC_CUSTOMIZATION 46
#define SVC_CROSSHAIRANGLE 47
#define SVC_SOUNDFADE 48
#define SVC_FILETXFERFAILED 49
#define SVC_HLTV 50
#define SVC_DIRECTOR 51
#define SVC_VOICEINIT 52
#define SVC_VOICEDATA 53
#define SVC_SENDEXTRAINFO 54
#define SVC_TIMESCALE 55
/* Message flags for set_msg_block() */
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
/* Used with get_msg_argtype() and set_msg_arg_ */
enum
{
ARG_BYTE = 1, /* int */
ARG_CHAR, /* int */
ARG_SHORT, /* int */
ARG_LONG, /* int */
ARG_ANGLE, /* float */
ARG_COORD, /* float */
ARG_STRING, /* string */
ARG_ENTITY, /* int */
};
/* Temp entity message types for message_begin() */
#define TE_BEAMPOINTS 0 // Beam effect between two points
// write_byte(TE_BEAMPOINTS)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // Beam effect between point and entity
// write_byte(TE_BEAMENTPOINT)
// write_short(start entity)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_GUNSHOT 2 // Particle effect plus ricochet sound
// write_byte(TE_GUNSHOT)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
#define TE_EXPLOSION 3 // Additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// write_byte(TE_EXPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(framerate)
// write_byte(flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // All flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // Sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // Do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // Do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // Do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// write_byte(TE_TAREXPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
#define TE_SMOKE 5 // Alphablend sprite, move vertically 30 pps
// write_byte(TE_SMOKE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(framerate)
#define TE_TRACER 6 // Tracer effect from point to point
// write_byte(TE_TRACER)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// write_byte(TE_LIGHTNING)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_byte(life in 0.1's)
// write_byte(width in 0.1's)
// write_byte(amplitude in 0.01's)
// write_short(sprite model index)
#define TE_BEAMENTS 8
// write_byte(TE_BEAMENTS)
// write_short(start entity)
// write_short(end entity)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// write_byte(TE_SPARKS)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
#define TE_LAVASPLASH 10 // Quake1 lava splash
// write_byte(TE_LAVASPLASH)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
#define TE_TELEPORT 11 // Quake1 teleport splash
// write_byte(TE_TELEPORT)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// write_byte(TE_EXPLOSION2)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(starting color)
// write_byte(num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file
// write_byte(TE_BSPDECAL)
// write_coord(position.x) decal position (center of texture in world)
// write_coord(position.y)
// write_coord(position.z)
// write_short(texture index of precached decal texture name)
// write_short(entity index)
// [optional - write_short(index of model of above entity) only included if previous short is non-zero (not the world)]
#define TE_IMPLOSION 14 // Tracers moving toward a point
// write_byte(TE_IMPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(radius)
// write_byte(count)
// write_byte(life in 0.1's)
#define TE_SPRITETRAIL 15 // Line of moving glow sprites with gravity, fadeout, and collisions
// write_byte(TE_SPRITETRAIL)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_short(sprite index)
// write_byte(count)
// write_byte(life in 0.1's)
// write_byte(scale in 0.1's)
// write_byte(velocity along vector in 10's)
// write_byte(randomness of velocity in 10's)
#define TE_SPRITE 17 // Additive sprite, plays 1 cycle
// write_byte(TE_SPRITE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// write_byte(TE_BEAMSPRITE)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_short(beam sprite index)
// write_short(end sprite index)
#define TE_BEAMTORUS 19 // Screen aligned beam ring, expands to max radius over lifetime
// write_byte(TE_BEAMTORUS)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_BEAMDISK 20 // Disk that expands to max radius over lifetime
// write_byte(TE_BEAMDISK)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // Cylinder that expands to max radius over lifetime
// write_byte(TE_BEAMCYLINDER)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_BEAMFOLLOW 22 // Create a line of decaying beam segments until entity stops moving
// write_byte(TE_BEAMFOLLOW)
// write_short(entity:attachment to follow)
// write_short(sprite index)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
#define TE_GLOWSPRITE 23
// write_byte(TE_GLOWSPRITE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(model index)
// write_byte(scale / 10)
// write_byte(size)
// write_byte(brightness)
#define TE_BEAMRING 24 // Connect a beam ring to two entities
// write_byte(TE_BEAMRING)
// write_short(start entity)
// write_short(end entity)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
#define TE_STREAK_SPLASH 25 // Oriented shower of tracers
// write_byte(TE_STREAK_SPLASH)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(vector.x)
// write_coord(vector.y)
// write_coord(vector.z)
// write_byte(color)
// write_short(count)
// write_short(base speed)
// write_short(ramdon velocity)
#define TE_DLIGHT 27 // Dynamic light, effect world, minor entity effect
// write_byte(TE_DLIGHT)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(radius in 10's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(life in 10's)
// write_byte(decay rate in 10's)
#define TE_ELIGHT 28 // Point entity light, no world effect
// write_byte(TE_ELIGHT)
// write_short(entity:attachment to follow)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(radius)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(life in 0.1's)
// write_coord(decay rate)
#define TE_TEXTMESSAGE 29
// write_byte(TE_TEXTMESSAGE)
// write_byte(channel)
// write_short(x) -1 = center)
// write_short(y) -1 = center)
// write_byte(effect) 0 = fade in/fade out, 1 is flickery credits, 2 is write out (training room)
// write_byte(red) - text color
// write_byte(green)
// write_byte(blue)
// write_byte(alpha)
// write_byte(red) - effect color
// write_byte(green)
// write_byte(blue)
// write_byte(alpha)
// write_short(fadein time)
// write_short(fadeout time)
// write_short(hold time)
// [optional] write_short(fxtime) time the highlight lags behing the leading text in effect 2
// write_string(text message) 512 chars max string size
#define TE_LINE 30
// write_byte(TE_LINE)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
// write_short(life in 0.1 s)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
#define TE_BOX 31
// write_byte(TE_BOX)
// write_coord(boxmins.x)
// write_coord(boxmins.y)
// write_coord(boxmins.z)
// write_coord(boxmaxs.x)
// write_coord(boxmaxs.y)
// write_coord(boxmaxs.z)
// write_short(life in 0.1 s)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
#define TE_KILLBEAM 99 // Kill all beams attached to entity
// write_byte(TE_KILLBEAM)
// write_short(entity)
#define TE_LARGEFUNNEL 100
// write_byte(TE_LARGEFUNNEL)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_short(flags)
#define TE_BLOODSTREAM 101 // Particle spray
// write_byte(TE_BLOODSTREAM)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(vector.x)
// write_coord(vector.y)
// write_coord(vector.z)
// write_byte(color)
// write_byte(speed)
#define TE_SHOWLINE 102 // Line of particles every 5 units, dies in 30 seconds
// write_byte(TE_SHOWLINE)
// write_coord(startposition.x)
// write_coord(startposition.y)
// write_coord(startposition.z)
// write_coord(endposition.x)
// write_coord(endposition.y)
// write_coord(endposition.z)
#define TE_BLOOD 103 // Particle spray
// write_byte(TE_BLOOD)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(vector.x)
// write_coord(vector.y)
// write_coord(vector.z)
// write_byte(color)
// write_byte(speed)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
// write_byte(TE_DECAL)
// write_coord(position.x) decal position (center of texture in world)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(texture index of precached decal texture name)
// write_short(entity index)
#define TE_FIZZ 105 // Create alpha sprites inside of entity, float upwards
// write_byte(TE_FIZZ)
// write_short(entity)
// write_short(sprite index)
// write_byte density)
#define TE_MODEL 106 // Create a moving model that bounces and makes a sound when it hits
// write_byte(TE_MODEL)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_angle(initial yaw)
// write_short(model index)
// write_byte(bounce sound type)
// write_byte(life in 0.1's)
#define TE_EXPLODEMODEL 107 // Spherical shower of models, picks from set
// write_byte(TE_EXPLODEMODEL)
// write_coord(origin.x)
// write_coord(origin.y)
// write_coord(origin.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(model index)
// write_short(count)
// write_byte(life in 0.1's)
#define TE_BREAKMODEL 108 // Box of models or sprites
// write_byte(TE_BREAKMODEL)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(size.x)
// write_coord(size.y)
// write_coord(size.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_byte(random velocity in 10's)
// write_short(sprite or model index)
// write_byte(count)
// write_byte(life in 0.1 secs)
// write_byte(flags)
#define TE_GUNSHOTDECAL 109 // Decal and ricochet sound
// write_byte(TE_GUNSHOTDECAL)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(entity index???)
// write_byte(decal???)
#define TE_SPRITE_SPRAY 110 // Spray of alpha sprites
// write_byte(TE_SPRITE_SPRAY)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(sprite index)
// write_byte(count)
// write_byte(speed)
// write_byte(noise)
#define TE_ARMOR_RICOCHET 111 // Quick spark sprite, client ricochet sound.
// write_byte(TE_ARMOR_RICOCHET)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(scale in 0.1's)
#define TE_PLAYERDECAL 112
// write_byte(TE_PLAYERDECAL)
// write_byte(playerindex)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(entity???)
// write_byte(decal number)
// [optional] write_short(model index)
#define TE_BUBBLES 113 // Create alpha sprites inside of box, float upwards
// write_byte(TE_BUBBLES)
// write_coord(position.x) (min start position)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(position.x) (max start position)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(float height)
// write_short(model index)
// write_byte(count)
// write_coord(speed)
#define TE_BUBBLETRAIL 114 // Create alpha sprites along a line, float upwards
// write_byte(TE_BUBBLETRAIL)
// write_coord(position.x) (min start position)
// write_coord(position.y) (min start position)
// write_coord(position.z) (min start position)
// write_coord(position.x) (max start position)
// write_coord(position.y) (max start position)
// write_coord(position.z) (max start position)
// write_coord(float height)
// write_short(model index)
// write_byte(count)
// write_coord(speed)
#define TE_BLOODSPRITE 115 // Spray of opaque sprite1's that fall, single sprite2 for 1..2 secs (this is a high-priority tent)
// write_byte(TE_BLOODSPRITE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite1 index)
// write_short(sprite2 index)
// write_byte(color)
// write_byte(scale)
#define TE_WORLDDECAL 116 // Decal applied to the world brush
// write_byte(TE_WORLDDECAL)
// write_coord(position.x) decal position (center of texture in world)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(texture index of precached decal texture name)
#define TE_WORLDDECALHIGH 117 // Decal (with texture index > 256) applied to world brush
// write_byte(TE_WORLDDECALHIGH)
// write_coord(position.x) decal position (center of texture in world)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(texture index of precached decal texture name - 256)
#define TE_DECALHIGH 118 // Same as TE_DECAL, but the texture index was greater than 256
// write_byte(TE_DECALHIGH)
// write_coord(position.x) decal position (center of texture in world)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(texture index of precached decal texture name - 256)
// write_short(entity index)
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
// write_byte(TE_PROJECTILE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(modelindex)
// write_byte(life)
// write_byte(owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
#define TE_SPRAY 120 // Throws a shower of sprites or models
// write_byte(TE_SPRAY)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(direction.x)
// write_coord(direction.y)
// write_coord(direction.z)
// write_short(modelindex)
// write_byte(count)
// write_byte(speed)
// write_byte(noise)
// write_byte(rendermode)
#define TE_PLAYERSPRITES 121 // Sprites emit from a player's bounding box (ONLY use for players!)
// write_byte(TE_PLAYERSPRITES)
// write_short(playernum)
// write_short(sprite modelindex)
// write_byte(count)
// write_byte(variance) (0 = no variance in size) (10 = 10% variance in size)
#define TE_PARTICLEBURST 122 // Very similar to lavasplash
// write_byte(TE_PARTICLEBURST)
// write_coord(origin)
// write_short(radius)
// write_byte(particle color)
// write_byte(duration * 10) (will be randomized a bit)
#define TE_FIREFIELD 123 // Makes a field of fire
// write_byte(TE_FIREFIELD)
// write_coord(origin)
// write_short(radius) (fire is made in a square around origin. -radius, -radius to radius, radius)
// write_short(modelindex)
// write_byte(count)
// write_byte(flags)
// write_byte(duration (in seconds) * 10) (will be randomized a bit)
//
// to keep network traffic low, this message has associated flags that fit into a byte:
#define TEFIRE_FLAG_ALLFLOAT 1 // All sprites will drift upwards as they animate
#define TEFIRE_FLAG_SOMEFLOAT 2 // Some of the sprites will drift upwards. (50% chance)
#define TEFIRE_FLAG_LOOP 4 // If set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
#define TEFIRE_FLAG_ALPHA 8 // If set, sprite is rendered alpha blended at 50% else, opaque
#define TEFIRE_FLAG_PLANAR 16 // If set, all fire sprites have same initial Z instead of randomly filling a cube.
#define TE_PLAYERATTACHMENT 124 // Attaches a TENT to a player (this is a high-priority tent)
// write_byte(TE_PLAYERATTACHMENT)
// write_byte(entity index of player)
// write_coord(vertical offset) (attachment origin.z = player origin.z + vertical offset)
// write_short(model index)
// write_short(life * 10 )
#define TE_KILLPLAYERATTACHMENTS 125 // Will expire all TENTS attached to a player.
// write_byte(TE_KILLPLAYERATTACHMENTS)
// write_byte(entity index of player)
#define TE_MULTIGUNSHOT 126 // Much more compact shotgun message
// This message is used to make a client approximate a 'spray' of gunfire.
// Any weapon that fires more than one bullet per frame and fires in a bit of a spread is
// a good candidate for MULTIGUNSHOT use. (shotguns)
//
// NOTE: This effect makes the client do traces for each bullet, these client traces ignore
// entities that have studio models.Traces are 4096 long.
//
// write_byte(TE_MULTIGUNSHOT)
// write_coord(origin.x)
// write_coord(origin.y)
// write_coord(origin.z)
// write_coord(direction.x)
// write_coord(direction.y)
// write_coord(direction.z)
// write_coord(x noise * 100)
// write_coord(y noise * 100)
// write_byte(count)
// write_byte(bullethole decal texture index)
#define TE_USERTRACER 127 // Larger message than the standard tracer, but allows some customization.
// write_byte(TE_USERTRACER)
// write_coord(origin.x)
// write_coord(origin.y)
// write_coord(origin.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_byte(life * 10)
// write_byte(color) this is an index into an array of color vectors in the engine. (0 - )
// write_byte(length * 10)
// From hltv.h from the HLSDK, these are used in conjunction with SVC_DIRECTOR
// sub commands of svc_director:
#define DRC_CMD_NONE 0 // NULL director command
#define DRC_CMD_START 1 // start director mode
#define DRC_CMD_EVENT 2 // informs about director command
#define DRC_CMD_MODE 3 // switches camera modes
#define DRC_CMD_CAMERA 4 // sets camera registers
#define DRC_CMD_TIMESCALE 5 // sets time scale
#define DRC_CMD_MESSAGE 6 // send HUD centerprint
#define DRC_CMD_SOUND 7 // plays a particular sound
#define DRC_CMD_STATUS 8 // status info about broadcast
#define DRC_CMD_BANNER 9 // banner file name for HLTV gui
#define DRC_CMD_FADE 10 // send screen fade command
#define DRC_CMD_SHAKE 11 // send screen shake command
#define DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
#define DRC_CMD_LAST 12
// HLTV_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) //
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
#define DRC_FLAG_INTRO (1<<8) // is a introduction scene
#define DRC_FLAG_FINAL (1<<9) // is a final scene
#define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
#define MAX_DIRECTOR_CMD_PARAMETERS 4
#define MAX_DIRECTOR_CMD_STRING 128

View File

@@ -0,0 +1,58 @@
/* Message Stocks
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*
*/
#if defined _message_stocks_included
#endinput
#endif
#define _message_stocks_included
/* Creates a death message. */
stock dod_make_deathmsg(killer, victim, weaponNUM)
{
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
write_byte(killer);
write_byte(victim);
write_byte(weaponNUM);
message_end();
return 1;
}
/* Kills a user without a message. */
stock user_silentkill(index)
{
static msgid = 0;
new msgblock;
if (!msgid)
{
msgid = get_user_msgid("DeathMsg");
}
msgblock = get_msg_block(msgid);
set_msg_block(msgid, BLOCK_ONCE);
user_kill(index, 1);
set_msg_block(msgid, msgblock);
return 1;
}
/* Creates a death message. */
stock make_deathmsg(killer, victim, headshot, const weapon[])
{
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
write_byte(killer);
write_byte(victim);
new mod_name[32];
get_modname(mod_name, 31);
if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
write_byte(headshot);
write_string(weapon);
message_end();
return 1;
}

View File

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

View File

@@ -0,0 +1,262 @@
/* AMX Mod X constants
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _newmenus_included
#endinput
#endif
#define _newmenus_included
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
#define MPROP_BACKNAME 2 /* Name of the back button (param1 = string) */
#define MPROP_NEXTNAME 3 /* Name of the next button (param1 = string) */
#define MPROP_EXITNAME 4 /* Name of the exit button (param1 = string) */
#define MPROP_TITLE 5 /* Menu title text (param1 = string) */
#define MPROP_EXIT 6 /* Exit functionality (param1 = number, see MEXIT constants) */
#define MPROP_NOCOLORS 8 /* Sets whether colors are not auto (param1 = number, 0=default) */
#define MPROP_NUMBER_COLOR 10 /* Color indicator to use for numbers (param1 = string, "\r"=default) */
#define MEXIT_NORMAL 0 /* DEPRECATED, do not use (has no effect) */
#define MENUPAD_NONE 0 /* DEPRECATED, do not use (has no effect) */
#define MENUPAD_PAGE 1 /* DEPRECATED, do not use (has no effect) */
#define MPROP_ORDER 7 /* DEPRECATED, do not use (has no effect) */
#define MPROP_PADMENU 9 /* DEPRECATED, do not use (has no effect) */
/**
* @brief Creates a new menu object.
*
* The handler function should be prototyped as:
*
* public <function>(id, menu, item)
* id - Client the menu is being acted upon.
* menu - Menu resource identifier.
* item - Item the client selected. If less than 0, the menu was
* cancelled and the item is a status code. menu_display
* should never be called immediately if the item is a status
* code, for re-entrancy reasons.
*
* The handler function should always return PLUGIN_HANDLED to block
* any old menu handlers from potentially feeding on the menu, unless
* that is the desired functionality.
*
* @param title Title the menu should use.
* @param handler Name of the handler function. The function will be invoked
* once and only once to every menu_display() call.
* @param ml Unused (should be 0).
* @return Menu resource identifier which must be destroyed via
* menu_destroy(). All menus are destroyed when the plugin
* unloads.
* @error Function name not found.
*/
native menu_create(const title[], const handler[], ml=0);
/**
* Creates a menu item callback handler.
*
* The handler function should be prototyped as:
*
* public <function>(id, menu, item)
* id - Client index being displayed to.
* menu - Menu resource identifier.
* item - Item being drawn.
* <return> - ITEM_IGNORE to use the default functionality. ITEM_ENABLED to
* explicitly enable or ITEM_DISABLED to explicitly disable.
*
* @param function Function name.
* @return Menu callback ID.
*/
native menu_makecallback(const function[]);
/**
* Adds an menu to a menu.
*
* @param menu Menu resource identifier.
* @param name Item text to display.
* @param info Item info string for internal information.
* @param paccess Access required by the player viewing the menu.
* @param callback If set to a valid ID from menu_makecallback(), the
* callback will be invoked before drawing the item.
* @noreturn
* @error Invalid menu resource.
*/
native menu_additem(menu, const name[], const info[]="", paccess=0, callback=-1);
/**
* Returns the number of pages in a menu.
*
* @param menu Menu resource identifier.
* @return Number of pages in the menu.
* @error Invalid menu resource.
*/
native menu_pages(menu);
/**
* Returns the number of items in a menu.
*
* @param menu Menu resource identifier.
* @return Number of items in the menu.
* @error Invalid menu resource.
*/
native menu_items(menu);
/**
* Displays a menu to one client. This should never be called from a handler
* when the item is less than 0 (i.e. calling this from a cancelled menu will
* result in an error).
*
* @param id Client index.
* @param menu Menu resource identifier.
* @param page Page to start from (starting from 0).
* @noreturn
* @error Invalid menu resource or client index.
*/
native menu_display(id, menu, page=0);
/**
* Given a page on a menu and a keypress on that page, returns the item id selected.
* If the item is less than 0, a special option was chosen (such as MENU_EXIT).
*
* @param menu Menu resource identifier.
* @param page Page on the menu.
* @param key Key pressed (from 1 to 10).
* @return Item identifier, or <0 for a special selection code.
* @error Invalid menu resource.
*/
native menu_find_id(menu, page, key);
/**
* Retrieves info about a menu item.
*
* @param menu Menu resource identifier.
* @param item Item identifier.
* @param access Variable to store access value.
* @param info Buffer to store item info.
* @param infolen Item info buffer length.
* @param name Buffer to store item display text.
* @param namelen Item name buffer length.
* @param callback Callback ID.
* @return 1 on success, 0 on failure.
* @error Invalid menu resource.
*/
native menu_item_getinfo(menu, item, &access, info[], infolen, name[]="", namelen=0, &callback);
/**
* Sets an item's display text.
*
* @param menu Menu resource identifier.
* @param item Item identifier.
* @param name New item display text.
* @return 1 on success, 0 on failure.
* @error Invalid menu resource.
*/
native menu_item_setname(menu, item, const name[]);
/**
* Sets an item's info string.
*
* @param menu Menu resource identifier.
* @param item Item identifier.
* @param info New item info string.
* @return 1 on success, 0 on failure.
* @error Invalid menu resource.
*/
native menu_item_setcmd(menu, item, const info[]);
/**
* Sets an item's callback.
*
* @param menu Menu resource identifier.
* @param item Item identifier.
* @param callback New callback from menu_makecallback(), or -1 to clear.
* @return 1 on success, 0 on failure.
* @error Invalid menu resource.
*/
native menu_item_setcall(menu, item, callback=-1);
/**
* Destroys a menu. Player menus will be cancelled (although may still linger
* on the HUD), and future attempts to access the menu resource will result in
* an error.
*
* This must be called if you create menus dynamically, otherwise you will
* leak memory. For normal dynamic menus, you will destroy the menu in the
* handler function (remembering to handle the case of a menu being cancelled,
* it must still be destroyed).
*
* @param menu Menu resource identifier.
* @noreturn
* @error Invalid menu resource.
*/
native menu_destroy(menu);
/**
* Returns information about a menu (if any) the client is currently viewing.
*
* If newmenu is valid, then the menu will refer to the menuid associated with
* the title. If newmenu is not valid, and the menu is valid, then the player
* is viewing a menu displayed with show_menu().
*
* Both may be invalid if the player is not viewing a menu.
*
* @param id Client index.
* @param menu Variable to store old menu id. If none, then <1 will be
* stored.
* @param newmenu Variable to store new menu id. If none, then -1 will be
* stored.
* @param menupage Variable to store current page of the new menu, if any.
* @return 1 if the player is viewing a menu, 0 otherwise.
* @error Invalid client.
*/
native player_menu_info(id, &menu, &newmenu, &menupage=0);
/**
* Adds a blank line to a menu.
*
* @param menu Menu resource identifier.
* @param slot 1 (default) if the line should shift the numbering down.
* 0 if the line should be a visual shift only.
* @noreturn
* @error Invalid menu resource.
*/
native menu_addblank(menu, slot=1);
/**
* Adds a text line to a menu. Only available in amxmodx 1.8.1 and above.
*
* @param menu Menu resource identifier.
* @param text Text to add.
* @param slot 1 (default) if the line should shift the numbering down.
* 0 if the line should be a visual shift only.
* @noreturn
* @error Invalid menu resource.
*/
native menu_addtext(menu, const text[], slot=1);
/**
* Sets a menu property.
*
* @param menu Menu resource identifier.
* @param prop MPROP_ constant.
* @param ... Property parameters.
* @return 1 on success, 0 on failure.
* @error Invalid menu resource or property.
*/
native menu_setprop(menu, prop, ...);
/**
* Cancels a player's menu, effectively forcing the player to select MENU_EXIT.
* The menu will still exist on their screen but any results are invalidated,
* and the callback is invoked.
*
* @param player Client index.
* @noreturn
* @error Invalid client index.
*/
native menu_cancel(player);

View File

@@ -0,0 +1,753 @@
/* NS module functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined NS_INC
#endinput
#endif
#define NS_INC
#if AMXX_VERSION_NUM >= 175
#pragma reqlib ns
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib ns
#endif
#else
#pragma library ns
#endif
#include <ns_const>
/**
* Called whenever the client's class is changed.
*
* @param id The index of the player who changed.
* @param newclass The class the client changed to. Check the class enum in ns_const.inc.
* @param oldclass The class the client changed from. Check the class enum in ns_const.inc.
* @noreturn
*/
forward client_changeclass(id, newclass, oldclass);
/**
* Called whenever the client builds a structure.
*
* @param idPlayer The player index who triggered the building.
* @param idStructure The structure index that was created.
* @param type The type of structure that was built (1 for marine, 2 for alien).
* @param impulse The impulse command that was issued to build this structure.
* @noreturn
*/
forward client_built(idPlayer, idStructure, type, impulse);
/**
* Tell whether or not the map is combat.
*
* @return 1 if combat, 0 otherwise.
*/
native ns_is_combat();
/**
* Returns the gameplay type for the currently active map.
* Refer to ns_const.inc's NSGameplay enum for details.
*
* @note The earliest this is guaranteed to be accurate is during plugin_init(). It needs
* the info_gameplay entity to be properly set within the map, or it will return "Unknown",
* or "Cantfind".
*
* @return Return the gameplay mode, as accurate as the module can tell.
*/
native NSGameplay:ns_get_gameplay();
/**
* Exact syntax as get_user_team, but should be more accurate.
*
* @param id Player id.
* @param buff Buffer to store team name in.
* @param len Buffer length.
* @return The pev_team setting for the player.
*/
native ns_get_user_team(id, buff[], len);
/**
* Send an NS-style popup message.
*
* @param target The client to receive the message. Set to 0 to send to everybody.
* @param szMsg The message to send, 180 characters max.
* @param ah Whether to only display the message on clients who have the cvar "cl_autohelp" set to 1.
* @noreturn
*/
native ns_popup(target, const szMsg[180], ah=0);
/**
* Sets a player model. Omit the second parameter to return to default
*
* @note The model does not revert on death, teamswitch, gestation, etc.
*
* @param id The player id to change.
* @param szModel The model to change to.
* @noreturn
*/
native ns_set_player_model(id, const szModel[]="");
/**
* Sets a player skin. Omit the second parameter to return to default
*
* @note The skin does not revert on death, teamswitch, gestation, etc.
*
* @param id The player id to change.
* @param skin The skin number to change to.
* @noreturn
*/
native ns_set_player_skin(id, skin=-1);
/**
* Sets a player body. Omit the second parameter to return to default
*
* @note The body does not revert on death, teamswitch, gestation, etc.
*
* @param id The player id to change.
* @param body The body number to change to.
* @noreturn
*/
native ns_set_player_body(id, body=-1);
/**
* Set this to modify the player's speed by a certain amount.
*
* @note The speed does not revert on death, teamswitch, gestation, etc.
*
* @param id The player id to change.
* @param speedchange The speed to modify the player speed by. Set to 0 to revert to default speed.
* @noreturn
*/
native ns_set_speedchange(id, speedchange=0);
/**
* Returns a client's current speed modifier.
*
* @param id The client id to check.
* @return The module's current speed modifier for the client.
*/
native ns_get_speedchange(id);
/**
* Returns a client's maxspeed before the speed change modifier is factored in.
*
* @param id The client id to check.
* @return The maxspeed for the client.
*/
native ns_get_maxspeed(id);
/* Returns whether or not this mask is set from the entity's iuser4 field. Use the "mask" enum for reference. */
native ns_get_mask(id,mask);
/* Sets or removes the mask from the entity's iuser4 field. Set "value" to 1 to turn the mask on, 0 to turn it off. */
native ns_set_mask(id,mask,value);
/* Returns built/unbuilt structures.
If:
builtOnly is 1 (default):
Only fully built structures are counted.
builtOnly is 0:
Any structure meeting the classname is counted.
Number is 0 (default):
The total number of matching structures is returned.
Number is any other value:
The index of the #th matching structure is returned.
*/
native ns_get_build(const classname[],builtOnly=1,Number=0);
/* Returns if the player has the weapon or not in their pev->weapons field.
set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. Or omit it to just return the value. */
native ns_has_weapon(id,weapon,setweapon=-1);
/* Gets spawn point for specified team (type).
If:
Team is equal to 0:
Ready room spawns are returned.
Team is greater than 0:
Spawns for the team are returned.
Number is equal to 0:
Total number of spawns is returned.
Number is greater than 0:
The location of the specified spawn is returned.
*/
native ns_get_spawn(team,number=0,Float:ret[3]);
/* Returns the class of the player. Look in the classes enum in ns_const.inc for the value's meaning. */
native ns_get_class(id);
/**
* Gets the player's jetpack fuel reserve.
*
* @param id The player to get fuel from.
* @return The amount of fuel in the player's reserve. (0.0 through 100.0)
*/
native Float:ns_get_jpfuel(id);
/**
* Sets the player's jetpack fuel reserve.
*
* @param id The player to set fuel.
* @param fuel The amount of fuel to set, as a percentage (0.0 through 100.0)
* @noreturn
*/
native ns_set_jpfuel(id, Float:fuel);
/**
* Adds to the player's jetpack fuel reserve.
*
* @param id The player to add fuel to.
* @param amount The amount of fuel to add, as a percentage (0.0 through 100.0)
* @return The new amount of fuel in the player's reserve. (0.0 through 100.0)
*/
native Float:ns_add_jpfuel(id, Float:amount);
/**
* Gets the player's energy percentage.
*
* @param id The player to get the energy from.
* @return The amount of energy the player has (0.0 through 100.0)
*/
native Float:ns_get_energy(id);
/**
* Sets the player's energy percentage.
*
* @param id The player to set the energy on.
* @param energy The amount of energy to set (0.0 through 100.0)
* @noreturn
*/
native ns_set_energy(id, Float:energy);
/**
* Adds to the player's energy percentage.
*
* @param id The player to add the energy to.
* @param amount The amount of energy to add to the player.
* @return The new amount of energy the player has (0.0 through 100.0)
*/
native Float:ns_add_energy(id, Float:amount);
/**
* Returns a player's resources.
*
* @note This is only for alien players.
* @param id The id of the player to check.
* @return Amount of resources this player has.
*/
native Float:ns_get_res(id);
/**
* Sets a player's resources.
*
* @note This is only for alien players.
* @param id The id of the player to set.
* @param res Amount of resources to set on this player.
* @noreturn
*/
native ns_set_res(id, Float:res);
/**
* Adds an amount of resources to the player.
*
* @note This is only for alien players.
* @param id The id of the player to add resources to.
* @param amount The amount to add to the player.
* @return The new amount of resources the player has.
*/
native Float:ns_add_res(id, Float:amount);
/**
* Returns the team's resources.
*
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
2 is aliens. In mvm, 1 is marine1, 2 is marine2)
* @return The amount of resources in this team's resource pool.
*/
native Float:ns_get_teamres(Team);
/**
* Sets the team's resources in the resource pool.
*
* @note If this is used on an alien team, the resources will be
* distributed between all of the players who need resources.
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
* 2 is aliens. In mvm, 1 is marine1, 2 is marine2)
* @param value The amount to set the resources to set to.
* @noreturn
*/
native ns_set_teamres(Team, Float:value);
/**
* Adds to the team's resources in the resource pool.
*
* @note If this is used on an alien team, the resources will be
* distributed between all of the players who need resources.
* @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines,
* 2 is aliens. In mvm, 1 is marine1, 2 is marine2)
* @param value The amount to set the resources to add to the pool
* @return The new amount of resources in the resource pool.
*/
native Float:ns_add_teamres(Team,Float:value);
/**
* Returns the player's experience.
*
* @note Combat only.
* @param id The player to get experience value from.
* @return The amount of experience this player has.
*/
native Float:ns_get_exp(id);
/**
* Sets the player's experience.
*
* @note Combat only.
* @param id The player to set experience value on.
* @param exp The amount of experience this player will have.
* @noreturn
*/
native ns_set_exp(id,Float:exp);
/**
* Adds to the player's experience.
*
* @note Combat only.
* @param id The player to add experience value to.
* @param value The amount of experience this player will receive.
* @return The new amount of experience this player has.
*/
native Float:ns_add_exp(id, Float:value);
/**
* Gets the player's points spent count in combat.
*
* @param id The player to check.
* @return The amount of points this player has spent.
*/
native ns_get_points(id);
/**
* Sets the player's points spent count in combat.
*
* @param id The player to set this on.
* @param points The amount to set this to.
* @noreturn
*/
native ns_set_points(id, points);
/**
* Adds to the player's points spent count in combat.
*
* @param id The player to add this to.
* @param value The value to add to the points spent.
* @return The new value of the points spent variable.
*/
native ns_add_points(id,points);
/**
* Gets the damage for this weapon.
*
* @note Use weapon index, not player index!
* @param idWeapon The entity index of the weapon to check.
* @return The damage this weapon does.
*/
native Float:ns_get_weap_dmg(idWeapon);
/**
* Sets the damage for this weapon.
*
* @note Use weapon index, not player index!
* @param idWeapon The entity index of the weapon to set.
* @param damage The damage to make this weapon cause.
* @noreturn
*/
native ns_set_weap_dmg(idWeapon, Float:damage);
/**
* Gets the maximum range for this weapon.
*
* @note Use weapon index, not player index!
* @param idWeapon The entity index of the weapon to check.
* @return The maximum range this weapon has.
*/
native Float:ns_get_weap_range(idWeapon);
/**
* Sets the maximum range for this weapon.
*
* @note Use weapon index, not player index!
* @param idWeapon The entity index of the weapon to set.
* @param range The maximum range this weapon will have.
* @noreturn
*/
native ns_set_weap_range(idWeapon, Float:range);
/**
* Gets the weapon's clip ammo.
*
* @note Use weapon index, not player index!
* @param idWeapon The weapon to get the clip ammo from.
* @return The amount of ammunition in the weapon's clip.
*/
native ns_get_weap_clip(idWeapon);
/**
* Sets the weapon's ammo in the clip.
*
* @note Use weapon index, not player index!
* @param idWeapon The weapon to set the clip ammo on.
* @param clipsize The amount of ammunition to set in the weapon's clip.
* @noreturn
*/
native ns_set_weap_clip(idWeapon, clipsize);
/**
* Gets the player's weapon reserve (backpack ammo) for the specified
* type of weapon.
*
* @note Use player index, not weapon index!
* @param id The player id to check ammo count on.
* @param weapon The weapon type to check ammo count for.
* @return The ammunition count in the player's reserve.
*/
native ns_get_weap_reserve(id,weapon);
/**
* Sets the player's weapon reserve (backpack ammo) for the specified
* type of weapon.
*
* @note Use player index, not weapon index!
* @param id The player id to set ammo count on.
* @param weapon The weapon type to set ammo count for.
* @param ammo The ammunition count to set.
* @noreturn
*/
native ns_set_weap_reserve(id,weapon,ammo);
/**
* Gets the player's score.
*
* @note The score from level is automatically factored into the scoreboard in combat.
* @param idPlayer The player to get the score for.
* @return The player's score.
*/
native ns_get_score(idPlayer);
/**
* Sets the player's score.
*
* @note The score from level is automatically factored into the scoreboard in combat.
* @param idPlayer The player to get the score for.
* @param score What to set the player's score as.
* @noreturn
*/
native ns_set_score(idPlayer, score);
/* Adds to a player's score
* Returns the new score on success
*/
native ns_add_score(idPlayer,score);
/* Gets a player's death count. */
native ns_get_deaths(idPlayer);
/* Sets a player's death count. */
native ns_set_deaths(idPlayer,numdeaths);
/* Adds to a player's death count
* Returns the new death count on success
*/
native ns_add_deaths(idPlayer,numdeaths);
/* Gets the index of the owner of a structure. -1 for no owner. */
native ns_get_struct_owner(idStructsure);
/* Sets the index of the owner of a structure. -1 for no owner. */
native ns_set_struct_owner(idStructure,indexOwner);
/* Gets the trait type tied to the hive. Look at the hivetrait enum for the values. */
native ns_get_hive_trait(idHive);
/* Sets the trait type tied to the hive. Look at the hivetrait enum for the values. */
native ns_set_hive_trait(idHive,trait);
/* Sets the players field of view, set "_fov" to 0.0 (or omit it) to return to normal. FOV change will persist until disconnect unless reset by a plugin */
native ns_set_fov(idPlayer,Float:_fov=0.0);
/**
* Give the player an item.
*
* @param id The player to give the item to.
* @param class The map-classname of the entity to give to the player.
* @noreturn
*/
native ns_give_item(id, const class[]);
/**
* Returns 1 if a player has the hive ability number.
* If ability is 0, it will return the number of active hives.
*
* @param idPlayer The player index to look up.
* @param ability The ability number to check, set to 0 to get number of active hives.
* @return If ability is != 0, returns 1 or 0 depending on if the client has the ability.
* If ability is 0, returns the number of active hives.
*/
native ns_get_hive_ability(idPlayer, ability=0);
/**
* Triggered whenever a client's pev->team changes.
*
* @param id The id of the client.
* @param newteam The team number of the new team.
* @param oldteam The team number of the old team.
* @noreturn
*/
forward client_changeteam(id, newteam, oldteam);
/**
* Triggered whenever a client's pev->deadflag changes from >0 to 0.
*
* @param id The id of the client.
* @noreturn
*/
forward client_spawn(id);
/**
* Calls NS's private damage routine on the victim entity.
*
* @deprecated
* @note This is provided for backwards compatibility with peachy's module.
* It is suggested to use hamsandwich for this action instead.
*
* @param IDVictim The victim that is taking the damage.
* @param IDInflictor The entity that is causing the damage (weapon, etc).
* @param IDAttacker The attacker who is triggering the damage (person shooting).
* @param Damage The amount of damage being done.
* @param DamageType The damage type being done (bitmask).
*/
native ns_takedamage(IDVictim, IDInflictor, IDAttacker, Float:Damage, DamageType);
/**
* Attempts to unstick a player.
*
* @param id Player to unstick.
* @param StartDistance Distance to start from the player to check for a new location.
* @param MaxAttempts How many attempts to try to find a new spot before giving up.
* @return 1 on success, 0 on cannot find a place to move player to,
* -1 on invalid state (stunned/webbed), -2 on invalid class (comm/egg)
* -3 if the player is dead or a spectator, -4 on invalid player,
* -5 if the player is not connected.
*/
native ns_unstick_player(id, StartDistance=32, MaxAttempts=128);
/**
* Whether or not there is a game in progress.
*
* @return true if a game is in progress, false otherwise.
*/
native bool:ns_round_in_progress();
/**
* Called at the approximate time that a round is started.
*
* @noreturn
*/
forward round_start();
/**
* Called immediately when a round ends
*
* @param roundtime The length of the round in seconds.
* @noreturn
*/
forward round_end(Float:roundtime);
forward map_reset(isload);
native ns_get_weapon(idPlayer,weaponid,&weapontype=0);
/* Returns the location name of the provided x/y position
* (z origin is ignored; can't have location over location)
* -
* Note that as of NS 3.2 beta 2, on the following maps
* the returned string should be passed through ns_lookup_title
* to be human readable:
* ns_bast, ns_hera, ns_nothing, ns_tanith,
* ns_nancy, ns_caged, ns_eclipse, ns_veil
*
* Passing the 5th parameter as non zero will auto look up
* the title if it exists.
*/
native ns_get_locationname(Float:x, Float:y, name[], len, titlelookup=0);
/* Looks up a key from titles.txt
* Returns -1 if the key is not found
* Otherwise it returns the length of the output
*/
native ns_lookup_title(const KeyName[], Output[], length);
/* Forces the structure to fully build
* Removes the ghost state from marine structures.
* Do not use this on hives! It wont work.
*/
native ns_build_structure(idStructure);
/* Forces the structure to begin recycling
* Passing an index other than a marine structure will
* have undefined results!
* -
* Note: This calls a private NS function!
* Be careful when using this!
*/
native ns_recycle(idStructure);
/* Forces the weldable to trigger
* Passing an index other than a weldable
* will have undefined results!
* -
* NS renames func_weldable to avhweldable
* at map load.
* -
* Note: This calls a private NS function!
* Be careful when using this!
*/
native ns_finish_weldable(idWeldable);
/* Gets the total time needed to weld this
* func_weldable shut.
* Note: NS renames "func_weldable"s to "avhweldable"s
* at run time!
*/
native Float:ns_get_weld_time(idWeldable);
/* Sets the total time needed to weld this
* func_weldable shut.
*/
native ns_set_weld_time(idWeldable,Float:value);
/* Adds to the weldable's time required to open.
* Returns the new required time on success.
* Note this native clamps the low value to 0.
*/
native Float:ns_add_weld_time(idWeldable,Float:value);
/* Gets the total time this func_weldable
* has been welded.
*/
native Float:ns_get_weld_done(idWeldable);
/* Sets the total time this func_weldable
* has been welded.
*/
native ns_set_weld_done(idWeldable,Float:value);
/* Adds to the total time this func_weldable
* has been welded. Returns the new value.
* Note this native clamps the low value to 0.0
*/
native Float:ns_add_weld_done(idWeldable,Float:value);
/* Gets/sets/adds to the energy pool of this observatory. */
native Float:ns_get_obs_energy(idObs);
native ns_set_obs_energy(idObs,Float:value);
native Float:ns_add_obs_energy(idObs,Float:value);
/**
* Removes an upgrade from the player's bought and active upgrade lists.
* This will not refund the points spent on the upgrade, nor will it
* immediately strip the upgrade if the player is alive. Rather, it will
* make it so the player no longer receives the upgrade on spawn.
*
* @note This only works in combat.
* @params idPlayer The player index to change upgrades for.
* @params ugprade The impulse number for the upgrade to strip.
* @return 2 for upgrade removed from player's bought and active list.
* 1 for upgrade removed from player's bought list only.
* 3 for upgrade removed from player's active list only (shouldn't happen, just incase.)
* 0 for the player didn't have the upgrade in either list.
*/
native ns_remove_upgrade(idPlayer, upgrade);
/**
* Particle system natives
* -
* The particle system emulates a map-based custom particle system.
* Familiarity with the keyvalues from the map-based particle systems
* is recommended! You will be lost otherwise!
* -
* prsearle's NSPEdit is also recommended for designing the systems:
* http://homepage.ntlworld.com/pr.searle/NSPSEdit/NSPSEdit.html
*/
/* Creates a handle to the a particle system to configure
* -
* Note! this is not a particle system you can pass to
* ns_fire_ps()!
*/
native RawPS:ns_create_ps();
/* Sets the name of the particle system.
* -
* This is used for things like ns_get_ps_id()
* and through calling another particle system
* through the "ps_to_gen" field
*/
native ns_set_ps_name(RawPS:system, const name[]);
/* Sets the sprite to use for the particle system
* -
* You do NOT have to precache the sprite, BUT
* the sprite must obviously be on the client to
* display.
*/
native ns_set_ps_sprite(RawPS:system, const sprite[]);
/* Finalizes the particle system. Do not configure it after this.
* A usable particle system handle is returned.
*/
native Particle:ns_spawn_ps(RawPS:system);
/* Draws a particle system at the given origin (and angles)
* Flags are the FEV_* defines from hlsdk_const.inc
* Only use handles returned by ns_spawn_ps or ns_get_ps_id here!
*/
native ns_fire_ps(Particle:system,const Float:origin[3],const Float:angles[3]={0.0,0.0,0.0}, flags=0);
/* Looks up a particle system by name
* Returns a usable particle system handle.
*/
native Particle:ns_get_ps_id(const Name[]);
/* The following are the parameters for configuring the
* particle system. Look through the fgd and NSPSEdit
* for details!
*/
native ns_set_ps_genrate(RawPS:system, genrate);
native ns_set_ps_genshape(RawPS:system, NSPS_GenShape:genshape);
native ns_set_ps_genshape_params(RawPS:system, const params[]);
native ns_set_ps_spriteframes(RawPS:system, spriteframes);
native ns_set_ps_numparticles(RawPS:system, numparticles);
native ns_set_ps_size(RawPS:system, Float:size);
native ns_set_ps_vel_params(RawPS:system, const params[]);
native ns_set_ps_vel_shape(RawPS:system, NSPS_VelShape:shape);
native ns_set_ps_sys_life(RawPS:system, Float:lifetime);
native ns_set_ps_particle_life(RawPS:system, Float:lifetime);
native ns_set_ps_rendermode(RawPS:system, NSPS_RenderMode:rendermode);
native ns_set_ps_to_gen(RawPS:system, const name[]);
native ns_set_ps_anim_speed(RawPS:system, speed);
native ns_set_ps_spawn_flags(RawPS:system, NSPS_Flags:flags);
native ns_set_ps_base_color(RawPS:system, const colors[]);
native ns_set_ps_scale(RawPS:system, Float:scale);
native ns_set_ps_max_alpha(RawPS:system, Float:maxalpha);

View File

@@ -0,0 +1,263 @@
/* NS2AMX Utility backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _ns2amx_included
#endinput
#endif
#define _ns2amx_included
#include <engine> // various engine calls
#include <fakemeta> // pev/engfunc/dllfunc/various calls which rely on engfunc/dllfunc
#include <ns> // ns specifics
stock is_entity(id)
return is_valid_ent(id);
/* The end of the native is buffered incase the plugin is including an NS_VERSION (no longer supported), ignore it */
stock get_build(classname[], value, number=0,any:...)
return ns_get_build(classname, value, number);
stock get_private_i(index, offset, linuxdiff=5)
return get_pdata_int(index, offset, linuxdiff);
stock set_private_i(index, offset, value, linuxdiff=5)
{
return set_pdata_int(index, offset, value, linuxdiff);
}
stock Float:get_private_f(index, offset, linuxdiff=5)
{
return get_pdata_float(index, offset, linuxdiff);
}
stock set_private_f(index, offset, Float:value, linuxdiff=5)
{
return set_pdata_float(index, offset, value, linuxdiff);
}
stock make_string(value[])
return engfunc(EngFunc_AllocString,value);
stock string(value, ret[])
{
new szString[128];
engfunc(EngFunc_SzFromIndex,value,szString,127);
copy(ret,127,szString);
}
stock gpgobals_time()
return floatround(halflife_time());
stock Float:get_range(ida, idb)
return entity_range(ida, idb);
stock supercede()
return 0;
stock register_clientkill()
return 0;
stock register_changelvl()
return 0;
stock register_msgblock(msgName[])
return set_msg_block(get_user_msgid(msgName), BLOCK_SET);
stock register_msgedit(msgName[], cmd[])
return register_message(get_user_msgid(msgName), cmd);
stock register_playback(event, cmd[])
return 0;
stock get_spawn(type, number=0, Float:ret[3])
return ns_get_spawn(type, number, ret);
stock has_weapon(index, weapon, setweapon=-1)
return ns_has_weapon(index, weapon, setweapon);
stock gpglobals_v(type, Float:ret[3])
{
new v_type=0;
switch (type)
{
case 1:
v_type = GL_v_forward;
case 2:
v_type = GL_v_right;
case 3:
v_type = GL_v_up;
}
if (!v_type)
return 0;
return get_global_vector(v_type, ret);
}
stock pev_i(_index,_field)
return pev(_index,_field);
stock set_pev_i(_index, _field, _val)
return set_pev(_index,_field,_val);
stock Float:pev_f(_index,_field)
{
new Float:f;
pev(_index,_field,f);
return f;
}
stock set_pev_f(_index,_field,Float:_val)
return set_pev(_index,_field,_val);
stock msg_args()
return get_msg_args();
stock Float:msg_loc(vec)
{
new Float:Ret[3];
get_msg_origin(Ret);
if (vec < 0 || vec > 3)
return float(0);
else
return Ret[vec];
return 0.0; // make compiler happy!
}
stock msg_dest()
return 0;
stock msg_type()
return 0;
stock msg_name()
return 0;
stock msg_set_s(number, value[])
return set_msg_arg_string(number, value);
stock msg_set_f(number, Float:value)
return set_msg_arg_float(number, get_msg_argtype(number), value);
stock msg_set_i(number, value)
return set_msg_arg_int(number, get_msg_argtype(number), value);
stock msg_data_type(value)
return get_msg_argtype(value);
stock msg_strdata(value)
return 0;
stock msg_data(value, ...)
{
return (0*value);
}
stock get_filename(szFile[], len=-1)
{
new name[16], version[16], author[16], status[16];
new res = get_plugin(0, szFile, len, name, 16, version, 16, author, 16, status, 16);
return res;
}
stock get_speedchange(id)
return ns_get_speedchange(id);
stock set_speedchange(id, speed)
return ns_set_speedchange(id,speed);
stock get_maxspeed(id)
return ns_get_maxspeed(id);
stock set_player_model(id, model[]="")
return ns_set_player_model(id, model);
stock set_player_skin(id, skin=-1)
return ns_set_player_skin(id, skin);
stock set_player_body(id, body=-1)
return ns_set_player_body(id, body);
stock ns2amx_version()
return 0;
stock set_kvhandled()
return 0;
stock ns2amx_getammo(id,Weapon)
return ns_get_weap_reserve(id, Weapon);
stock ns2amx_setammo(id,Weapon,Value)
return ns_set_weap_reserve(id, Weapon, Value);
stock ns2amx_giveitem(id,svClassname[])
return ns_give_item(id, svClassname);
stock ns2amx_moveto(idMoved,idDest)
{
new Float:origin[3];
entity_get_vector(idDest, EV_VEC_origin,origin);
entity_set_origin(idMoved, origin);
return 1;
}
/* Returns whether or not the player has the MASK_DIGESTING flag set. */
stock ns2amx_isdigesting(id)
return ns_get_mask(id,MASK_DIGESTING);
/* Returns total # of active hives. */
stock ns2amx_gethives()
return ns_get_build("team_hive",1);
/* Returns 1 if the two entities are within the given range. */
stock ns2amx_inrange(ida,idb,range)
{
if (entity_range(ida,idb) <= range)
return 1;
return 0;
}
stock ns2amx_nspopup(id,svMessage[190]) {
new szMessage[180];
copy(szMessage,179,svMessage);
return ns_popup(id, szMessage);
}
stock ns2amx_setres(id,value)
return ns_set_res(id, float(value));
stock ns2amx_getenergy(id)
return floatround(ns_get_energy(id));
stock ns2amx_setenergy(id,energy)
return ns_set_energy(id, float(energy));
stock ns2amx_getjpfuel(id)
return floatround(ns_get_jpfuel(id));
stock ns2amx_setjpfuel(id,fuel)
return ns_set_jpfuel(id, float(fuel));
stock get_mask(id,mask)
return ns_get_mask(id, mask);
stock set_mask(id,mask,value)
return ns_set_mask(id,mask,value);
stock get_special(id,mask)
{
if (pev(id,pev_iuser4) & mask)
return 1;
return 0;
}
stock get_res(id)
return floatround(ns_get_res(id));
stock get_class(id)
return ns_get_class(id);
stock is_combat()
return ns_is_combat();

View File

@@ -0,0 +1,192 @@
/* NS module constants
*
* by the AMX Mod X Development Team
* Most definitions graciously provided by Flayra
*
* This file is provided as is (no warranties).
*/
#if defined NS_CONST_INC
#endinput
#endif
#define NS_CONST_INC
enum NSGameplay
{
NSGame_CantTell, /**< It is too soon to tell (can't find avhgameplay
entity or it doesn't have private data) */
NSGame_MarineVAlien, /**< Marine vs Aliens (standard) gameplay */
NSGame_MarineVMarine, /**< Marine vs Marine */
NSGame_AlienVAlien, /**< Alien vs Alien */
NSGame_Unknown, /**< Can find the gameplay entity, but can't
determine gameplay type. */
};
// entity pev->iuser4 fields
enum {
MASK_NONE = 0,
MASK_SIGHTED = 1,
MASK_DETECTED = 2,
MASK_BUILDABLE = 4,
MASK_BASEBUILD0 = 8, // Base build slot #0
MASK_WEAPONS1 = 8, // Marine weapons 1
MASK_CARAPACE = 8, // Alien carapace
MASK_WEAPONS2 = 16, // Marines weapons 2
MASK_REGENERATION = 16, // Alien regeneration
MASK_BASEBUILD1 = 16, // Base build slot #1
MASK_WEAPONS3 = 32, // Marine weapons 3
MASK_REDEMPTION = 32, // Alien redemption
MASK_BASEBUILD2 = 32, // Base build slot #2
MASK_ARMOR1 = 64, // Marine armor 1
MASK_CELERITY = 64, // Alien celerity
MASK_BASEBUILD3 = 64, // Base build slot #3
MASK_ARMOR2 = 128, // Marine armor 2
MASK_ADRENALINE = 128, // Alien adrenaline
MASK_BASEBUILD4 = 128, // Base build slot #4
MASK_ARMOR3 = 256, // Marine armor 3
MASK_SILENCE = 256, // Alien silence
MASK_BASEBUILD5 = 256, // Base build slot #5
MASK_JETPACK = 512, // Marine jetpacks
MASK_CLOAKING = 512, // Alien cloaking
MASK_BASEBUILD6 = 512, // Base build slot #6
MASK_FOCUS = 1024, // Alien focus
MASK_MOTION = 1024, // Marine motion tracking
MASK_BASEBUILD7 = 1024, // Base build slot #7
MASK_SCENTOFFEAR = 2048, // Alien scent of fear
MASK_DEFENSE2 = 4096, // Defense level 2
MASK_DEFENSE3 = 8192, // Defense level 3
MASK_ELECTRICITY = 8192, // Electricy
MASK_MOVEMENT2 = 16384, // Movement level 2,
MASK_MOVEMENT3 = 32768, // Movement level 3
MASK_HEAVYARMOR = 32768, // Marine heavy armor
MASK_SENSORY2 = 65536, // Sensory level 2
MASK_SENSORY3 = 131072, // Sensory level 3
MASK_ALIEN_MOVEMENT = 262144, // Onos is charging
MASK_WALLSTICKING = 524288, // Flag for wall-sticking
MASK_PRIMALSCREAM = 1048576, // Alien is in range of active primal scream
MASK_UMBRA = 2097152, // In umbra
MASK_DIGESTING = 4194304, // When set on a visible player, player is digesting. When set on invisible player, player is being digested
MASK_RECYCLING = 8388608, // Building is recycling
MASK_TOPDOWN = 16777216, // Commander view
MASK_PLAYER_STUNNED = 33554432, // Player has been stunned by stomp
MASK_ENSNARED = 67108864, // Webbed
MASK_ALIEN_EMBRYO = 134217728, // Gestating
MASK_SELECTABLE = 268435456, // ???
MASK_PARASITED = 536870912, // Parasite flag
MASK_SENSORY_NEARBY = 1073741824 // Sensory chamber in range
};
enum {
CLASS_UNKNOWN = 0,
CLASS_SKULK,
CLASS_GORGE,
CLASS_LERK,
CLASS_FADE,
CLASS_ONOS,
CLASS_MARINE,
CLASS_JETPACK,
CLASS_HEAVY,
CLASS_COMMANDER,
CLASS_GESTATE,
CLASS_DEAD,
CLASS_NOTEAM
};
enum {
WEAPON_NONE = 0,
WEAPON_CLAWS,
WEAPON_SPIT,
WEAPON_SPORES,
WEAPON_SPIKE,
WEAPON_BITE,
WEAPON_BITE2,
WEAPON_SWIPE,
WEAPON_WEBSPINNER,
WEAPON_METABOLIZE,
WEAPON_PARASITE,
WEAPON_BLINK,
WEAPON_DIVINEWIND,
WEAPON_KNIFE,
WEAPON_PISTOL,
WEAPON_LMG,
WEAPON_SHOTGUN,
WEAPON_HMG,
WEAPON_WELDER,
WEAPON_MINE,
WEAPON_GRENADE_GUN,
WEAPON_LEAP,
WEAPON_CHARGE,
WEAPON_UMBRA,
WEAPON_PRIMALSCREAM,
WEAPON_BILEBOMB,
WEAPON_ACIDROCKET,
WEAPON_HEALINGSPRAY,
WEAPON_GRENADE,
WEAPON_STOMP,
WEAPON_DEVOUR,
WEAPON_MAX
};
enum {
HIVETRAIT_NONE = 0,
HIVETRAIT_DC = 92,
HIVETRAIT_SC = 93,
HIVETRAIT_MC = 94
};
enum NSPS_VelShape
{
NSPS_VS_POINT = 1,
NSPS_VS_BOX,
NSPS_VS_SPHERE,
NSPS_VS_BLOB
};
/* Genshape used in ns_set_ps_genshape
* NOTE: The following are in the ns.ps file but
* are not listed in the .fgd file. Use
* at your own risk!
* Line, Triangle, Plane, Cylinder,
* Cone, Disc, Rectangle and None
*/
enum NSPS_GenShape
{
NSPS_GS_POINT = 0,
NSPS_GS_LINE,
NSPS_GS_TRIANGLE,
NSPS_GS_PLANE,
NSPS_GS_BOX,
NSPS_GS_CYLINDER,
NSPS_GS_CONE,
NSPS_GS_BLOB,
NSPS_GS_DISC,
NSPS_GS_RECTANGLE,
NSPS_GS_NONE
};
enum NSPS_RenderMode
{
NSPS_R_NORMAL = 0,
NSPS_R_TRANSCOLOR,
NSPS_R_TRANSTEXTURE,
NSPS_R_GLOW,
NSPS_R_TRANSALPHA,
NSPS_R_ADDITIVE
};
enum NSPS_Flags
{
NSPS_FL_START_ON = 1,
NSPS_FL_PARTICLE_DENSITY = 2,
NSPS_FL_FADE_IN = 4,
NSPS_FL_FADE_OUT = 8,
NSPS_FL_USE_GRAVITY = 16,
NSPS_FL_USE_TRI = 32,
NSPS_FL_CONSTRAIN_PITCH = 128,
NSPS_FL_COLLIDE = 256,
NSPS_FL_HI_DETAIL = 512,
NSPS_FL_FACE_UP = 1024
};

View File

@@ -0,0 +1,61 @@
/* nVault functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _nvault_included
#endinput
#endif
#define _nvault_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib nvault
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib nvault
#endif
#else
#pragma library nvault
#endif
/* All timestamps are in UNIX epoch form. */
/* Opens a vault by name (such as "myvault")
* Returns a vault id, INVALID_HANDLE otherwise (-1)
*/
native nvault_open(const name[]);
/* Gets a vault value by returning an int
* setting a byref float or setting a string + maxlength
*/
native nvault_get(vault, const key[], {Float,_}:...);
/* Looks up a vault value for full information
* Returns 0 if the entry is not found
*/
native nvault_lookup(vault, const key[], value[], maxlen, &timestamp);
/* Sets a vault value (with current timestamp) */
native nvault_set(vault, const key[], const value[]);
/* Sets a permanent vault value (no timestamp) */
native nvault_pset(vault, const key[], const value[]);
/* Prunes the vault for entries that are within the given timestamps.
* This will not erase values set with pset
*/
native nvault_prune(vault, start, end);
/* Closes a vault */
native nvault_close(vault);
/* Removes a key from the vault */
native nvault_remove(vault, const key[]);
/* "Touches" a key to update its timestamp value.
* If stamp is -1 (default), it will use the current time.
* Like the unix command "touch," it will create an empty key
* if the value does not exist.
*/
native nvault_touch(vault, const key[], timestamp=-1);

View File

@@ -0,0 +1,134 @@
/* Regular Expression API
* (C)2004 by David "BAILOPAN" Anderson
* Licensed under the GNU General Public License.
* No warranties of any kind.
*/
#if defined _regex_included
#endinput
#endif
#define _regex_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib regex
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib regex
#endif
#else
#pragma library regex
#endif
enum Regex
{
REGEX_MATCH_FAIL = -2,
REGEX_PATTERN_FAIL,
REGEX_NO_MATCH,
REGEX_OK
};
/**
* Precompile a regular expression. Use this if you intend on using the
* same expression multiple times. Pass the regex handle returned here to
* regex_match_c to check for matches.
*
* @param pattern The regular expression pattern.
* @param errcode Error code encountered, if applicable.
* @param error Error message encountered, if applicable.
* @param maxLen Maximum string length of the error buffer.
* @param flags General flags for the regular expression.
* i = Ignore case
* m = Multilines (affects ^ and $ so that they match
* the start/end of a line rather than matching the
* start/end of the string).
* s = Single line (affects . so that it matches any character,
* even new line characters).
* x = Pattern extension (ignore whitespace and # comments).
*
* @return -1 on error in the pattern, > valid regex handle (> 0) on success.
*
* @note This handle is automatically freed on map change. However,
* if you are completely done with it before then, you should
* call regex_free on this handle.
*/
native Regex:regex_compile(const pattern[], &ret, error[], maxLen, const flags[]="");
/**
* Matches a string against a pre-compiled regular expression pattern.
*
*
* @param pattern The regular expression pattern.
* @param string The string to check.
* @param ret Error code, if applicable, or number of results on success.
*
* @return -2 = Matching error (error code is stored in ret)
* 0 = No match.
* >1 = Number of results.
*
* @note You should free the returned handle (with regex_free())
* when you are done with this pattern.
*
* @note Use the regex handle passed to this function to extract
* matches with regex_substr().
*/
native regex_match_c(const string[], Regex:pattern, &ret);
/**
* Matches a string against a regular expression pattern.
*
* @note If you intend on using the same regular expression pattern
* multiple times, consider using regex_compile and regex_match_c
* instead of making this function reparse the expression each time.
*
* @param string The string to check.
* @param pattern The regular expression pattern.
* @param ret Error code, or result state of the match.
* @param error Error message, if applicable.
* @param maxLen Maximum length of the error buffer.
* @param flags General flags for the regular expression.
* i = Ignore case
* m = Multilines (affects ^ and $ so that they match
* the start/end of a line rather than matching the
* start/end of the string).
* s = Single line (affects . so that it matches any character,
* even new line characters).
* x = Pattern extension (ignore whitespace and # comments).
*
* @return -2 = Matching error (error code is stored in ret)
* -1 = Error in pattern (error message and offset # in error and ret)
* 0 = No match.
* >1 = Handle for getting more information (via regex_substr)
*
* @note Flags only exist in amxmodx 1.8 and later.
* @note You should free the returned handle (with regex_free())
* when you are done extracting all of the substrings.
*/
native Regex:regex_match(const string[], const pattern[], &ret, error[], maxLen, const flags[] = "");
/**
* Returns a matched substring from a regex handle.
* Substring ids start at 0 and end at ret-1, where ret is from the corresponding
* regex_match or regex_match_c function call.
*
* @param id The regex handle to extract data from.
* @param str_id The index of the expression to get - starts at 0, and ends at ret - 1.
* @param buffer The buffer to set to the matching substring.
* @param maxLen The maximum string length of the buffer.
*
*/
native regex_substr(Regex:id, str_id, buffer[], maxLen);
/**
* Frees the memory associated with a regex result, and sets the handle to 0.
* This must be called on all results from regex_match() when you are done extracting
* the results with regex_substr().
* The results of regex_compile() (and subsequently, regex_match_c()) only need to be freed
* when you are done using the pattern.
*
*
* @param id The regex handle to free.
*
* @noreturn
*
* @note Do not use the handle again after freeing it!
*/
native regex_free(&Regex:id);

View File

@@ -0,0 +1,64 @@
/*
*
* AMX Mod X Module
* Basic Socket Functions
*
* Codebase from Ivan, -g-s-ivan@web.de (AMX 0.9.3)
* Modification by Olaf Reusch, kenterfie@hlsw.de (AMXX 0.16, AMX 0.96)
*
*/
#if defined _socket_included
#endinput
#endif
#define _socket_included
#if AMXX_VERSION_NUM >= 175
#pragma reqlib sockets
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib sockets
#endif
#else
#pragma library socket
#endif
// Use SOCKET_TCP for TCP Socket connections
#define SOCKET_TCP 1
// Use SOCKET_UDP for UDP Socket connections
#define SOCKET_UDP 2
/* Opens a new connection to hostname:port via protocol (either SOCKET_TCP or SOCKET_UDP),
* returns a socket (positive) or negative or zero on error.
* States of error:
* 0 - no error
* 1 - error while creating socket
* 2 - couldn't resolve hostname
* 3 - couldn't connect to given hostname:port
*/
native socket_open(const _hostname[], _port, _protocol = SOCKET_TCP, &_error);
/* Closes a Socket */
native socket_close(_socket);
/* Recieves Data to string with the given length */
native socket_recv(_socket, _data[], _length);
/* Sends data to the Socket */
native socket_send(_socket, const _data[], _length);
/* Same as socket_send but Data can contain null bytes */
native socket_send2(_socket, const _data[], _length);
/* 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).
* Use to check if new data is in your socket. */
native socket_change(_socket, _timeout=100000);

View File

@@ -0,0 +1,76 @@
/* Sorting functions.
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*
* All sort functions are based off the qsort() function from the
* C standard library, which uses the Quick Sort algorithm.
* For more info, see: http://linux.wku.edu/~lamonml/algor/sort/sort.html
*/
#if defined _sorting_included
#endinput
#endif
#define _sorting_included
enum SortMethod
{
Sort_Ascending = 0,
Sort_Descending = 1,
};
/**
* Basic sorting functions below.
*/
native SortIntegers(array[], array_size, SortMethod:order = Sort_Ascending);
native SortFloats(Float:array[], array_size, SortMethod:order = Sort_Ascending);
native SortStrings(array[][], num_strings, SortMethod:order = Sort_Ascending);
/**
* Custom sorting functions below.
*/
/**
* Sorts a custom 1D array. You must pass in a comparison function.
* The sorting algorithm then uses your comparison function to sort the data.
* The function is called in the following manner:
*
* public MySortFunc(elem1, elem2, const array[], const data[], data_size)
*
* elem1, elem2 - Current element pair being compared
* array[] - Array in its current mid-sorted state.
* data[] - Extra data array you passed to the sort func.
* data_size - Size of extra data you passed to the sort func.
*
* Your function should return:
* -1 if elem1 should go before elem2
* 0 if elem1 and elem2 are equal
* 1 if elem1 should go after elem2
* Note that the parameters after elem2 are all optional and you do not need to specify them.
*/
native SortCustom1D(array[], array_size, const comparefunc[], data[]="", data_size=0);
/**
* Sorts a custom 2D array.
* The sorting algorithm then uses your comparison function to sort the data.
* The function is called in the following manner:
*
* public MySortFunc(const elem1[], const elem2[], const array[], data[], data_size)
*
* elem1[], elem2[] - Current element array pairs being compared
* array[][] - Array in its currently being sorted state.
* data[] - Extra data array you passed to the sort func.
* data_size - Size of extra data you passed to the sort func.
*
* Your function should return:
* -1 if elem1[] should go before elem2[]
* 0 if elem1[] and elem2 are equal[]
* 1 if elem1[] should go after elem2[]
* Note that the parameters after elem2[] are all optional and you do not need to specify them.
*/
native SortCustom2D(array[][], array_size, const comparefunc[], data[]="", data_size=0);

View File

@@ -0,0 +1,383 @@
/**
* SQLX - Newer version of SQL stuff
*/
#if defined _sqlx_included
#endinput
#endif
#define _sqlx_included
//eh..
#define SQL_NumRows SQL_NumResults
#if AMXX_VERSION_NUM >= 175
#pragma reqclass sqlx
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib sqlx mysql
#endif //!defined AMXMODX_NOAUTOLOAD
#endif //AMXX_VERSION_NUM
enum Handle
{
Empty_Handle
};
/**
* Creates a connection information tuple.
* This tuple must be passed into connection routines.
* Freeing the tuple is not necessary, but is a good idea if you
* create many of them. You can cache these handles globally.
* !!NOTE!! I have seen most people think that this connects to the DB.
* Nowhere does it say this, and in fact it does not. It only caches
* the connection information, the host/user/pass/etc.
*
* The optional timeout parameter specifies how long connections should wait before
* giving up. If 0, the default (which is undefined) is used.
*
*/
native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[], timeout=0);
/**
* Frees an SQL handle.
* The handle can be to anything (tuple, connection, query, results, etc).
* If you free a database connection, it closes the connection as well.
*/
native SQL_FreeHandle(Handle:h);
/**
* Opens a database connection.
* Returns an SQL handle, which must be freed.
* Returns Empty_Handle on failure.
*/
native Handle:SQL_Connect(Handle:cn_tuple, &errcode, error[], maxlength);
/**
* Prepares a query.
* The query must always be freed.
* This does not actually do the query!
*/
native Handle:SQL_PrepareQuery(Handle:db, const fmt[], any:...);
/**
* Back-quotes characters in a string for database querying.
* Note: The buffer's maximum size should be 2*strlen(string) to catch
* all scenarios.
*
* @param db Database handle for localization, or Empty_Handle
* for when a handle is not available.
* @param buffer Buffer to copy to.
* @param buflen Maximum size of the buffer.
* @param string String to backquote (should not overlap buffer).
* @return Length of new string, or -1 on failure.
*/
native SQL_QuoteString(Handle:db, buffer[], buflen, const string[]);
/**
* Back-quotes characters in a string for database querying.
* Note: The buffer's maximum size should be 2*strlen(string) to catch
* all scenarios.
*
* @param db Database handle for localization, or Empty_Handle
* for when a handle is not available.
* @param buffer Buffer to copy to.
* @param buflen Maximum size of the buffer.
* @param fmt Format of string to backquote (should not overlap buffer).
* @param ... Format arguments.
* @return Length of new string, or -1 on failure.
*/
native SQL_QuoteStringFmt(Handle:db, buffer[], buflen, const fmt[], any:...);
#define TQUERY_CONNECT_FAILED -2
#define TQUERY_QUERY_FAILED -1
#define TQUERY_SUCCESS 0
/**
* Prepares and executes a threaded query.
* This will not interrupt gameplay in the event of a poor/lossed
* connection, however, the interface is more complicated and
* asynchronous. Furthermore, a new connection/disconnection is
* made for each query to simplify driver support.
* The handler should look like:
*
* @param failstate - One of the three TQUERY_ defines.
* @param query - Handle to the query, do not free it.
* @param error - An error message, if any.
* @param errnum - An error code, if any.
* @param data - Data array you passed in.
* @param size - Size of the data array you passed in.
* @param queuetime - Amount of gametime that passed while the query was resolving.
*
* public QueryHandler(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
*
* Note! The handle you pass in is a DB Tuple, NOT an active connection!
* Note! The handle does not need to be freed.
* Also note: This function is not guaranteed to be in another thread
* (in fact - it's not). You're seeing data "after the fact",
* and as such to execute another query you should run
* SQL_ThreadQuery again with new data.
*/
native SQL_ThreadQuery(Handle:db_tuple, const handler[], const query[], const data[]="", dataSize=0);
/**
* Executes a query.
* Returns 1 if the query succeeded.
* Returns 0 if the query failed.
* NOTE: You can call this multiple times as long as its parent
* connection is kept open. Each time the result set will be freed
* from the previous call.
*/
native SQL_Execute(Handle:query);
/**
* Gets information about a failed query error.
* Returns the errorcode.
*/
native SQL_QueryError(Handle:query, error[], maxlength);
/**
* Returns 1 if there are more results to be read,
* 0 otherwise.
*/
native SQL_MoreResults(Handle:query);
/**
* Tells whether a specific column in the current row
* is NULL or not.
*/
native SQL_IsNull(Handle:query, column);
/**
* Retrieves the current result.
* A successful query starts at the first result,
* so you should not call SQL_NextRow() first.
* Passing no extra params - return int
* Passing one extra param - return float in 1st extra arg
* Passing two extra params - return string in 1st arg, max length in 2nd
* Example:
* new num = SQL_ReadResult(query, 0)
* new Float:num2
* new str[32]
* SQL_ReadResult(query, 1, num2)
* SQL_ReadResult(query, 2, str, 31)
*/
native SQL_ReadResult(Handle:query, column, {Float,_}:...);
/**
* Advances to the next result (return value should be ignored).
*/
native SQL_NextRow(Handle:query);
/**
* Returns the number of affected rows.
*/
native SQL_AffectedRows(Handle:query);
/**
* Returns the number of rows total.
*/
native SQL_NumResults(Handle:query);
/**
* Returns the number of columns total.
*/
native SQL_NumColumns(Handle:query);
/**
* Returns the name of a column.
* Errors on a bad field number.
*/
native SQL_FieldNumToName(Handle:query, num, name[], maxlength);
/**
* Returns the number of a named column, or -1 if not found.
*/
native SQL_FieldNameToNum(Handle:query, const name[]);
/**
* Rewinds a result set to the first row.
*/
native SQL_Rewind(Handle:query);
/**
* Returns the insert id of the last INSERT query.
* Returns 0 otherwise.
*/
native SQL_GetInsertId(Handle:query);
/**
* Returns which driver this plugin is currently bound to.
*/
native SQL_GetAffinity(driver[], maxlen);
/**
* Sets driver affinity. You can use this to force a particular
* driver implementation. This will automatically change all SQL
* natives in your plugin to be "bound" to the module in question.
* If no such module is found, it will return 0. This isn't necessarily bad -
* the user might have typed the wrong driver. Unless your plugin is built
* to handle different driver types at once, you should let this error pass.
* Note, that using this while you have open handles to another database
* type will cause problems. I.e., you cannot open a handle, switch
* affinity, then close the handle with a different driver.
* Switching affinity is an O(n*m) operation, where n is the number of
* SQL natives and m is the number of used natives in total.
* Intuitive programmers will note that this causes problems for threaded queries.
* You will have to either force your script to work under one affinity, or to
* pack the affinity type into the query data, check it against the current, then
* set the new affinity if necessary. Then, restore the old for safety.
*/
native SQL_SetAffinity(const driver[]);
/**
* Returns the original query string that a query handle used.
*/
native SQL_GetQueryString(Handle:query, buffer[], maxlength);
/**
* For queries which return multiple result sets, this advances to the next
* result set if one is available. Otherwise, the current result set is
* destroyed and will no longer be accessible.
*
* This function will always return false on SQLite, and when using threaded
* queries in MySQL. Nonetheless, it has the same effect of removing the last
* result set.
*
* @param query Query Handle.
* @return True on success, false on failure.
*/
native bool:SQL_NextResultSet(Handle:query);
/**
* This function can be used to find out if a table in a Sqlite database exists.
* (updated for newer API)
*/
stock bool:sqlite_TableExists(Handle:db, const table[])
{
new Handle:query = SQL_PrepareQuery(
db,
"SELECT name FROM sqlite_master WHERE type='table' AND name='%s' LIMIT 1;",
table);
if (!SQL_Execute(query) || !SQL_NumResults(query))
{
SQL_FreeHandle(query);
return false;
}
SQL_FreeHandle(query);
return true;
}
/**
* Use this for executing a query where you don't care about the result.
* Returns 0 on failure, 1 on success
*/
stock SQL_SimpleQuery(Handle:db, const query[], error[]="", maxlength=0, &rows=0)
{
new Handle:hQuery = SQL_PrepareQuery(db, "%s", query);
if (!SQL_Execute(hQuery))
{
SQL_QueryError(hQuery, error, maxlength);
SQL_FreeHandle(hQuery);
return 0;
}
rows = SQL_NumResults(hQuery);
SQL_FreeHandle(hQuery);
return 1;
}
/**
* Use this for executing a query where you don't care about the result.
* Returns 0 on failure, 1 on success
*/
stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], any:...)
{
static query_buf[2048];
vformat(query_buf, 2047, fmt, 6);
new Handle:hQuery = SQL_PrepareQuery(db, "%s", query_buf);
if (!SQL_Execute(hQuery))
{
SQL_QueryError(hQuery, error, maxlength);
SQL_FreeHandle(hQuery);
return 0;
}
rows = SQL_NumResults(hQuery);
SQL_FreeHandle(hQuery);
return 1;
}
/**
* Use this for executing a query and not caring about the error.
* Returns -1 on error, >=0 on success (with number of affected rows)
*/
stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], any:...)
{
static query[4096];
new Handle:hQuery;
new ret;
vformat(query, sizeof(query)-1, queryfmt, 3);
hQuery = SQL_PrepareQuery(db, "%s", query);
if (SQL_Execute(hQuery))
{
ret = SQL_AffectedRows(hQuery);
} else {
ret = -1;
}
SQL_FreeHandle(hQuery);
return ret;
}
stock Handle:SQL_MakeStdTuple(timeout = 0)
{
static host[64], user[32], pass[32], db[128];
static get_type[12], set_type[12];
get_cvar_string("amx_sql_host", host, 63);
get_cvar_string("amx_sql_user", user, 31);
get_cvar_string("amx_sql_pass", pass, 31);
get_cvar_string("amx_sql_type", set_type, 11);
get_cvar_string("amx_sql_db", db, 127);
SQL_GetAffinity(get_type, 12);
if (!equali(get_type, set_type))
{
if (!SQL_SetAffinity(set_type))
{
log_amx("Failed to set affinity from %s to %s.", get_type, set_type);
}
}
return SQL_MakeDbTuple(host, user, pass, db, timeout);
}

View File

@@ -0,0 +1,269 @@
/* Strings manipulation
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _string_included
#endinput
#endif
#define _string_included
#define charsmax(%1) (sizeof(%1)-1)
/* Checks if source contains string. On success function
* returns position in source, on failure returns -1. */
native contain(const source[],const string[]);
/* Checks if source contains string with case ignoring. On success function
* returns position in source, on failure returns -1. */
native containi(const source[],const string[]);
/* Replaces given string to another in given text. */
native replace(text[], len, const what[], const with[]);
/* Adds one string to another. Last parameter different from 0, specifies
* how many chars we want to add. Function returns number of all merged chars. */
native add(dest[],len,const src[],max=0);
/* Fills string with given format and parameters.
* Function returns number of copied chars.
* Example: format(dest,"Hello %s. You are %d years old","Tom",17).
* If any of your input buffers overlap with the destination buffer,
* format() falls back to a "copy-back" version as of 1.65. This is
* slower, so you should using a source string that is the same as
* the destination.
*/
native format(output[] ,len ,const format[] , any:...);
/* Same as format(), except does not perform a "copy back" check.
* This means formatex() is faster, but DOES NOT ALLOW this type
* of call:
* formatex(buffer, len, "%s", buffer)
* formatex(buffer, len, buffer, buffer)
* formatex(buffer, len, "%s", buffer[5])
* This is because the output is directly stored into "buffer",
* rather than copied back at the end.
*/
native formatex(output[] ,len ,const format[] , any:...);
/* Replacement for format_args. Much faster and %L compatible.
* This works exactly like vsnprintf() from C.
* You must pass in the output buffer and its size,
* the string to format, and the number of the FIRST variable
* argument parameter. For example, for:
* function (a, b, c, ...)
* You would pass 4 (a is 1, b is 2, c is 3, et cetera).
* There is no vformatex().
*/
native vformat(buffer[], len, const fmt[], vararg);
/*
* Same as vformat(), except works in normal style dynamic natives.
* Instead of passing the format arg string, you can only pass the
* actual format argument number itself.
* If you pass 0, it will read the format string from an optional
* fifth parameter.
*/
native vdformat(buffer[], len, fmt_arg, vararg, ...);
/* Gets parameters from function as formated string. */
native format_args(output[] ,len ,pos = 0);
/* Converts number to string. */
native num_to_str(num,string[],len);
/* Returns converted string to number. */
native str_to_num(const string[]);
/* Converts float to string. */
native float_to_str(Float:fl, string[], len);
/* Parses a float. */
native Float:str_to_float(const string[]);
/* Checks if two strings equal. If len var is set
* then there are only c chars comapred. */
native equal(const a[],const b[],c=0);
/* Checks if two strings equal with case ignoring.
* If len var is set then there are only c chars comapred. */
native equali(const a[],const b[],c=0);
/* Copies one string to another. By len var
* you may specify max. number of chars to copy. */
native copy(dest[],len,const src[]);
/* Copies one string to another until char ch is found.
* By len var you may specify max. number of chars to copy. */
native copyc(dest[],len,const src[],ch);
/* Sets string with given character. */
native setc(src[],len,ch);
/* Gets parameters from text.
* Example: to split text: "^"This is^" the best year",
* call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
* and you will get: "This is", "the", "best", "year"
* Function returns number of parsed parameters. */
native parse(const text[], ... );
/* Breaks a string into two halves, by token.
See strbreak() for doing this with parameters.
Example:
str1[] = This *is*some text
strtok(str1, left, 24, right, 24, '*')
left will be "This "
Right will be "is*some text"
If you use trimSpaces, all spaces are trimmed from Left.
*/
native strtok(const text[], Left[], leftLen, Right[], rightLen, token=' ', trimSpaces=0);
/* Gets parameters from text one at a time
It breaks a string into the first parameter and the rest of the parameters
(A left side and right side of the string)
Example: to split text: "^"This is^" the best year",
strbreak(text, arg1, len1, arg2, len2)
arg1="This is", arg2=the best year
This is more useful than parse() because you can keep breaking
any number of arguments */
native strbreak(const text[], Left[], leftLen, Right[], rightLen);
/* Strips spaces from the beginning and end of a string. */
native trim(text[]);
/* Converts all chars in string to lower case. */
native strtolower(string[]);
/* Converts all chars in string to upper case. */
native strtoupper(string[]);
/* Make a string's first character uppercase */
native ucfirst(string[]);
/* Returns true when value is digit. */
native isdigit(ch);
/* Returns true when value is letter. */
native isalpha(ch);
/* Returns true when value is space. */
native isspace(ch);
/* Returns true when value is letter or digit. */
native isalnum(ch);
/* Concatenates a string. Maxlength is the total buffer of the destination. */
native strcat(dest[], const source[], maxlength);
/* Finds a string in another string. Returns -1 if not found. */
native strfind(const string[], const sub[], ignorecase=0, pos=0);
/* Compares two strings with the C function strcmp(). Returns 0 on equal. */
native strcmp(const string1[], const string2[], ignorecase=0);
/* Tests if given string contains only digits. Also, returns false for zero-length strings. */
stock bool:is_str_num(const sString[])
{
new i = 0;
while (sString[i] && isdigit(sString[i]))
++i;
return sString[i] == 0 && i != 0;
}
/* It is basically strbreak but you have a delimiter that is more than one character in length.
You pass the Input string, the Left output, the max length of the left output,
the right output , the max right length, and then the delimiter string.
By Suicid3
*/
stock split(const szInput[], szLeft[], pL_Max, szRight[], pR_Max, const szDelim[])
{
new iEnd = contain(szInput, szDelim);
new iStart = iEnd + strlen(szDelim);
//If delimiter isnt in Input just split the string at max lengths
if (iEnd == -1)
{
iStart = copy(szLeft, pL_Max, szInput);
copy(szRight, pR_Max, szInput[iStart]);
return;
}
//If delimter is in Input then split at input for max lengths
if (pL_Max >= iEnd)
copy(szLeft, iEnd, szInput);
else
copy(szLeft, pL_Max, szInput);
copy(szRight, pR_Max, szInput[iStart]);
return;
}
/* Removes a path from szFilePath leaving the name of the file in szFile for a pMax length. */
stock remove_filepath(const szFilePath[], szFile[], pMax)
{
new len = strlen(szFilePath);
while ((--len >= 0) && (szFilePath[len] != '/') && (szFilePath[len] != '\')) { }
copy(szFile, pMax, szFilePath[len + 1]);
return;
}
/* Replaces a contained string iteratively.
* This ensures that no infinite replacements will take place by
* intelligently moving to the next string position each iteration.
*/
stock replace_all(string[], len, const what[], const with[])
{
new pos = 0;
if ((pos = contain(string, what)) == -1)
{
return 0;
}
new total = 0;
new with_len = strlen(with);
new diff = strlen(what) - with_len;
new total_len = strlen(string);
new temp_pos = 0;
while (replace(string[pos], len - pos, what, with) != 0)
{
total++;
/* jump to position after replacement */
pos += with_len;
/* update cached length of string */
total_len -= diff;
/* will the next call be operating on the last character? */
if (pos >= total_len)
{
break;
}
/* find the next position from our offset */
temp_pos = contain(string[pos], what);
/* if it's invalid, we're done */
if (temp_pos == -1)
{
break;
}
/* otherwise, reposition and update counters */
pos += temp_pos;
}
return total;
}

View File

@@ -0,0 +1,16 @@
/* AMX Mod X constants
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _svnversion_included
#endinput
#endif
#define _svnversion_included
#define AMXX_VERSION 1.82
#define AMXX_VERSION_NUM 182
stock const AMXX_VERSION_STR[] = "1.8.2";

View File

@@ -0,0 +1,16 @@
/* AMX Mod X constants
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _svnversion_included
#endinput
#endif
#define _svnversion_included
#define AMXX_VERSION $PMAJOR$.$PMINOR$$PREVISION$
#define AMXX_VERSION_NUM $PMAJOR$$PMINOR$$PREVISION$
stock const AMXX_VERSION_STR[] = "$PMAJOR$.$PMINOR$.$PREVISION$";

View File

@@ -0,0 +1,78 @@
/* TFCX const
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _tfcconst_included
#endinput
#endif
#define _tfcconst_included
#define TFCMAX_WEAPONS 37
enum {
TFC_AMMO_SHELLS = 0,
TFC_AMMO_BULLETS,
TFC_AMMO_CELLS,
TFC_AMMO_ROCKETS,
TFC_AMMO_NADE1,
TFC_AMMO_NADE2,
};
enum {
TFC_WPN_NONE = 0,
TFC_WPN_TIMER,//TFC_WPN_UNK1,
TFC_WPN_SENTRYGUN,//TFC_WPN_UNK2,
TFC_WPN_MEDIKIT,
TFC_WPN_SPANNER,
TFC_WPN_AXE,
TFC_WPN_SNIPERRIFLE,
TFC_WPN_AUTORIFLE,
TFC_WPN_SHOTGUN,
TFC_WPN_SUPERSHOTGUN,
TFC_WPN_NG,
TFC_WPN_SUPERNG,
TFC_WPN_GL,
TFC_WPN_FLAMETHROWER,
TFC_WPN_RPG,
TFC_WPN_IC,
TFC_WPN_FLAMES,//TFC_WPN_UNK16,
TFC_WPN_AC,
TFC_WPN_UNK18,
TFC_WPN_UNK19,
TFC_WPN_TRANQ,
TFC_WPN_RAILGUN,
TFC_WPN_PL,
TFC_WPN_KNIFE,
TFC_WPN_CALTROP, // 24
TFC_WPN_CONCUSSIONGRENADE,
TFC_WPN_NORMALGRENADE,
TFC_WPN_NAILGRENADE,
TFC_WPN_MIRVGRENADE,
TFC_WPN_NAPALMGRENADE,
TFC_WPN_GASGRENADE,
TFC_WPN_EMPGRENADE,
};
enum {
TFC_PC_SCOUT = 1,
TFC_PC_SNIPER,
TFC_PC_SOLDIER,
TFC_PC_DEMOMAN,
TFC_PC_MEDIC,
TFC_PC_HWGUY,
TFC_PC_PYRO,
TFC_PC_SPY,
TFC_PC_ENGENEER,
TFC_PC_CIVILIAN,
};
#define TFC_PC_ENGINEER TFC_PC_ENGENEER
// Goal items
#define TFC_GOALITEM_BLUE (1 << 17)
#define TFC_GOALITEM_RED (1 << 18)
#define TFC_GOALITEM_YELLOW (1 << 24)
#define TFC_GOALITEM_GREEN (1 << 25)

View File

@@ -0,0 +1,55 @@
/* TFCX Stats functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _tfcstats_included
#endinput
#endif
#define _tfcstats_included
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[8],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len);
/* Returns number of all entries in stats. */
native get_statsnum();

View File

@@ -0,0 +1,145 @@
/* tfcX functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _tfcx_included
#endinput
#endif
#define _tfcx_included
#include <tfcconst>
#include <tfcstats>
#if AMXX_VERSION_NUM >= 175
#pragma reqclass xstats
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib xstats tfcx
#endif
#else
#pragma library tfcx
#endif
/************* Shared Natives Start ********************************/
/* Forward types */
enum {
XMF_DAMAGE = 0,
XMF_DEATH,
};
/* Use this function to register forwards */
native register_statsfwd( ftype );
/* Function is called after player to player attacks ,
* if players were damaged by teammate TA is set to 1 */
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer,victim,wpnindex,hitplace,TK);
/* Custom Weapon Support */
/* function will return index of new weapon */
native custom_weapon_add( const wpnname[],melee = 0,const logname[]="" );
/* Function will pass damage done by this custom weapon to stats module and other plugins */
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
/* Function will pass info about custom weapon shot to stats module */
native custom_weapon_shot( weapon,index ); // weapon id , player id
/* function will return 1 if true */
native xmod_is_melee_wpn(wpnindex);
/* Returns weapon name. */
native xmod_get_wpnname(wpnindex,name[],len);
/* Returns weapon logname. */
native xmod_get_wpnlogname(wpnindex,name[],len);
/* Returns weapons array size */
native xmod_get_maxweapons();
/* Returns stats array size ex. 8 in TS , 9 in DoD */
native xmod_get_stats_size();
/* Returns 1 if true */
native xmod_is_custom_wpn(wpnindex);
/************* Shared Natives End ********************************/
stock tfc_isgrenade( weapon ){
switch( weapon )
{
case TFC_WPN_CALTROP,
TFC_WPN_CONCUSSIONGRENADE,
TFC_WPN_NORMALGRENADE,
TFC_WPN_NAILGRENADE,
TFC_WPN_MIRVGRENADE,
TFC_WPN_NAPALMGRENADE,
TFC_WPN_GASGRENADE,
TFC_WPN_EMPGRENADE:
return 1;
default: return 0;
}
return 0;
}
native tfc_userkill( index );
/* Use this function to set private data offsets if needed
Default offsets:
timer: 932
sentrygun: 83
from AssKicR
shells: 53
bullets: 55
cells: 57
rockets: 59
nade1: 14
nade2: 15
*/
native tfc_setpddata(timer,sentrygun,shells,bullets,cells,rockets,nade1,nade2);
/*********************************************************************/
native tfc_setmodel(index, const Model[], const Skin[]);
native tfc_clearmodel(index);
/* Get amount of ammo in backpack on a user for a specific weapon */
/* Ammo Types in tfcconst.inc */
native tfc_getbammo(index, ammo);
/* Set amount of ammo in backpack on a user for a specific weapon */
native tfc_setbammo(index, ammo, value);
/* Returns amount of ammo in weapon's clip (backpack) */
/* Weapons list in tfcconst.inc */
native tfc_getweaponbammo(index, weapon);
/* Sets amount of ammo in weapon's clip (backpack) */
native tfc_setweaponbammo(index, weapon, value);
/* Returns amount of ammo in weapon's clip */
/* Index must be weapon's entity index */
native tfc_getweaponammo(index);
/* Sets amount of ammo in weapon's clip */
/* Index must be weapon's entity index */
native tfc_setweaponammo(index, value);
/* Returns 1 if user is carrying a goal item such as a flag or a keycard, else 0.
* Team is by reference parameter that will be set to owning team(s) of the goal item.
* Use the TFC_GOALITEM_* constants to determine the owning team.
*/
native tfc_get_user_goalitem(index, &team);
/* Returns 1 if the player is a spy and is currently feigning death */
native tfc_is_user_feigning(index);
/* Returns 1 if the two teams are allies, 0 otherwise
* Note: Team must be 1->4
* Team 0 will always return 0
* Any other team will result in an error
*/
native tfc_is_team_ally(TeamA,TeamB);

View File

@@ -0,0 +1,90 @@
/* Time specific functions
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _time_included
#endinput
#endif
#define _time_included
/* Time unit types for get_time_length() */
enum
{
timeunit_seconds = 0,
timeunit_minutes,
timeunit_hours,
timeunit_days,
timeunit_weeks,
};
// seconds are in each time unit
#define SECONDS_IN_MINUTE 60
#define SECONDS_IN_HOUR 3600
#define SECONDS_IN_DAY 86400
#define SECONDS_IN_WEEK 604800
/* Stock by Brad */
stock get_time_length(id, unitCnt, type, output[], outputLen)
{
// IMPORTANT: You must add register_dictionary("time.txt") in plugin_init()
// id: The player whose language the length should be translated to (or 0 for server language).
// unitCnt: The number of time units you want translated into verbose text.
// type: The type of unit (i.e. seconds, minutes, hours, days, weeks) that you are passing in.
// output: The variable you want the verbose text to be placed in.
// outputLen: The length of the output variable.
if (unitCnt > 0)
{
// determine the number of each time unit there are
new weekCnt = 0, dayCnt = 0, hourCnt = 0, minuteCnt = 0, secondCnt = 0;
switch (type)
{
case timeunit_seconds: secondCnt = unitCnt;
case timeunit_minutes: secondCnt = unitCnt * SECONDS_IN_MINUTE;
case timeunit_hours: secondCnt = unitCnt * SECONDS_IN_HOUR;
case timeunit_days: secondCnt = unitCnt * SECONDS_IN_DAY;
case timeunit_weeks: secondCnt = unitCnt * SECONDS_IN_WEEK;
}
weekCnt = secondCnt / SECONDS_IN_WEEK;
secondCnt -= (weekCnt * SECONDS_IN_WEEK);
dayCnt = secondCnt / SECONDS_IN_DAY;
secondCnt -= (dayCnt * SECONDS_IN_DAY);
hourCnt = secondCnt / SECONDS_IN_HOUR;
secondCnt -= (hourCnt * SECONDS_IN_HOUR);
minuteCnt = secondCnt / SECONDS_IN_MINUTE;
secondCnt -= (minuteCnt * SECONDS_IN_MINUTE);
// translate the unit counts into verbose text
new maxElementIdx = -1;
new timeElement[5][33];
if (weekCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", weekCnt, id, (weekCnt == 1) ? "TIME_ELEMENT_WEEK" : "TIME_ELEMENT_WEEKS");
if (dayCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", dayCnt, id, (dayCnt == 1) ? "TIME_ELEMENT_DAY" : "TIME_ELEMENT_DAYS");
if (hourCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", hourCnt, id, (hourCnt == 1) ? "TIME_ELEMENT_HOUR" : "TIME_ELEMENT_HOURS");
if (minuteCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", minuteCnt, id, (minuteCnt == 1) ? "TIME_ELEMENT_MINUTE" : "TIME_ELEMENT_MINUTES");
if (secondCnt > 0)
format(timeElement[++maxElementIdx], 32, "%i %L", secondCnt, id, (secondCnt == 1) ? "TIME_ELEMENT_SECOND" : "TIME_ELEMENT_SECONDS");
switch(maxElementIdx)
{
case 0: format(output, outputLen, "%s", timeElement[0]);
case 1: format(output, outputLen, "%s %L %s", timeElement[0], id, "TIME_ELEMENT_AND", timeElement[1]);
case 2: format(output, outputLen, "%s, %s %L %s", timeElement[0], timeElement[1], id, "TIME_ELEMENT_AND", timeElement[2]);
case 3: format(output, outputLen, "%s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], id, "TIME_ELEMENT_AND", timeElement[3]);
case 4: format(output, outputLen, "%s, %s, %s, %s %L %s", timeElement[0], timeElement[1], timeElement[2], timeElement[3], id, "TIME_ELEMENT_AND", timeElement[4]);
}
}
}

View File

@@ -0,0 +1,146 @@
/* TSFUN constants
*
* (c) 2005, Suzuka
* This file is provided as is (no warranties).
*/
#if defined _tsconst_included
#endinput
#endif
#define _tsconst_included
#define TSMAX_WEAPONS 44 // 37 + throwing knife + brekable + 5 custom weapon slots
#define TSPWUP_NONE 0
#define TSPWUP_RANDOM 0
#define TSPWUP_SLOWMO 1
#define TSPWUP_INFAMMO 2
#define TSPWUP_KUNGFU 4
#define TSPWUP_SLOWPAUSE 8
#define TSPWUP_DFIRERATE 16
#define TSPWUP_GRENADE 32
#define TSPWUP_HEALTH 64
#define TSPWUP_ARMOR 128
#define TSPWUP_SUPERJUMP 256
#define TSITEM_KUNGFU 1<<0
#define TSITEM_SUPERJUMP 1<<1
#define TSKF_STUNTKILL 1<<0
#define TSKF_SLIDINGKILL 1<<1
#define TSKF_DOUBLEKILL 1<<2
#define TSKF_ISSPEC 1<<3
#define TSKF_KILLEDSPEC 1<<4
#define TSA_SILENCER 1
#define TSA_LASERSIGHT 2
#define TSA_FLASHLIGHT 4
#define TSA_SCOPE 8
#define TSMSG_NORMAL 6
#define TSMSG_WAITING 11
#define TSMSG_DEAD 1
#define TSMSG_KILLER 2
#define TSMSG_DEMOLITION 3
#define TSMSG_SPECIALIST 4
#define TSMSG_UNSTOPPABLE 5
#define TSMSG_THEONE 10
#define STUNT_NONE 0
#define STUNT_DUCK 1
#define STUNT_ROLL 2
#define STUNT_DIVE 3
#define STUNT_GETUP 4
#define STUNT_FLIP 5
enum {
TSW_GLOCK18 = 1,
TSW_UNK1,
TSW_UZI,
TSW_M3,
TSW_M4A1,
TSW_MP5SD,
TSW_MP5K,
TSW_ABERETTAS,
TSW_MK23,
TSW_AMK23,
TSW_USAS,
TSW_DEAGLE,
TSW_AK47,
TSW_57,
TSW_AUG,
TSW_AUZI,
TSW_TMP,
TSW_M82A1,
TSW_MP7,
TSW_SPAS,
TSW_GCOLTS,
TSW_GLOCK20,
TSW_UMP,
TSW_M61GRENADE,
TSW_CKNIFE,
TSW_MOSSBERG,
TSW_M16A4,
TSW_MK1,
TSW_C4,
TSW_A57,
TSW_RBULL,
TSW_M60E3,
TSW_SAWED_OFF,
TSW_KATANA,
TSW_SKNIFE,
TSW_KUNG_FU,
TSW_TKNIFE,
};
/*
valid tsweaponid in TS_GiveWeapon
1: "Glock 18"
3: "Mini Uzi"
4: "Benelli M3"
5: "M4A1"
6: "MP5SD"
7: "MP5K"
8: "Akimbo Berettas"
9: "Socom Mk23"
11: "Usas12"
12: "Desert Eagle"
13: "Ak47"
14: "FiveSeven"
15: "Steyr Aug"
17: "Steyr Tmp"
18: "Barrett M82"
19: "HK Pdw"
20: "Spas12"
21: "Akimbo colts"
22: "Glock 20"
23: "Mac10"
25: "Combat Knife"
26: "Mossberg 500"
27: "M16A4"
28: "Ruger Mk1"
24: "M61 Grenade"
29: "C4"
31: "Raging Bull"
32: "M60"
33: "Sawed off"
34: "Katana"
35: "Seal Knife"
valid pwuptype in TS_GivePwUp
0: "Random"
1: "Slow Motion"
2: "Infinite Clip"
4: "Kung Fu"
8: "Slow Pause"
16: "Double Firerate"
32: "Grenade"
64: "Health"
128: "Armor"
256: "Superjump"
*/

View File

@@ -0,0 +1,154 @@
/* TSFUN
*
* (c) 2005-2006, AMX Mod X Dev Team
* This file is provided as is (no warranties).
*/
#if defined _tsxfun_included
#endinput
#endif
#define _tsxfun_included
#include <tsx>
#include <tsconst>
/************* Shared Natives Start ********************************/
/* Forward types */
enum {
XMF_DAMAGE = 0,
XMF_DEATH,
};
#if AMXX_VERSION_NUM >= 175
#pragma reqlib tsfun
#if !defined AMXMODX_NOAUTOLOAD
#pragma loadlib tsfun
#endif
#else
#pragma library tsfun
#endif
/************* Shared Natives End ********************************/
/* Function is called just before a kung foo attack is done,
* damage and time length may be altered with natives.
* Return PLUGIN_HANDLED to stop attack.
* UNAVAILABLE IN 1.70
*/
forward Melee_Attack(id,Float:time,Float:damage,UNAVAILABLE);
// Returns when someone stunts, after they do it.
//UNAVAILABLE IN 1.70
forward client_stunt(id,stunttype,UNAVAILABLE);
/* Function is called when powerups are ran,
* Returns value of powerup. Use TSPWUP_*'s
* to find exactly which one it is.
* UNAVAILABLE IN 1.70
*/
forward client_powerup(id,powerup,UNAVAILABLE);
/* weapon logname to weapon name convertion */
native ts_wpnlogtoname(const logname[],name[],len);
/* weapon logname to weapon index convertion */
native ts_wpnlogtoid(const logname[]);
//UNAVAILABLE IN 1.70
//native Float:ts_getusertime( index ); //!
//native ts_setusertime( index, Float:time ); //!
native ts_getusercash( index );
native ts_setusercash( index, money );
native ts_getuserslots( index );
native ts_setuserslots( index, slots );
native ts_getuserstate( index );
native ts_getuserwpn( index,&clip=0,&ammo=0,&mode=0,&extra=0 );
native ts_getuserspace( index );
native ts_getuserkillflags(killer);
native ts_getkillingstreak( index );
native ts_getuserlastfrag( index );
native ts_giveweapon( index,weapon,clips,extra );
native ts_getuserpwup( index );
stock ts_has_slowmo(id) return (ts_getuserpwup(id) &TSPWUP_SLOWMO);
stock ts_has_infammo(id) return (ts_getuserpwup(id) &TSPWUP_INFAMMO);
stock ts_has_slowpause(id) return (ts_getuserpwup(id) &TSPWUP_SLOWPAUSE);
stock ts_has_dfirerate(id) return (ts_getuserpwup(id) &TSPWUP_DFIRERATE);
stock ts_has_grenade(id) return (ts_getuserpwup(id) &TSPWUP_GRENADE);
stock ts_has_health(id) return (ts_getuserpwup(id) &TSPWUP_HEALTH);
stock ts_has_armor(id) return (ts_getuserpwup(id) &TSPWUP_ARMOR);
/* Function will create pwup entity and return its index (pwupent) */
native ts_createpwup( pwup );
native ts_givepwup( index,pwupent );
native ts_setpddata( knifeoffset );
// Alters a fu attack. Use with fu forward
// UNAVAILABLE IN 1.70
// native ts_set_fuattack(id,Float:time,Float:damage); //!
// Changes board message
native ts_set_message(id,message);
// Gets the message board message
native ts_get_message(id);
stock ts_is_normal(id)
{
new msg = ts_get_message(id);
if( (msg > 11) || (msg > 6 && msg < 10) ) return 1;
return 0;
}
stock ts_is_waiting(id) return (ts_get_message(id) == TSMSG_WAITING);
stock ts_is_dead(id) return (ts_get_message(id) == TSMSG_DEAD);
stock ts_is_killer(id) return (ts_get_message(id) == TSMSG_KILLER);
stock ts_is_demolition(id) return (ts_get_message(id) == TSMSG_DEMOLITION);
stock ts_is_specialist(id) return (ts_get_message(id) == TSMSG_SPECIALIST);
stock ts_is_unstoppable(id) return (ts_get_message(id) == TSMSG_UNSTOPPABLE);
stock ts_is_theone(id) return (ts_get_message(id) == TSMSG_THEONE);
// Return one on true, 0 on false
// UNAVAILABLE IN 1.70
native ts_has_superjump(id); //!
native ts_has_fupowerup(id); //!
native ts_is_in_slowmo(id);
// Get and set consecutive frags
//UNAVAILABLE IN 1.70
//native ts_get_cons_frags(id);
//native ts_set_cons_frags(id,num);
// Set to see cool bullet trails. Only id will see them.
native ts_set_bullettrail(id,yesorno);
// Sets fake versions of slow mo and slow pause. Use ts_set_speed for more options.
native ts_set_fakeslowmo(id,Float:time);
native ts_set_fakeslowpause(id,Float:time);
/* Sets speed artificially. 1.0 is default, Go into fractions and decimals for slower
* and put in higher numbers for higher speeds. Aura is how far things around you are effected
* Time is the time until it wears off. 0.0 for speed will freeze people. Do not use negatives. */
native ts_set_speed(id,Float:speed,Float:auradist,Float:time);
/* Sets physics speed artificially. Things like sparks and sounds will be effected.
* Any negative number will render all physics paused. */
native ts_set_physics_speed(id,Float:speed);
// Returns 0 if no powerup is running. Returns the powerup type otherwise.
native ts_is_running_powerup(id);
// Highly experimental command which overrides powerup types.
// Use if a powerup is already running, or if a powerup is not running.
// Safe to use in powerup forward.
native ts_force_run_powerup(id,PWUP_TYPE);

View File

@@ -0,0 +1,58 @@
/* TSXMod Stats functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _tsstats_included
#endinput
#endif
#define _tsstats_included
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets life (from spawn to spawn) stats from given weapon index.*/
native get_user_wlstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[8],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len);
/* Returns number of all entries in stats. */
native get_statsnum();

View File

@@ -0,0 +1,85 @@
/* TSXMod functions
*
* (c) 2004, SidLuke
* This file is provided as is (no warranties).
*/
#if defined _tsx_included
#endinput
#endif
#define _tsx_included
#include <tsstats>
#if AMXX_VERSION_NUM >= 175
#pragma reqclass xstats
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib xstats tsx
#endif
#else
#pragma library tsx
#endif
/************* Shared Natives Start ********************************/
/* Forward types */
enum {
XMF_DAMAGE = 0,
XMF_DEATH,
};
/* Use this function to register forwards
* DEPRECATED
*/
native register_statsfwd( ftype );
/* Function is called after player to player attacks ,
* if players were damaged by teammate TA is set to 1 */
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);
/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer,victim,wpnindex,hitplace,TK);
/* Custom Weapon Support */
/* function will return index of new weapon */
native custom_weapon_add( const wpnname[],melee = 0,const logname[]="" );
/* Function will pass damage done by this custom weapon to stats module and other plugins */
native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 );
/* Function will pass info about custom weapon shot to stats module */
native custom_weapon_shot( weapon,index ); // weapon id , player id
/* function will return 1 if true */
native xmod_is_melee_wpn(wpnindex);
/* Returns weapon name. */
native xmod_get_wpnname(wpnindex,name[],len);
/* Returns weapon logname. */
native xmod_get_wpnlogname(wpnindex,name[],len);
/* Returns weapons array size */
native xmod_get_maxweapons();
/* Returns stats array size ex. 8 in TS , 9 in DoD */
native xmod_get_stats_size();
/* Returns 1 if true */
native xmod_is_custom_wpn(wpnindex);
/************* Shared Natives End ********************************/
/* Spawns a Weapon */
stock ts_weaponspawn(const weaponid[], const duration[], const extraclip[], const spawnflags[], const Float:Origin[3])
{
new ent = create_entity("ts_groundweapon");
DispatchKeyValue(ent, "tsweaponid", weaponid);
DispatchKeyValue(ent, "wduration", duration);
DispatchKeyValue(ent, "wextraclip", extraclip);
DispatchKeyValue(ent, "spawnflags", spawnflags);
DispatchSpawn(ent);
entity_set_origin(ent, Origin);
return PLUGIN_HANDLED;
}

View File

@@ -0,0 +1,26 @@
/* Vault functions
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _vault_included
#endinput
#endif
#define _vault_included
/* Reads a data from given key.
* If len is set to zero then get_vaultdata
* returns value as an number. */
native get_vaultdata(const key[], data[] = "", len = 0);
/* Sets a data under given key. */
native set_vaultdata(const key[], const data[] = "");
/* Removes a key from vault.*/
native remove_vaultdata(const key[]);
/* Checks if a key exists in the vault.*/
native vaultdata_exists(const key[]);

View File

@@ -0,0 +1,59 @@
/* Vector functions (now part of Core)
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _corevector_included
#endinput
#endif
#define _corevector_included
/* Used for angle_vector() */
#define ANGLEVECTOR_FORWARD 1
#define ANGLEVECTOR_RIGHT 2
#define ANGLEVECTOR_UP 3
/* Returns distance between two vectors. */
native get_distance(const origin1[3], const origin2[3]);
/* Gets distance between two origins (float). */
native Float:get_distance_f(const Float:Origin1[3], const Float:Origin2[3]);
/* Gives you a velocity in the direction a player is looking, iVelocity is the multiplier. */
native velocity_by_aim(iIndex, iVelocity, Float:vRetValue[3]);
/* Changes a vector into an angle vector. */
native vector_to_angle(const Float:fVector[3], Float:vReturn[3]);
/* Changes an angle vector into a vector. */
native angle_vector(const Float:vector[3], FRU, Float:ret[3]);
/* Gets the length of a vector (float[3]). */
native Float:vector_length(const Float:vVector[3]);
/* Gets the distance between 2 vectors (float[3]). */
native Float:vector_distance(const Float:vVector[3], const Float:vVector2[3]);
/* Changes an integer vec to a floating vec
* This is not a for loop because that's slower
*/
stock IVecFVec(const IVec[3], Float:FVec[3])
{
FVec[0] = float(IVec[0]);
FVec[1] = float(IVec[1]);
FVec[2] = float(IVec[2]);
return 1;
}
/* Changes a float vec to an integer vec */
stock FVecIVec(const Float:FVec[3], IVec[3])
{
IVec[0] = floatround(FVec[0]);
IVec[1] = floatround(FVec[1]);
IVec[2] = floatround(FVec[2]);
return 1;
}

File diff suppressed because it is too large Load Diff