From ec5f944c03c17fb969057a0016a9fe4413b0d953 Mon Sep 17 00:00:00 2001 From: Lukasz Wlasinksi Date: Thu, 16 Sep 2004 18:15:20 +0000 Subject: [PATCH] added csx module --- dlls/csx/plugins/include/csstats.inc | 61 + dlls/csx/plugins/include/csx.inc | 59 + dlls/csx/plugins/miscstats.sma | 515 +++++ dlls/csx/plugins/statsx.sma | 1561 +++++++++++++ dlls/csx/source/CMisc.cpp | 299 +++ dlls/csx/source/CMisc.h | 115 + dlls/csx/source/CRank.cpp | 308 +++ dlls/csx/source/CRank.h | 122 ++ dlls/csx/source/Makefile | 102 + dlls/csx/source/amxxmodule.cpp | 3004 ++++++++++++++++++++++++++ dlls/csx/source/amxxmodule.h | 2181 +++++++++++++++++++ dlls/csx/source/compile.bat | 6 + dlls/csx/source/meta_api.cpp | 368 ++++ dlls/csx/source/moduleconfig.h | 462 ++++ dlls/csx/source/msvc/csx.dsp | 149 ++ dlls/csx/source/msvc/csx.dsw | 29 + dlls/csx/source/rank.cpp | 447 ++++ dlls/csx/source/rank.h | 104 + dlls/csx/source/usermsg.cpp | 203 ++ 19 files changed, 10095 insertions(+) create mode 100755 dlls/csx/plugins/include/csstats.inc create mode 100755 dlls/csx/plugins/include/csx.inc create mode 100755 dlls/csx/plugins/miscstats.sma create mode 100755 dlls/csx/plugins/statsx.sma create mode 100755 dlls/csx/source/CMisc.cpp create mode 100755 dlls/csx/source/CMisc.h create mode 100755 dlls/csx/source/CRank.cpp create mode 100755 dlls/csx/source/CRank.h create mode 100755 dlls/csx/source/Makefile create mode 100755 dlls/csx/source/amxxmodule.cpp create mode 100755 dlls/csx/source/amxxmodule.h create mode 100755 dlls/csx/source/compile.bat create mode 100755 dlls/csx/source/meta_api.cpp create mode 100755 dlls/csx/source/moduleconfig.h create mode 100755 dlls/csx/source/msvc/csx.dsp create mode 100755 dlls/csx/source/msvc/csx.dsw create mode 100755 dlls/csx/source/rank.cpp create mode 100755 dlls/csx/source/rank.h create mode 100755 dlls/csx/source/usermsg.cpp diff --git a/dlls/csx/plugins/include/csstats.inc b/dlls/csx/plugins/include/csstats.inc new file mode 100755 index 00000000..b14adf20 --- /dev/null +++ b/dlls/csx/plugins/include/csstats.inc @@ -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); + +/* 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]); diff --git a/dlls/csx/plugins/include/csx.inc b/dlls/csx/plugins/include/csx.inc new file mode 100755 index 00000000..508d81a7 --- /dev/null +++ b/dlls/csx/plugins/include/csx.inc @@ -0,0 +1,59 @@ +/* CSX functions + * + * (c) 2004, SidLuke + * This file is provided as is (no warranties). + */ + +#if defined _csx_included + #endinput +#endif +#define _csx_included + +#include + +/* +* 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( wpnname[],melee = 0,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 ********************************/ \ No newline at end of file diff --git a/dlls/csx/plugins/miscstats.sma b/dlls/csx/plugins/miscstats.sma new file mode 100755 index 00000000..4bd7c338 --- /dev/null +++ b/dlls/csx/plugins/miscstats.sma @@ -0,0 +1,515 @@ +/* AMX Mod X +* Misc. Stats Plugin +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* This file is part of AMX Mod X. +* +* +* 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. +*/ + +#include + +public MultiKill +public MultiKillSound +public BombPlanting +public BombDefusing +public BombPlanted +public BombDefused +public BombFailed +public BombPickUp +public BombDrop +public BombCountVoice +public BombCountDef +public BombReached +public ItalyBonusKill +public EnemyRemaining +public LastMan +public KnifeKill +public KnifeKillSound +public GrenadeKill +public GrenadeSuicide +public HeadShotKill +public HeadShotKillSound +public RoundCounterSound +public RoundCounter +public KillingStreak +public KillingStreakSound +public DoubleKill +public DoubleKillSound +public PlayerName +public FirstBloodSound + +new g_streakKills[33][2] +new g_multiKills[33][2] +new g_C4Timer +new g_Defusing +new g_Planter +new Float:g_LastOmg +new g_LastAnnounce +new g_roundCount +new Float:g_doubleKill +new g_doubleKillId +new g_friend[33] +new g_firstBlood + +new g_MultiKillMsg[7][] = { + "Multi-Kill! %s^n%L %d kills (%d hs)", + "Ultra-Kill!!! %s^n%L %d kills (%d hs)", + "%s IS ON A KILLING SPREE!!!^n%L %d kills (%d hs)", + "RAMPAGE!!! %s^n%L %d kills (%d hs)" , + "%s IS UNSTOPPABLE!!!^n%L %d kills (%d hs)", + "%s IS A MONSTER!^n%L %d kills (%d hs)", + "%s IS GODLIKE!!!!^n%L %d kills (%d hs)" +} +new g_Sounds[7][] = { + "multikill", + "ultrakill", + "killingspree", + "rampage", + "unstoppable", + "monsterkill", + "godlike" +} +new g_KillingMsg[7][] = { + "%s: Multi-Kill!", + "%s: Ultra-Kill!!!", + "%s IS ON A KILLING SPREE!!!", + "%s: RAMPAGE!!!", + "%s IS UNSTOPPABLE!!!", + "%s IS A MONSTER!", + "%s IS GODLIKE!!!" +} +new g_KinfeMsg[4][] = { + "KNIFE_MSG_1", + "KNIFE_MSG_2", + "KNIFE_MSG_3", + "KNIFE_MSG_4" +} +new g_LastMessages[4][] = { + "LAST_MSG_1", + "LAST_MSG_2", + "LAST_MSG_3", + "LAST_MSG_4" +} +new g_HeMessages[4][] = { + "HE_MSG_1", + "HE_MSG_2", + "HE_MSG_3", + "HE_MSG_4" +} +new g_SHeMessages[4][] = { + "SHE_MSG_1", + "SHE_MSG_2", + "SHE_MSG_3", + "SHE_MSG_4" +} +new g_HeadShots[7][] = { + "HS_MSG_1", + "HS_MSG_2", + "HS_MSG_3", + "HS_MSG_4", + "HS_MSG_5", + "HS_MSG_6", + "HS_MSG_7" +} + +new g_teamsNames[2][] = { + "TERRORIST", + "CT" +} + +public plugin_init() { + register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("miscstats.txt") + register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w") + register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw") + register_event("RoundTime", "eNewRound", "bc") + register_event("StatusValue","setTeam","be","1=1") + register_event("StatusValue","showStatus","be","1=2","2!0") + register_event("StatusValue","hideStatus","be","1=1","2=0") + new mapname[32] + get_mapname(mapname,31) + if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)) { + register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") + register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") + register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") + } + else if ( equali( mapname , "cs_italy" ) ) { + register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" ) + register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" ) + } +} + +public plugin_cfg() { + new g_addStast[] = "amx_statscfg add ^"%s^" %s" + server_cmd(g_addStast,"MultiKill","MultiKill") + server_cmd(g_addStast,"MultiKillSound","MultiKillSound") + server_cmd(g_addStast,"Bomb Planting","BombPlanting") + server_cmd(g_addStast,"Bomb Defusing","BombDefusing") + server_cmd(g_addStast,"Bomb Planted","BombPlanted") + server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused") + server_cmd(g_addStast,"Bomb Def. Failure","BombFailed") + server_cmd(g_addStast,"Bomb PickUp","BombPickUp") + server_cmd(g_addStast,"Bomb Drop","BombDrop") + server_cmd(g_addStast,"Bomb Count Down","BombCountVoice") + server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef") + server_cmd(g_addStast,"Bomb Site Reached","BombReached") + server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill") + server_cmd(g_addStast,"Last Man","LastMan") + server_cmd(g_addStast,"Knife Kill","KnifeKill") + server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") + server_cmd(g_addStast,"Grenade Kill","GrenadeKill") + server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide") + server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") + server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound") + server_cmd(g_addStast,"Round Counter","RoundCounter") + server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound") + server_cmd(g_addStast,"Killing Streak","KillingStreak") + server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") + server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining") + server_cmd(g_addStast,"Double Kill","DoubleKill") + server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") + server_cmd(g_addStast,"Player Name","PlayerName") + server_cmd(g_addStast,"First Blood Sound","FirstBloodSound") +} + +public client_putinserver(id) + g_multiKills[id] = g_streakKills[ id ] = { 0 , 0 } + +public client_death(killer,victim,wpnindex,hitplace,TK) { + + new headshot = ( hitplace == HIT_HEAD ) ? 1:0 + + if ( g_firstBlood ) { + g_firstBlood = 0 + if ( FirstBloodSound ) client_cmd(0,"spk misc/firstblood") + } + if ( (KillingStreak || KillingStreakSound) && !TK ) { + g_streakKills[ killer ][ 0 ]++ + g_streakKills[ killer ][ 1 ] = 0 + g_streakKills[ victim ][ 1 ]++ + g_streakKills[ victim ][ 0 ] = 0 + new a = g_streakKills[ killer ][ 0 ] - 3 + if ( (a > -1) && !( a % 2 ) ) { + new name[32] + get_user_name( killer , name , 31 ) + if ( (a >>= 1) > 6 ) a = 6 + if ( KillingStreak ){ + set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3) + show_hudmessage(0,g_KillingMsg[ a ], name ) + } + if ( KillingStreakSound ) client_cmd( 0, "spk misc/%s", g_Sounds[ a ] ) + } + } + if ( MultiKill || MultiKillSound ) { + if (killer && !TK ) { + g_multiKills[killer][0]++ + g_multiKills[killer][1] += headshot + new param[2] + param[0] = killer + param[1] = g_multiKills[killer][0] + set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) + } + } + if ( EnemyRemaining ) { + new ppl[32], pplnum + new team = get_user_team( victim ) - 1 + get_players(ppl,pplnum,"e", g_teamsNames[1 - team] ) + if (pplnum) { + new eppl[32], epplnum + get_players(eppl,epplnum,"ae",g_teamsNames[team]) + if (epplnum) { + new message[128] + format(message,127,"%d %s%s Remaining...",epplnum,g_teamsNames[team],(epplnum==1)?"":"S" ) + set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3) + for(new a=0; a 1 ) { + g_LastAnnounce = cts[0] + oposite = tsnum + team = 0 + } + else if ( tsnum == 1 && ctsnum > 1 ) { + g_LastAnnounce = ts[0] + oposite = ctsnum + team = 1 + } + if (g_LastAnnounce) { + new name[32] + get_user_name(g_LastAnnounce,name,31) + set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) + show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %L",name, + get_user_health(g_LastAnnounce),oposite, + g_teamsNames[team],(oposite==1)?"":"S",LANG_PLAYER,g_LastMessages[ random_num(0,3) ] ) + client_cmd(g_LastAnnounce,"spk misc/oneandonly") + } + } + } + + if ( wpnindex == 29 && ( KnifeKill || KnifeKillSound ) ) { + if ( KnifeKill ) { + new killer_name[32],victim_name[32] + get_user_name(killer,killer_name,31) + get_user_name(victim,victim_name,31) + set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(0,"%L",LANG_PLAYER,g_KinfeMsg[ random_num(0,3) ],killer_name,victim_name) + } + if ( KnifeKillSound ) client_cmd(0,"spk misc/humiliation") + } + + if ( wpnindex == 4 && (GrenadeKill || GrenadeSuicide) ) { + new killer_name[32],victim_name[32] + get_user_name(killer,killer_name,32) + get_user_name(victim,victim_name,32) + set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) + if ( killer != victim ) { + if ( GrenadeKill ) show_hudmessage(0,"%L",LANG_PLAYER,g_HeMessages[ random_num(0,3)],killer_name,victim_name) + } + else if ( GrenadeSuicide ) show_hudmessage(0,"%L",LANG_PLAYER,g_SHeMessages[ random_num(0,3) ],victim_name) + } + if ( headshot && (HeadShotKill || HeadShotKillSound) ) { + if ( HeadShotKill ) { + new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum + get_weaponname(wpnindex,weapon_name,31) + get_user_name(killer,killer_name,31) + get_user_name(victim,victim_name,31) + + get_players(players,pnum,"c") + for (new i=0;i= 2 ) + client_print( i , print_chat , "* %L", i, "KILLED_ROW", g_streakKills[ i ][ 0 ] ) + else if ( g_streakKills[ i ][ 1 ] >= 2 ) + client_print( i , print_chat , "* %L", i, "DIED_ROUNDS", g_streakKills[ i ][ 1 ] ) + } + } + } + +public eRestart() { + eEndRound() + g_roundCount = 0 + g_firstBlood = 1 +} + +public eEndRound() { + g_C4Timer = -2 + g_LastOmg = 0.0 + remove_task(8038) + g_LastAnnounce = 0 +} + +public checkKills(param[]) { + new id = param[0] + new a = param[1] + if (a == g_multiKills[id][0]) { + a -= 3 + if ( a > -1 ) { + if ( MultiKill ) { + new name[32] + get_user_name(id,name,31) + set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) + if ( a > 6 ) a = 6 + show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],g_multiKills[id][1]) + } + if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a]) + } + g_multiKills[id] = { 0,0 } + } +} + +public chickenKill() + if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" ) + +public radioKill() { + if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" ) +} + +announceEvent( id, message[] ) { + new name[32] + get_user_name(id, name , 31) + set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) + show_hudmessage(0,"%L",LANG_PLAYER,message,name) +} + +public eGotBomb(id) { + if ( BombReached && read_data(1)==2 && g_LastOmg 0) { + if (BombCountVoice) { + if (g_C4Timer == 30 || g_C4Timer == 20) { + new temp[48] + num_to_word(g_C4Timer,temp,47) + client_cmd(0,"spk ^"vox/%s seconds until explosion^"",temp) + } + else if (g_C4Timer < 11) { + new temp[48] + num_to_word(g_C4Timer,temp,47) + client_cmd(0,"spk ^"vox/%s^"",temp) + } + } + if (BombCountDef && g_Defusing) client_print(g_Defusing,print_center,"%d",g_C4Timer) + } + else remove_task(8038) +} + +public bomb_planted(planter){ + g_Defusing = 0 + if ( g_C4Timer != -2 ) { + if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" ) + g_C4Timer = get_cvar_num("mp_c4timer") - 2 + set_task(1.0,"bombTimer",8038,"",0,"b") + } +} + +public bomb_planting(planter) + if (BombPlanting) announceEvent(planter, "PLANT_BOMB" ) + +public bomb_defusing(defuser){ + if (BombDefusing) announceEvent(defuser, "DEFUSING_BOMB" ) + g_Defusing = defuser +} + +public bomb_defused(defuser){ + if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" ) +} + +public bomb_explode(planter,defuser){ + if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" ) +} + +public eBombPickUp(id){ + if (BombPickUp) announceEvent(id , "PICKED_BOMB") + g_Planter = id +} + +public eBombDrop() + if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") + +public plugin_modules() +{ + require_module("csx") +} \ No newline at end of file diff --git a/dlls/csx/plugins/statsx.sma b/dlls/csx/plugins/statsx.sma new file mode 100755 index 00000000..e517204a --- /dev/null +++ b/dlls/csx/plugins/statsx.sma @@ -0,0 +1,1561 @@ +/* AMX Mod X +* StatsX Plugin +* +* by the AMX Mod X Development Team +* originally developed by OLO +* +* This file is part of AMX Mod X. +* +* +* 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. +*/ + +//-------------------------------- + +#include +#include +#include + +//-------------------------------- + +// Uncomment to activate log debug messages. +//#define STATSX_DEBUG + +// HUD statistics duration in seconds (minimum 1.0 seconds). +#define HUD_DURATION_CVAR "amx_statsx_duration" +#define HUD_DURATION "12.0" + +// HUD statistics stop relative freeze end in seconds. +// To stop before freeze end use a negative value. +#define HUD_FREEZE_LIMIT_CVAR "amx_statsx_freeze" +#define HUD_FREEZE_LIMIT "-2.0" + +// HUD statistics minimum duration, in seconds, to trigger the display logic. +#define HUD_MIN_DURATION 0.2 + +// Config plugin constants. +#define MODE_HUD_DELAY 0 // Make a 0.01 sec delay on HUD reset process. + +// You can also manualy enable or disable these options by setting them to 1 +// For example: +// public ShowAttackers = 1 +// However amx_statscfg command is recommended + +public KillerChat = 0 // displays killer hp&ap to victim console + // and screen + +public ShowAttackers = 0 // shows attackers +public ShowVictims = 0 // shows victims +public ShowKiller = 0 // shows killer +public ShowTeamScore = 0 // shows team score at round end +public ShowTotalStats = 0 // shows round total stats +public ShowBestScore = 0 // shows rounds best scored player +public ShowMostDisruptive = 0 // shows rounds most disruptive player + +public EndPlayer = 0 // displays player stats at the end of map +public EndTop15 = 0 // displays top15 at the end of map + +public SayHP = 0 // displays information about user killer +public SayStatsMe = 0 // displays user's stats and rank +public SayRankStats = 0 // displays user's rank stats +public SayMe = 0 // displays user's stats +public SayRank = 0 // displays user's rank +public SayReport = 0 // report user's weapon status to team +public SayScore = 0 // displays team's map score +public SayTop15 = 0 // displays first 15 players +public SayStatsAll = 0 // displays all players stats and rank +public SayMiscFunc = 0 // displays timeleft, thetime, currentmap, ff + +public ShowStats = 1 // set client HUD-stats switched off by default +public ShowDistHS = 0 // show distance and HS in attackers and + // victims HUD lists +public ShowFullStats = 0 // show full HUD stats (more than 78 chars) + +public SpecRankInfo = 0 // displays rank info when spectating + +// Standard Contstants. +#define MAX_TEAMS 2 +#define MAX_PLAYERS 32 + 1 + +#define MAX_NAME_LENGTH 31 +#define MAX_WEAPON_LENGTH 31 +#define MAX_TEXT_LENGTH 255 +#define MAX_BUFFER_LENGTH 2047 + +// User stats parms id +#define STATS_KILLS 0 +#define STATS_DEATHS 1 +#define STATS_HS 2 +#define STATS_TKS 3 +#define STATS_SHOTS 4 +#define STATS_HITS 5 +#define STATS_DAMAGE 6 + +// Global player flags. + +new BODY_PART[8][] = { + "WHOLEBODY", + "HEAD", + "CHEST", + "STOMACH", + "LEFTARM", + "RIGHTARM", + "LEFTLEG", + "RIGHTLEG" +} + +// Killer information, save killer info at the time when player is killed. +#define KILLED_KILLER_ID 0 // Killer userindex/user-ID +#define KILLED_KILLER_HEALTH 1 // Killer's health +#define KILLED_KILLER_ARMOUR 2 // Killer's armour +#define KILLED_TEAM 3 // Killer's team +#define KILLED_KILLER_STATSFIX 4 // Fix to register the last hit/kill + +new g_izKilled[MAX_PLAYERS][5] + +// Menu variables and configuration +#define MAX_PPL_MENU_ACTIONS 2 // Number of player menu actions +#define PPL_MENU_OPTIONS 7 // Number of player options per displayed menu + +new g_iPluginMode = 0 + +new g_izUserMenuPosition[MAX_PLAYERS] = { 0, ... } +new g_izUserMenuAction[MAX_PLAYERS] = { 0, ... } +new g_izUserMenuPlayers[MAX_PLAYERS][32] + +new g_izSpecMode[MAX_PLAYERS] = { 0, ... } + +new g_izShowStatsFlags[MAX_PLAYERS] = { 0, ... } +new g_izStatsSwitch[MAX_PLAYERS] = { 0, ... } +new Float:g_fzShowUserStatsTime[MAX_PLAYERS] = { 0.0, ... } +new Float:g_fShowStatsTime = 0.0 +new Float:g_fFreezeTime = 0.0 +new Float:g_fFreezeLimitTime = 0.0 +new Float:g_fHUDDuration = 0.0 + +new g_iRoundEndTriggered = 0 +new g_iRoundEndProcessed = 0 + +new Float:g_fStartGame = 0.0 +new g_izTeamScore[MAX_TEAMS] = { 0, ... } +new g_izTeamEventScore[MAX_TEAMS] = { 0, ... } +new g_izTeamRndStats[MAX_TEAMS][8] +new g_izTeamGameStats[MAX_TEAMS][8] +new g_izUserUserID[MAX_PLAYERS] = { 0, ... } +new g_izUserAttackerDistance[MAX_PLAYERS] = { 0, ... } +new g_izUserVictimDistance[MAX_PLAYERS][MAX_PLAYERS] +new g_izUserRndName[MAX_PLAYERS][MAX_NAME_LENGTH] +new g_izUserRndStats[MAX_PLAYERS][8] +new g_izUserGameStats[MAX_PLAYERS][8] + +// Common buffer to improve performance, as Small always zero-initializes all vars +new g_sBuffer[MAX_BUFFER_LENGTH+1] = "" +new g_sScore[MAX_TEXT_LENGTH+1] = "" +new g_sAwardAndScore[MAX_BUFFER_LENGTH+1] = "" + +new t_sText[MAX_TEXT_LENGTH+1] = "" +new t_sName[MAX_NAME_LENGTH+1] = "" +new t_sWpn[MAX_WEAPON_LENGTH+1] = "" + +//-------------------------------- +// Initialize +//-------------------------------- + +public plugin_init() { + // Register plugin. + register_plugin( "StatsX", AMXX_VERSION_STR, "AMXX Dev Team") + register_dictionary("statsx.txt") + + // Register events. + register_event( "TextMsg", "eventStartGame", "a", + "2=#Game_Commencing", "2=#Game_will_restart_in" ) + register_event( "ResetHUD", "eventResetHud", "be" ) + register_event( "RoundTime", "eventStartRound", "bc" ) + + register_event( "SendAudio", "eventEndRound", "a", + "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw" ) + register_event( "TeamScore", "eventTeamScore", "a" ) + register_event( "30", "eventIntermission", "a" ) + + register_event( "TextMsg", "eventSpecMode", "bd", "2&ec_Mod" ) + register_event( "StatusValue", "eventShowRank", "bd", "1=2" ) + + // Register commands. + register_clcmd( "say /hp", "cmdHp", 0, "- display info. about your killer (chat)" ) + register_clcmd( "say /statsme", "cmdStatsMe", 0, "- display your stats (MOTD)" ) + register_clcmd( "say /rankstats", "cmdRankStats", 0, "- display your server stats (MOTD)" ) + register_clcmd( "say /me", "cmdMe", 0, "- display current round stats (chat)" ) + register_clcmd( "say /score", "cmdScore", 0, "- display last score (chat)" ) + register_clcmd( "say /rank", "cmdRank", 0, "- display your rank (chat)" ) + register_clcmd( "say /report", "cmdReport", 0, "- display waepon status (say_team)" ) + + register_clcmd( "say /top15", "cmdTop15", 0, "- display top 15 players (MOTD)" ) + register_clcmd( "say /stats", "cmdStats", 0, "- display players stats (menu/MOTD)" ) + + register_clcmd( "say /timeleft", "cmdTimeLeft", 0, "- display time left on map (say)" ) + register_clcmd( "say /thetime", "cmdTheTime", 0, "- display the time (say)" ) + register_clcmd( "say /currentmap", "cmdCurrentMap", 0, "- display current map (say)" ) + register_clcmd( "say /ff", "cmdFf", 0, "- display friendly fire status (say)" ) + + register_clcmd( "say /switch", "cmdSwitch", 0, "- switch client's stats on or off" ) + + // Register menus. + register_menucmd( register_menuid("Server Stats"), 1023, "actionStatsMenu" ) + + // Register special configuration setting and default value. + register_srvcmd( "amx_statsx_mode", "cmdPluginMode", ADMIN_CFG, " - sets plugin options" ) + + #if defined STATSX_DEBUG + register_clcmd( "say /hudtest", "cmdHudTest" ) + #endif + + register_cvar( HUD_DURATION_CVAR, HUD_DURATION ) + register_cvar( HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT ) + + // Init buffers and some global vars. + g_sBuffer[0] = 0 + save_team_chatscore() +} + +public plugin_cfg() { + new addStast[] = "amx_statscfg add ^"%s^" %s" + + server_cmd( addStast, "Show killer hp&ap","KillerChat" ) + + server_cmd( addStast, "Show Attackers", "ShowAttackers" ) + server_cmd( addStast, "Show Victims", "ShowVictims" ) + server_cmd( addStast, "Show killer", "ShowKiller" ) + server_cmd( addStast, "Show Team Score", "ShowTeamScore" ) + server_cmd( addStast, "Show Total Stats", "ShowTotalStats" ) + server_cmd( addStast, "Show Best Score", "ShowBestScore" ) + server_cmd( addStast, "Show Most Disruptive", "ShowMostDisruptive" ) + + server_cmd( addStast, "HUD-stats default", "ShowStats" ) + server_cmd( addStast, "Dist&HS in HUD lists", "ShowDistHS" ) + + server_cmd( addStast, "Stats at the end of map", "EndPlayer") + server_cmd( addStast, "Top15 at the end of map", "EndTop15" ) + + server_cmd( addStast, "Say /hp", "SayHP" ) + server_cmd( addStast, "Say /statsme", "SayStatsMe" ) + server_cmd( addStast, "Say /rankstats", "SayRankStats" ) + server_cmd( addStast, "Say /me", "SayMe" ) + server_cmd( addStast, "Say /rank", "SayRank" ) + server_cmd( addStast, "Say /report", "SayReport" ) + server_cmd( addStast, "Say /score", "SayScore" ) + server_cmd( addStast, "Say /top15", "SayTop15" ) + server_cmd( addStast, "Say /stats", "SayStatsAll" ) + server_cmd( addStast, "Misc say commands", "SayMiscFunc" ) + + server_cmd( addStast, "Spec. Rank Info", "SpecRankInfo" ) + + // Update local configuration vars with value in cvars. + get_config_cvars() +} + +// Set hudmessage format. +set_hudtype_killer( Float:fDuration ) + set_hudmessage( 220, 80, 0, 0.05, 0.15, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 2 ) +set_hudtype_endround( Float:fDuration ) + set_hudmessage( 100, 200, 0, 0.05, 0.55, 0, 0.02, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 1 ) +set_hudtype_attacker( Float:fDuration ) + set_hudmessage( 220, 80, 0, 0.55, 0.35, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 3 ) +set_hudtype_victim( Float:fDuration ) + set_hudmessage( 0, 80, 220, 0.55, 0.60, 0, 6.0, fDuration, (fDuration>=g_fHUDDuration)?1.0:0.0, 1.0, 4 ) +set_hudtype_specmode() { + set_hudmessage( 255, 255, 255, 0.02, 0.87, 2, 0.05, 0.1, 0.01, 3.0, 1) +} + +#if defined STATSX_DEBUG +public cmdHudTest( id ) { + new i, iLen + iLen = 0 + for ( i = 1; i < 20; i++ ) + iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n" ) + set_hudtype_killer( 50.0 ) + show_hudmessage( id, g_sBuffer ) +} +#endif + +// Stats formulas +Float:accuracy( izStats[8] ) { + if ( !izStats[STATS_SHOTS] ) return ( 0.0 ) + return ( 100.0 * float( izStats[STATS_HITS] ) / float( izStats[STATS_SHOTS] ) ) +} + +Float:effec( izStats[8] ) { + if ( !izStats[STATS_KILLS] ) return ( 0.0 ) + return ( 100.0 * float( izStats[STATS_KILLS] ) / float( izStats[STATS_KILLS] + izStats[STATS_DEATHS] ) ) +} + +// Distance formula (metric) +Float:distance( iDistance ) { + return float( iDistance ) * 0.0254 +} + +// Get plugin config flags. +set_plugin_mode( id, sFlags[] ) { + if ( sFlags[0] ) + g_iPluginMode = read_flags( sFlags ) + get_flags( g_iPluginMode, t_sText, MAX_TEXT_LENGTH ) + console_print( id, "%L", id, "MODE_SET_TO", t_sText ) + return g_iPluginMode +} + +// Get config parameters. +get_config_cvars() { + g_fFreezeTime = get_cvar_float("mp_freezetime") + if ( g_fFreezeTime < 0.0 ) g_fFreezeTime = 0.0 + + g_fHUDDuration = get_cvar_float( HUD_DURATION_CVAR ) + if ( g_fHUDDuration < 1.0 ) g_fHUDDuration = 1.0 + + g_fFreezeLimitTime = get_cvar_float( HUD_FREEZE_LIMIT_CVAR ) +} + +// Get and format attackers header and list. +get_attackers( id, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new izStats[8],izBody[8] + new iAttacker + new iFound, iLen + new iMaxPlayer = get_maxplayers() + + iFound = 0 + sBuffer[0] = 0 + + // Get and format header. Add killing attacker statistics if user is dead. + // Make sure shots is greater than zero or division by zero will occur. + // To print a '%', 4 of them must done in a row. + izStats[STATS_SHOTS] = 0 + iAttacker = g_izKilled[id][KILLED_KILLER_ID] + if ( iAttacker ) + get_user_astats( id, iAttacker, izStats, izBody ) + if ( izStats[STATS_SHOTS] && ShowFullStats ) { + get_user_name( iAttacker, t_sName, MAX_NAME_LENGTH ) + iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%%%% %L:^n", + id, "ATTACKERS", t_sName, accuracy( izStats ), id, "ACC" ) + } + else + iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS" ) + + // Get and format attacker list. + for ( iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++ ) { + if ( get_user_astats( id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) ) { + iFound = 1 + get_user_name( iAttacker, t_sName, 32 ) + if ( izStats[STATS_KILLS] ) { + if ( !ShowDistHS ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn ) + else if ( izStats[STATS_HS] ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn, distance(g_izUserAttackerDistance[id]) ) + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s / %0.0f m^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn, distance(g_izUserAttackerDistance[id]) ) + } + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG" ) + } + } + if ( !iFound ) + sBuffer[0] = 0 + return iFound +} + + +// Get and format victims header and list +get_victims( id, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new izStats[8], izBody[8] + new iVictim + new iFound, iLen + new iMaxPlayer = get_maxplayers() + + iFound = 0 + sBuffer[0] = 0 + + // Get and format header. + // Make sure shots is greater than zero or division by zero will occur. + // To print a '%', 4 of them must done in a row. + izStats[STATS_SHOTS] = 0 + get_user_vstats( id, 0, izStats, izBody ) + if ( izStats[STATS_SHOTS] ) + iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%%%% %L:^n", + id, "VICTIMS", accuracy( izStats ), id, "ACC" ) + else + iLen = format( sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS" ) + + for ( iVictim = 1; iVictim <= iMaxPlayer; iVictim++ ) { + if( get_user_vstats( id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) ) { + iFound = 1 + get_user_name( iVictim, t_sName, MAX_NAME_LENGTH ) + if ( izStats[STATS_DEATHS] ) { + if ( !ShowDistHS ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn ) + else if ( izStats[STATS_HS] ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn, distance(g_izUserVictimDistance[id][iVictim]) ) + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L / %s / %0.0f m^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG", + t_sWpn, distance(g_izUserVictimDistance[id][iVictim]) ) + } + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%s -- %d %L / %d %L^n", + t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG" ) + } + } + if ( !iFound ) + sBuffer[0] = 0 + + return iFound +} + + +// Get and format kill info. +get_kill_info( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new iFound, iLen + + iFound = 0 + sBuffer[0] = 0 + + if ( iKiller && iKiller != id ) { + new izAStats[8], izABody[8], izVStats[8], iaVBody[8] + + iFound = 1 + get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) + + izAStats[STATS_HITS] = 0 + izAStats[STATS_DAMAGE] = 0 + t_sWpn[0] = 0 + get_user_astats( id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH ) + + izVStats[STATS_HITS] = 0 + izVStats[STATS_DAMAGE] = 0 + get_user_vstats( id, iKiller, izVStats, iaVBody ) + + iLen = format( sBuffer, MAX_BUFFER_LENGTH, + "%L^n", id, "KILLED_YOU_DIST", + t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]) ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%L^n", id, "DID_DMG_HITS", + izAStats[STATS_DAMAGE], izAStats[STATS_HITS], + g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%L^n", id, "YOU_DID_DMG", + izVStats[STATS_DAMAGE], izVStats[STATS_HITS] ) + } + return iFound +} + + +// Get and format most disruptive. +add_most_disruptive( sBuffer[MAX_BUFFER_LENGTH+1] ) { + new id, iMaxDamageId, iMaxDamage, iMaxHeadShots + + iMaxDamageId = 0 + iMaxDamage = 0 + iMaxHeadShots = 0 + + // Find player. + for ( id = 1; id < MAX_PLAYERS; id++ ) { + if ( g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && + ( g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots ) ) { + iMaxDamageId = id + iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE] + iMaxHeadShots = g_izUserRndStats[id][STATS_HS] + } + } + + // Format statistics. + if ( iMaxDamageId ) { + id = iMaxDamageId + new Float:fGameEff = effec( g_izUserGameStats[id] ) + new Float:fRndAcc = accuracy( g_izUserRndStats[id] ) + format( t_sText, MAX_TEXT_LENGTH, + "%L: %s^n%d %L / %d %L -- %0.2f%%%% %L / %0.2f%%%% %L^n", + LANG_SERVER, "MOST_DMG", g_izUserRndName[id], g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", + iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC" ) + add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) + } + return iMaxDamageId +} + +// Get and format best score. +add_best_score( sBuffer[MAX_BUFFER_LENGTH+1] ) { + new id, iMaxKillsId, iMaxKills, iMaxHeadShots + + iMaxKillsId = 0 + iMaxKills = 0 + iMaxHeadShots = 0 + + // Find player + for ( id = 1; id < MAX_PLAYERS; id++ ) { + if ( g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && + ( g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots ) ) { + iMaxKillsId = id + iMaxKills = g_izUserRndStats[id][STATS_KILLS] + iMaxHeadShots = g_izUserRndStats[id][STATS_HS] + } + } + + // Format statistics. + if ( iMaxKillsId ) { + id = iMaxKillsId + new Float:fGameEff = effec( g_izUserGameStats[id] ) + new Float:fRndAcc = accuracy( g_izUserRndStats[id] ) + format( t_sText, MAX_TEXT_LENGTH, + "%L: %s^n%d %L / %d hs -- %0.2f%%%% %L / %0.2f%%%% %L^n", + LANG_SERVER, "BEST_SCORE", g_izUserRndName[id], iMaxKills, LANG_SERVER, "KILL_S", + iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC" ) + add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) + } + return iMaxKillsId +} + + +// Get and format team score. +add_team_score( sBuffer[MAX_BUFFER_LENGTH+1] ) { + new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] + + // Calculate team stats + for ( new iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) { + fzMapEff[iTeam] = effec( g_izTeamGameStats[iTeam] ) + fzMapAcc[iTeam] = accuracy( g_izTeamGameStats[iTeam] ) + fzRndAcc[iTeam] = accuracy( g_izTeamRndStats[iTeam] ) + } + + // Format round team stats, MOTD + format( t_sText, MAX_TEXT_LENGTH, + "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L^nCT %d / %0.2f%%%% %L / %0.2f%%%% %L^n", + g_izTeamScore[0], fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", + g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC" ) + add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) +} + + +// Get and format team stats, chat version +save_team_chatscore() { + new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS] + + // Calculate team stats + for ( new iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) { + fzMapEff[iTeam] = effec( g_izTeamGameStats[iTeam] ) + fzMapAcc[iTeam] = accuracy( g_izTeamGameStats[iTeam] ) + fzRndAcc[iTeam] = accuracy( g_izTeamRndStats[iTeam] ) + } + + // Format game team stats, chat + format( g_sScore, MAX_BUFFER_LENGTH, + "TERRORIST %d / %0.2f%%%% %L / %0.2f%%%% %L -- CT %d / %0.2f%%%% %L / %0.2f%%%% %L", + g_izTeamScore[0], fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", + g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC" ) +} + +// Get and format total stats. +add_total_stats( sBuffer[MAX_BUFFER_LENGTH+1] ) { + format( t_sText, MAX_TEXT_LENGTH, + "%L: %d %L / %d hs -- %d %L / %d %L^n", + LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S", g_izUserRndStats[0][STATS_HS], + g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S" ) + add( sBuffer, MAX_BUFFER_LENGTH, t_sText ) +} + + +// Get and format a user's list of body hits from an attacker. +add_attacker_hits( id, iAttacker, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new iFound = 0 + if ( iAttacker && iAttacker != id ) { + new izStats[8], izBody[8], iLen + + izStats[STATS_HITS] = 0 + get_user_astats( id, iAttacker, izStats, izBody ) + + if ( izStats[STATS_HITS] ) { + iFound = 1 + iLen = strlen( sBuffer ) + get_user_name( iAttacker, t_sName, MAX_NAME_LENGTH ) + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%L:^n", id, "HITS_YOU_IN", t_sName ) + for ( new i = 1; i < 8; i++ ) { + if ( !izBody[i] ) continue + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + "%L: %d^n", id, BODY_PART[i], izBody[i] ) + } + } + } + return iFound +} + + +// Get and format killed stats: killer hp, ap, hits. +format_kill_ainfo( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new iFound = 0 + if ( iKiller && iKiller != id ) { + new izStats[8], izBody[8] + new iLen + iFound = 1 + get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) + + izStats[STATS_HITS] = 0 + get_user_astats( id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH ) + + iLen = format( sBuffer, MAX_BUFFER_LENGTH, + "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, + distance(g_izUserAttackerDistance[id]), + g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR] ) + + if ( izStats[STATS_HITS] ) { + for ( new i = 1; i < 8; i++ ) { + if ( !izBody[i] ) continue + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + " %L: %d", id, BODY_PART[i], izBody[i] ) + } + } + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + " %L", id, "NO_HITS" ) + } + else + format( sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER" ) + return iFound +} + + +// Get and format killed stats: hits, damage on killer. +format_kill_vinfo( id, iKiller, sBuffer[MAX_BUFFER_LENGTH+1] ) { + new iFound = 0 + new izStats[8] + new izBody[8] + new iLen + + izStats[STATS_HITS] = 0 + izStats[STATS_DAMAGE] = 0 + get_user_vstats( id, iKiller, izStats, izBody ) + + if ( iKiller && iKiller != id ) { + iFound = 1 + get_user_name( iKiller, t_sName, MAX_NAME_LENGTH ) + iLen = format( sBuffer, MAX_BUFFER_LENGTH, + "%L >>", id, "YOU_HIT", + t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE] ) + } + else + iLen = format( sBuffer, MAX_BUFFER_LENGTH, + "%L >>", id, "LAST_RES", + izStats[STATS_HITS], izStats[STATS_DAMAGE] ) + + if ( izStats[STATS_HITS] ) { + for ( new i = 1; i < 8; i++ ) { + if ( !izBody[i] ) continue + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + " %L: %d", id, BODY_PART[i], izBody[i] ) + } + } + else + iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, + " %L", id, "NO_HITS" ) + return iFound +} + + +// Get and format top 15. +format_top15( sBuffer[MAX_BUFFER_LENGTH+1] ){ + new iMax = get_statsnum() + new izStats[8], izBody[8] + new iLen = 0 + + if ( iMax > 15 ) + iMax = 15 + + new lKills[16],lDeaths[16],lHits[16],lShots[16],lEff[16],lAcc[16] + format(lKills,15,"%L",LANG_SERVER,"KILLS") + format(lDeaths,15,"%L",LANG_SERVER,"DEATHS") + format(lHits,15,"%L",LANG_SERVER,"HITS") + format(lShots,15,"%L",LANG_SERVER,"SHOTS") + format(lEff,15,"%L",LANG_SERVER,"EFF") + format(lAcc,15,"%L",LANG_SERVER,"ACC") + ucfirst(lEff) + ucfirst(lAcc) + + iLen = format( sBuffer, MAX_BUFFER_LENGTH, + "
" )
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n",
+                  "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc )
+  for ( new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++ ) {
+    get_stats( i, izStats, izBody, t_sName, MAX_NAME_LENGTH )
+    iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                    "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i+1, t_sName,
+                    izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_HITS], 
+                    izStats[STATS_SHOTS], izStats[STATS_HS],
+                    effec( izStats ), accuracy( izStats ) )
+  }
+}
+
+
+// Get and format rank stats.
+format_rankstats( id, sBuffer[MAX_BUFFER_LENGTH+1], iMyId=0 ) {
+  new izStats[8] = { 0, ... }
+  new izBody[8]
+  new iRankPos, iLen
+  new lKills[16],lDeaths[16],lHits[16],lShots[16],lDamage[16],lEff[16],lAcc[16]
+  format(lKills,15,"%L",id,"KILLS")
+  format(lDeaths,15,"%L",id,"DEATHS")
+  format(lHits,15,"%L",id,"HITS")
+  format(lShots,15,"%L",id,"SHOTS")
+  format(lDamage,15,"%L",id,"DAMAGE")
+  format(lEff,15,"%L",id,"EFF")
+  format(lAcc,15,"%L",id,"ACC")
+  ucfirst(lEff)
+  ucfirst(lAcc)
+  iRankPos = get_user_stats( id, izStats, izBody )
+  iLen = format( sBuffer, MAX_BUFFER_LENGTH, 
+                  "
" )
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%L %L^n^n", id, (!iMyId||iMyId==id)?"YOUR":"PLAYERS",
+                  id, "RANK_IS", iRankPos, get_statsnum() )
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
+                  lKills, izStats[STATS_KILLS], izStats[STATS_HS], 
+                  lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], 
+                  lShots, izStats[STATS_SHOTS], lDamage, izStats[STATS_DAMAGE], 
+                  lEff, effec( izStats ), lAcc, accuracy( izStats ) )
+  new L_BODY_PART[8][32]
+  for (new i=1; i<8; i++) {
+    format(L_BODY_PART[i],31,"%L",id,BODY_PART[i])
+  }
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d",
+                  "HITS", L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], 
+                  L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5], izBody[5], 
+                  L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
+}
+
+
+// Get and format stats.
+format_stats( id, sBuffer[MAX_BUFFER_LENGTH+1] ) {
+  new izStats[8] = { 0, ... }
+  new izBody[8]
+  new iWeapon, iLen
+  new lKills[16],lDeaths[16],lHits[16],lShots[16],lDamage[16],lEff[16],lAcc[16],lWeapon[16]
+  format(lKills,15,"%L",id,"KILLS")
+  format(lDeaths,15,"%L",id,"DEATHS")
+  format(lHits,15,"%L",id,"HITS")
+  format(lShots,15,"%L",id,"SHOTS")
+  format(lDamage,15,"%L",id,"DAMAGE")
+  format(lEff,15,"%L",id,"EFF")
+  format(lAcc,15,"%L",id,"ACC")
+  format(lWeapon,15,"%L",id,"WEAPON")
+  ucfirst(lEff)
+  ucfirst(lAcc)
+  get_user_wstats( id, 0, izStats, izBody )
+  iLen = format( sBuffer, MAX_BUFFER_LENGTH, 
+                  "
" )
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%6s: %d  (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
+                  lKills, izStats[STATS_KILLS], izStats[STATS_HS], 
+                  lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], 
+                  lShots, izStats[STATS_SHOTS], lDamage, izStats[STATS_DAMAGE], 
+                  lEff, effec( izStats ), lAcc, accuracy( izStats ) )
+  iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                  "%-12.12s  %6s  %6s  %6s  %6s  %6s  %4s^n",
+                  lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc )
+  for ( iWeapon = 1; iWeapon < 31 && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++ ) {
+    if ( get_user_wstats( id, iWeapon, izStats, izBody ) ) {
+      get_weaponname( iWeapon, t_sWpn, MAX_WEAPON_LENGTH )
+      iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
+                      "%-12.12s  %6d  %6d  %6d  %6d  %6d  %3.0f%%^n",
+                      t_sWpn[7], izStats[STATS_KILLS], izStats[STATS_DEATHS], 
+                      izStats[STATS_HITS], izStats[STATS_SHOTS], 
+                      izStats[STATS_DAMAGE], accuracy( izStats ) )
+    }
+  }
+}
+
+// Show round end stats. If gametime is zero then use default duration time. 
+show_roundend_hudstats( id, Float:fGameTime ) {
+  
+  // Bail out if there no HUD stats should be shown
+  // for this player or end round stats not created.
+  if ( !g_izStatsSwitch[id] ) return
+  if ( !g_sAwardAndScore[0] ) return
+
+  // If round end timer is zero clear round end stats.
+  if ( g_fShowStatsTime == 0.0 ) {
+    set_hudtype_endround( 0.05 )
+    show_hudmessage( id, "" )
+    #if defined STATSX_DEBUG
+    log_amx( "Clear round end HUD stats for #%d", id )  
+    #endif
+  }
+
+  // Set HUD-duration to default or remaining time.
+  new Float:fDuration
+  if ( fGameTime == 0.0 )
+    fDuration = g_fHUDDuration
+  else {
+    fDuration = g_fShowStatsTime + g_fHUDDuration - fGameTime
+    if ( fDuration > g_fFreezeTime + g_fFreezeLimitTime )
+      fDuration = g_fFreezeTime + g_fFreezeLimitTime
+  }
+  // Show stats only if more time left than coded minimum.
+  if ( fDuration >= HUD_MIN_DURATION ) {
+    set_hudtype_endround( fDuration )
+    show_hudmessage( id, g_sAwardAndScore )
+    #if defined STATSX_DEBUG
+    log_amx( "Show %1.2fs round end HUD stats for #%d", fDuration, id )  
+    #endif
+  }
+}
+
+
+// Show round end stats.
+show_user_hudstats( id, Float:fGameTime ) {
+  
+  // Bail out if there no HUD stats should be shown
+  // for this player or user stats timer is zero.
+  if ( !g_izStatsSwitch[id] ) return
+  if ( g_fzShowUserStatsTime[id] == 0.0 ) return
+
+  // Set HUD-duration to default or remaining time.
+  new Float:fDuration
+  if ( fGameTime == 0.0 )
+    fDuration = g_fHUDDuration
+  else {
+    fDuration = g_fzShowUserStatsTime[id] + g_fHUDDuration - fGameTime
+    if ( fDuration > g_fFreezeTime + g_fFreezeLimitTime )
+      fDuration = g_fFreezeTime + g_fFreezeLimitTime
+  }
+  // Show stats only if more time left than coded minimum.
+  if ( fDuration >= HUD_MIN_DURATION ) {
+    if ( ShowKiller ) {
+      new iKiller
+      iKiller = g_izKilled[id][KILLED_KILLER_ID]
+      get_kill_info( id, iKiller, g_sBuffer )
+      add_attacker_hits( id, iKiller, g_sBuffer )
+      set_hudtype_killer( fDuration )
+      show_hudmessage( id, g_sBuffer )
+      #if defined STATSX_DEBUG
+      log_amx( "Show %1.2fs %suser HUD k-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
+      #endif
+    }
+    if ( ShowVictims ) {
+      get_victims( id, g_sBuffer )
+      set_hudtype_victim( fDuration )
+      show_hudmessage( id, g_sBuffer )
+      #if defined STATSX_DEBUG
+      log_amx( "Show %1.2fs %suser HUD v-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
+      #endif
+    }
+    if ( ShowAttackers ) {
+      get_attackers( id, g_sBuffer )
+      set_hudtype_attacker( fDuration )
+      show_hudmessage( id, g_sBuffer )
+      #if defined STATSX_DEBUG
+      log_amx( "Show %1.2fs %suser HUD a-stats for #%d", fDuration, g_sBuffer[0]?"":"no ", id )
+      #endif
+    }
+  }
+}
+
+
+//------------------------------------------------------------
+//  Plugin commands
+//------------------------------------------------------------
+
+// Set or get plugin config flags.
+public cmdPluginMode( id, level, cid ) {
+  if ( !cmd_access( id, level, cid, 1 ) ) 
+    return PLUGIN_HANDLED
+  if ( read_argc() > 1 )
+    read_argv( 1, g_sBuffer, MAX_BUFFER_LENGTH )
+  else
+    g_sBuffer[0] = 0
+  set_plugin_mode( id, g_sBuffer )
+  return PLUGIN_HANDLED
+}
+
+// Display MOTD stats.
+public cmdStatsMe( id ) {
+  if ( !SayStatsMe ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  format_stats( id, g_sBuffer )
+  get_user_name( id, t_sName, MAX_NAME_LENGTH )
+  show_motd( id, g_sBuffer, t_sName )
+  return PLUGIN_CONTINUE
+}
+
+// Display MOTD rank.
+public cmdRankStats( id ) {
+  if ( !SayRankStats ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  format_rankstats( id, g_sBuffer )
+  get_user_name( id, t_sName, MAX_NAME_LENGTH )
+  show_motd( id, g_sBuffer, t_sName )
+  return PLUGIN_CONTINUE
+}
+
+// Display MOTD top15 ranked.
+public cmdTop15( id ) {
+  if ( !SayTop15 ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  format_top15( g_sBuffer )
+  show_motd( id, g_sBuffer, "Top 15" )
+  return PLUGIN_CONTINUE
+}
+
+// Display killer information.
+public cmdHp( id ) {
+  if ( !SayHP ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  new iKiller = g_izKilled[id][KILLED_KILLER_ID]
+  format_kill_ainfo( id, iKiller, g_sBuffer )
+  client_print( id, print_chat, "* %s", g_sBuffer )
+  return PLUGIN_CONTINUE
+}
+
+// Display user stats.
+public cmdMe( id ) {
+  if ( !SayMe ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  format_kill_vinfo( id, 0, g_sBuffer )
+  client_print( id, print_chat, "* %s", g_sBuffer )
+  return PLUGIN_CONTINUE
+}
+
+// Display user rank
+public cmdRank( id ) {
+  if ( !SayRank ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  new izStats[8], izBody[8]
+  new iRankPos, iRankMax
+  new Float:fEff, Float:fAcc
+  iRankPos = get_user_stats( id, izStats, izBody )
+  iRankMax = get_statsnum()
+  fEff = effec( izStats )
+  fAcc = accuracy( izStats )
+  client_print( id, print_chat,
+                "* %L", id, "YOUR_RANK_IS",
+                iRankPos, iRankMax, izStats[STATS_KILLS], izStats[STATS_HITS],
+                fEff, fAcc )
+  return PLUGIN_CONTINUE
+}
+
+// Report user weapon status to team.
+public cmdReport( id ) { 
+  if ( !SayReport ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  new iWeapon, iClip, iAmmo, iHealth, iArmor
+  iWeapon = get_user_weapon( id, iClip, iAmmo ) 
+  get_weaponname( iWeapon, t_sWpn, MAX_WEAPON_LENGTH )
+  iHealth = get_user_health( id ) 
+  iArmor = get_user_armor( id )
+  new lWeapon[16]
+  format(lWeapon,15,"%L",id,"WEAPON")
+  strtolower(lWeapon)
+  if ( iClip >= 0 ) {
+    format( g_sBuffer, MAX_BUFFER_LENGTH,
+            "%s: %s, %L: %d/%d, %L: %d, %L: %d", 
+            lWeapon, t_sWpn[7], LANG_SERVER, "AMMO", iClip, iAmmo,
+            LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor ) 
+  }
+  else
+    format( g_sBuffer, MAX_BUFFER_LENGTH,
+            "%s: %s, %L: %d, %L: %d", 
+            lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor ) 
+  engclient_cmd( id, "say_team", g_sBuffer )
+  return PLUGIN_CONTINUE
+} 
+
+// Display team map score
+public cmdScore( id ) {
+  if ( !SayScore ) {
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  client_print( id, print_chat, "%L: %s", id, "GAME_SCORE", g_sScore )
+  return PLUGIN_CONTINUE
+}
+
+// Display time left on map
+public cmdTimeLeft( id ) {
+  if ( !SayMiscFunc )
+    return PLUGIN_CONTINUE
+  new iTimeLeft = get_timeleft()
+  if ( iTimeLeft )
+    client_print( 0, print_chat,
+                  "%L:  %02d:%02d", id, "TIME_REM", iTimeLeft / 60, iTimeLeft % 60 )
+  else
+    client_print( 0, print_chat, "* %L *", LANG_PLAYER, "NO_T_LIMIT" )
+  return PLUGIN_CONTINUE
+}
+
+// Display the time.
+public cmdTheTime( id ) {
+  if ( !SayMiscFunc )
+    return PLUGIN_CONTINUE
+  get_time( "%H:%M:%S", g_sBuffer, MAX_BUFFER_LENGTH )
+  client_print( 0, print_chat, "%L:  %s", LANG_PLAYER, "THE_TIME", g_sBuffer )
+  return PLUGIN_CONTINUE
+}
+
+// Display current map name.
+public cmdCurrentMap( id ) {
+  if ( !SayMiscFunc )
+    return PLUGIN_CONTINUE
+  get_mapname( g_sBuffer, MAX_BUFFER_LENGTH )
+  client_print( 0, print_chat, "%L:  %s", LANG_PLAYER, "PLAYED_MAP", g_sBuffer )
+  return PLUGIN_CONTINUE
+}
+
+// Display friendly fire status.
+public cmdFf( id ) {
+  if ( !SayMiscFunc )
+    return PLUGIN_CONTINUE
+  client_print( 0, print_chat, "%L:  %L", LANG_PLAYER, "FRIEND_FIRE",
+                LANG_PLAYER, get_cvar_num( "mp_friendlyfire" ) ? "ON" : "OFF" )
+  return PLUGIN_CONTINUE
+}
+
+// Client switch to enable or disable stats announcements.
+public cmdSwitch( id ) {
+  g_izStatsSwitch[id] = ( g_izStatsSwitch[id] ) ? 0 : -1 
+  num_to_str( g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH )
+  client_cmd( id, "setinfo _amxstatsx %s", t_sText )
+  new lEnDis[32]
+  format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
+  client_print( id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
+  return PLUGIN_CONTINUE
+}
+
+// Player stats menu.
+public cmdStats( id ) {
+  if ( !SayStatsAll ){
+    client_print( id, print_chat, "%L", id, "DISABLED_MSG" )
+    return PLUGIN_HANDLED
+  }
+  showStatsMenu( id, g_izUserMenuPosition[id]=0 )
+  return PLUGIN_CONTINUE
+}
+
+
+//--------------------------------
+//  Menu
+//--------------------------------
+
+public actionStatsMenu( id, key ) {
+  switch( key ) {
+    // Key '1' to '7', execute action on this option
+    case 0..6: {
+      new iOption, iIndex
+      iOption = ( g_izUserMenuPosition[id] * PPL_MENU_OPTIONS ) + key
+      if ( iOption >= 0 && iOption < 32 ) {
+        iIndex = g_izUserMenuPlayers[id][iOption]
+        if ( is_user_connected( iIndex ) ){
+          switch( g_izUserMenuAction[id] ) {
+            case 0:  format_stats( iIndex, g_sBuffer )
+            case 1:  format_rankstats( iIndex, g_sBuffer, id )
+            default: g_sBuffer[0] = 0
+          }
+          if ( g_sBuffer[0] ) {
+            get_user_name( iIndex, t_sName, MAX_NAME_LENGTH )
+            show_motd( id, g_sBuffer, t_sName )
+          }
+        }
+      }
+      showStatsMenu( id, g_izUserMenuPosition[id] )
+    }
+    // Key '8', change action
+    case 7: {
+      g_izUserMenuAction[id]++
+      if ( g_izUserMenuAction[id] >= MAX_PPL_MENU_ACTIONS )
+        g_izUserMenuAction[id] = 0
+      showStatsMenu( id, g_izUserMenuPosition[id] )
+    }
+    // Key '9', select next page of options
+    case 8:
+      showStatsMenu( id, ++g_izUserMenuPosition[id] )
+    // Key '10', cancel or go back to previous menu
+    case 9: {
+      if ( g_izUserMenuPosition[id] > 0 )
+        showStatsMenu( id, --g_izUserMenuPosition[id] )
+    }
+  }
+  return PLUGIN_HANDLED
+}
+
+new g_izUserMenuActionText[MAX_PPL_MENU_ACTIONS][]  = { "Show stats", "Show rank stats" }
+
+showStatsMenu( id, iMenuPos ) {
+  new iLen, iKeyMask, iPlayers
+  new iUserIndex, iMenuPosMax, iMenuOption, iMenuOptionMax
+  get_players( g_izUserMenuPlayers[id], iPlayers )
+  iMenuPosMax = (( iPlayers - 1 ) / PPL_MENU_OPTIONS ) + 1
+  // If menu pos does not excist use last menu (if players has left)
+  if ( iMenuPos >= iMenuPosMax )
+    iMenuPos = iMenuPosMax - 1
+  iUserIndex = iMenuPos * PPL_MENU_OPTIONS
+  iLen = format( g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n",
+                 id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax )
+  iMenuOptionMax = iPlayers - iUserIndex
+  if ( iMenuOptionMax > PPL_MENU_OPTIONS ) 
+    iMenuOptionMax = PPL_MENU_OPTIONS
+  for ( iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++ ) {
+    get_user_name( g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH )
+    iKeyMask |= (1< iUserIndex ) {
+    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE" )
+    iKeyMask |= MENU_KEY_9
+  }
+  if ( iMenuPos > 0 )
+    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK" )
+  else
+    iLen += format( g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "MORE" )
+  show_menu( id, iKeyMask, g_sBuffer, -1, "Server Stats" )
+  return PLUGIN_HANDLED
+}
+
+
+//------------------------------------------------------------
+//  Plugin events
+//------------------------------------------------------------
+
+// Reset game stats on game start and restart.
+public eventStartGame() {
+  read_data( 2, t_sText, MAX_TEXT_LENGTH )
+  if ( t_sText[6] == 'w' ) {
+    read_data( 3, t_sText, MAX_TEXT_LENGTH )
+    g_fStartGame = get_gametime() + float( str_to_num( t_sText ) )
+  }
+  else
+    g_fStartGame = get_gametime()
+  return PLUGIN_CONTINUE
+}
+
+// Round start
+public eventStartRound() {
+  new iTeam, id, i
+  new iRoundTime
+
+  iRoundTime = read_data( 1 )
+  if ( iRoundTime >= get_cvar_float("mp_roundtime") * 60 ) {
+    #if defined STATSX_DEBUG
+    log_amx( "Reset round stats" )  
+    #endif
+
+    // Reset game stats on game start and restart.
+    if ( g_fStartGame > 0.0 && g_fStartGame <= get_gametime() ) {
+      #if defined STATSX_DEBUG
+      log_amx( "Reset game stats" )  
+      #endif
+
+      g_fStartGame = 0.0
+
+      // Clear team and game stats.
+      for ( iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) {
+        g_izTeamEventScore[iTeam] = 0
+        for ( i = 0; i < 8; i++ )
+          g_izTeamGameStats[iTeam][i] = 0
+      }
+
+      // Clear game stats, incl '0' that is sum of all users.
+      for ( id = 0; id < MAX_PLAYERS; id++ ) {
+        for ( i = 0; i < 8; i++ )
+          g_izUserGameStats[id][i] = 0
+      }
+    }
+
+    // Update team score with "TeamScore" event values and
+    // clear team round stats.
+    for ( iTeam = 0; iTeam < MAX_TEAMS; iTeam++ ) {
+      g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
+      for ( i = 0; i < 8; i++ )
+        g_izTeamRndStats[iTeam][i] = 0
+    }
+
+    // Clear user round stats, incl '0' that is sum of all users.
+    for ( id = 0; id < MAX_PLAYERS; id++ ) {
+      g_izUserRndName[id][0] = 0
+      for ( i = 0; i < 8; i++ )
+        g_izUserRndStats[id][i] = 0
+      g_fzShowUserStatsTime[id] = 0.0
+    }
+    
+    // Allow end round stats and reset end round triggered indicator.
+    g_iRoundEndTriggered = 0
+    g_iRoundEndProcessed = 0
+    g_fShowStatsTime = 0.0
+
+    // Update local configuration vars with value in cvars.
+    get_config_cvars()
+  }
+
+  return PLUGIN_CONTINUE
+}
+
+// Reset killer info on round restart.
+public eventResetHud( id ) {
+  new args[1]
+  args[0] = id
+  if ( g_iPluginMode & MODE_HUD_DELAY )
+    set_task( 0.01, "delay_resethud", 200 + id, args, 1 )
+  else
+    delay_resethud( args )
+  return PLUGIN_CONTINUE
+}
+
+public delay_resethud( args[] ) {
+  new id = args[0]
+  new Float:fGameTime
+  
+  // Show user and score round stats after HUD-reset
+  #if defined STATSX_DEBUG
+  log_amx( "Reset HUD for #%d", id )
+  #endif
+  fGameTime = get_gametime()
+  show_user_hudstats( id, fGameTime )
+  show_roundend_hudstats( id, fGameTime )
+  
+  // Reset round stats
+  g_izKilled[id][KILLED_KILLER_ID] = 0
+  g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
+  g_izShowStatsFlags[id] = -1  // Initialize flags
+  g_fzShowUserStatsTime[id] = 0.0
+  g_izUserAttackerDistance[id] = 0
+  for ( new i = 0; i < MAX_PLAYERS; i++ )
+    g_izUserVictimDistance[id][i] = 0
+  return PLUGIN_CONTINUE
+}
+
+// Save killer info on death.
+public client_death(killer,victim,wpnindex,hitplace,TK) {
+
+  // Bail out if no killer.
+  if ( !killer ) return PLUGIN_CONTINUE
+
+  if ( killer != victim ) {
+    new iaVOrigin[3], iaKOrigin[3]
+    new iDistance
+    get_user_origin( victim, iaVOrigin )
+    get_user_origin( killer, iaKOrigin )
+    g_izKilled[victim][KILLED_KILLER_ID] = killer
+    g_izKilled[victim][KILLED_KILLER_HEALTH] = get_user_health( killer )
+    g_izKilled[victim][KILLED_KILLER_ARMOUR] = get_user_armor( killer )
+    g_izKilled[victim][KILLED_KILLER_STATSFIX] = 0
+    
+    iDistance = get_distance( iaVOrigin, iaKOrigin )
+    g_izUserAttackerDistance[victim] = iDistance
+    g_izUserVictimDistance[killer][victim] = iDistance
+  }
+  g_izKilled[victim][KILLED_TEAM] = get_user_team( victim )
+  g_izKilled[victim][KILLED_KILLER_STATSFIX] = 1
+
+  // Display kill stats for the player if round
+  // end stats was not processed.
+  if ( !g_iRoundEndProcessed )
+    kill_stats( victim )
+
+  return PLUGIN_CONTINUE
+}
+
+// Display hudmessage stats on death.
+// This will also update all round and game stats.
+// Must be called at least once per round.
+kill_stats( id ) {
+
+  // Bail out if user stats timer is non-zero, 
+  // ie function already called.
+  if ( g_fzShowUserStatsTime[id] > 0.0 ) return
+
+  // Flag kill stats displayed for this player.
+  g_fzShowUserStatsTime[id] = get_gametime()
+
+  // Add user death stats to user round stats
+  new izStats[8], izBody[8]
+  new iTeam, i
+  new iKiller
+
+  iKiller = g_izKilled[id][KILLED_KILLER_ID]
+
+  // Get user's team (if dead use the saved team)
+  if ( iKiller )
+    iTeam = g_izKilled[id][KILLED_TEAM] - 1
+  else
+    iTeam = get_user_team( id ) - 1
+  
+  get_user_name( id, g_izUserRndName[id], MAX_NAME_LENGTH )
+
+  if ( get_user_rstats( id, izStats, izBody ) ) {
+
+    // Update user's team round stats
+    if ( iTeam >= 0 && iTeam < MAX_TEAMS ) {
+      for ( i = 0; i < 8; i++ ) {
+        g_izTeamRndStats[iTeam][i]  += izStats[i]
+        g_izTeamGameStats[iTeam][i] += izStats[i]
+        g_izUserRndStats[0][i]      += izStats[i]
+        g_izUserGameStats[0][i]     += izStats[i]
+      }
+    }
+
+    // Update user's round stats
+    if ( g_izUserUserID[id] == get_user_userid( id ) ) {
+      for ( i = 0; i < 8; i++ ) {
+        g_izUserRndStats[id][i]  += izStats[i]
+        g_izUserGameStats[id][i] += izStats[i]
+      }
+    }
+    else {
+      g_izUserUserID[id] = get_user_userid( id )
+      for ( i = 0; i < 8; i++ ) {
+        g_izUserRndStats[id][i]  = izStats[i]
+        g_izUserGameStats[id][i] = izStats[i]
+      }
+    }
+
+  }  // endif( get_user_rstats() )
+  
+  // Report stats in the chat section, if player is killed.
+  if ( KillerChat && iKiller && iKiller != id ) {
+    if ( format_kill_ainfo( id, iKiller, g_sBuffer ) ) {
+      client_print( id, print_chat, "* %s", g_sBuffer )
+      format_kill_vinfo( id, iKiller, g_sBuffer )
+    }
+    client_print( id, print_chat, "* %s", g_sBuffer )
+  }
+  
+  // Display player stats info.
+  #if defined STATSX_DEBUG
+  log_amx( "Kill stats for #%d", id )
+  #endif
+  show_user_hudstats( id,  0.0 )
+}
+
+public eventEndRound() {
+
+  // Update local configuration vars with value in cvars.
+  get_config_cvars()
+
+  // If first end round event in the round, calculate team score.
+  if ( !g_iRoundEndTriggered ) {
+    read_data( 2, t_sText, MAX_TEXT_LENGTH )
+    if ( t_sText[7] == 't' )  // Terrorist wins
+      g_izTeamScore[0]++
+    else if ( t_sText[7] == 'c' )  // CT wins
+      g_izTeamScore[1]++
+  }
+  
+  // Flag round end triggered.
+  g_iRoundEndTriggered = 1
+
+  // Display round end stats to all players.
+  endround_stats()
+
+  return PLUGIN_CONTINUE
+}
+
+endround_stats() {
+
+  // Bail out if end round stats has already been processed
+  // or round end not triggered.
+  if ( g_iRoundEndProcessed || !g_iRoundEndTriggered ) return
+  
+  new iaPlayers[32], iPlayer, iPlayers, id
+
+  get_players( iaPlayers, iPlayers )
+
+  #if defined STATSX_OLD_DEATHMSG
+  // Bail out if not all killers got their damage event (ie last stats)
+  for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
+    id = iaPlayers[iPlayer]
+    if ( g_izKilled[id][KILLED_KILLER_ID] && !g_izKilled[id][KILLED_KILLER_STATSFIX] )
+      return
+  }
+  #endif
+
+  // Display attacker & victim list for all living players.
+  // This will also update all round and game stats for all players
+  // not killed.
+  #if defined STATSX_DEBUG
+  log_amx( "End round stats" )
+  #endif
+  for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
+    id = iaPlayers[iPlayer]
+    if ( g_fzShowUserStatsTime[id] == 0.0 )
+      kill_stats( id )
+  }
+  
+  g_sAwardAndScore[0] = 0
+
+  // Create round awards.
+  if ( ShowMostDisruptive )
+    add_most_disruptive( g_sAwardAndScore )
+  if ( ShowBestScore )
+    add_best_score( g_sAwardAndScore )
+
+  // Create round score. 
+  // Compensate HUD message if awards are disabled.
+  if ( ShowTeamScore || ShowTotalStats ) {
+    if ( ShowMostDisruptive && ShowBestScore )
+      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n" )
+    else if ( ShowMostDisruptive || ShowBestScore )
+      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n" )
+    else
+      add( g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n" )
+    if ( ShowTeamScore )
+      add_team_score( g_sAwardAndScore )
+    if ( ShowTotalStats )
+      add_total_stats( g_sAwardAndScore )
+  }
+
+  save_team_chatscore()
+  
+  // Get and save round end stats time.
+  g_fShowStatsTime = get_gametime()
+
+  // Display round end stats to all players.
+  for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
+    id = iaPlayers[iPlayer]
+    show_roundend_hudstats( id, 0.0 )
+  }
+
+  // Flag round end processed.
+  g_iRoundEndProcessed = 1
+}
+
+public eventTeamScore() {
+  new sTeamID[1+1], iTeamScore
+  read_data( 1, sTeamID, 1 )
+  iTeamScore = read_data(2)
+  g_izTeamEventScore[ (sTeamID[0]=='C') ? 1 : 0 ] = iTeamScore
+  return PLUGIN_CONTINUE
+}
+
+public eventIntermission() {
+  if ( EndPlayer || EndTop15 )
+    set_task( 1.0, "end_game_stats", 900 )
+}
+
+public end_game_stats() {
+  new iaPlayers[32], iPlayer, iPlayers, id
+
+  if ( EndPlayer ) {
+    get_players( iaPlayers, iPlayers )
+    for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
+      id = iaPlayers[iPlayer]
+      if ( !g_izStatsSwitch[id] ) continue  // Do not show any stats
+      cmdStatsMe( iaPlayers[iPlayer] )
+    }
+  }  
+  else if ( EndTop15 ) {
+    get_players( iaPlayers, iPlayers )
+    format_top15( g_sBuffer )
+    for ( iPlayer = 0; iPlayer < iPlayers; iPlayer++ ) {
+      id = iaPlayers[iPlayer]
+      if ( !g_izStatsSwitch[id] ) continue  // Do not show any stats
+      show_motd( iaPlayers[iPlayer], g_sBuffer, "Top 15" )
+    }
+  }
+  return PLUGIN_CONTINUE
+}
+
+public eventSpecMode( id ) { 
+  new sData[12]
+  read_data( 2, sData, 11 )
+  g_izSpecMode[id] = ( sData[10] == '2' )
+  return PLUGIN_CONTINUE
+} 
+
+public eventShowRank( id ) {
+  if ( SpecRankInfo && g_izSpecMode[id] ) {
+    new iPlayer = read_data(2)
+    if ( is_user_connected( iPlayer ) ) {
+      new izStats[8], izBody[8]
+      new iRankPos, iRankMax
+      get_user_name( iPlayer, t_sName, MAX_NAME_LENGTH )
+      iRankPos = get_user_stats( iPlayer, izStats, izBody )
+      iRankMax = get_statsnum()
+      set_hudtype_specmode()
+      show_hudmessage( id, "%L", id, "X_RANK_IS", t_sName, iRankPos, iRankMax )
+    }
+  }
+  return PLUGIN_CONTINUE
+}
+
+public client_connect( id ) {
+  if ( ShowStats ) {
+    get_user_info( id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH )
+    g_izStatsSwitch[id] = ( t_sText[0] ) ? str_to_num( t_sText ) : -1
+  }
+  else
+    g_izStatsSwitch[id] = 0
+
+  g_izKilled[id][KILLED_KILLER_ID] = 0
+  g_izKilled[id][KILLED_KILLER_STATSFIX] = 0
+  g_izShowStatsFlags[id] = 0  // Clear all flags
+  g_fzShowUserStatsTime[id] = 0.0
+
+  return PLUGIN_CONTINUE
+}
+
+public plugin_modules()
+{
+	require_module("csx")
+}
\ No newline at end of file
diff --git a/dlls/csx/source/CMisc.cpp b/dlls/csx/source/CMisc.cpp
new file mode 100755
index 00000000..a9569a77
--- /dev/null
+++ b/dlls/csx/source/CMisc.cpp
@@ -0,0 +1,299 @@
+
+
+#include "CMisc.h"
+#include "rank.h"
+
+// *****************************************************
+// class Grenades
+// *****************************************************
+void Grenades::put( edict_t* grenade, float time, int type, CPlayer* player  )
+{
+  Obj* a = new Obj;
+  if ( a == 0 ) return;
+  a->player = player;
+  a->grenade = grenade;
+  a->time = gpGlobals->time + time;
+  a->type = type;
+  a->prev = 0;
+  a->next = head;
+  if ( head ) head->prev = a;
+  head = a;
+}
+
+bool Grenades::find( edict_t* enemy, CPlayer** p, int* type )
+{
+  bool found = false;
+  Obj* a = head;
+  while ( a ){
+    if ( a->time > gpGlobals->time ) {
+      if ( a->grenade == enemy ) {
+        found = true;
+        *p = a->player;
+        *type = a->type;
+      }
+    }
+    else {
+      Obj* next = a->next;
+      if (a->prev)  a->prev->next = next;
+      else  head = next;
+      if (next) next->prev = a->prev;
+      delete a;
+      a = next;
+      continue;
+    }
+    a = a->next;
+  }
+
+  return found;
+}
+
+
+
+void Grenades::clear()
+{
+  while(head){
+    Obj* a = head->next;
+    delete head;
+    head = a;
+  }
+}
+
+// *****************************************************
+// class CPlayer
+// *****************************************************
+
+void CPlayer::Disconnect(){
+
+	if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
+		return;
+
+	rank->updatePosition( &life );
+	rank = 0;
+}
+
+void CPlayer::PutInServer(){
+
+	if ( ignoreBots(pEdict) )
+		return;
+
+	restartStats();
+	const char* name = STRING(pEdict->v.netname);
+	const char* unique = name;
+	switch((int)csstats_rank->value) {
+	case 1: 
+		if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
+			unique = name; // failed to get authid
+		break;
+	case 2:
+		unique = ip;
+	}
+	rank = g_rank.findEntryInRank( unique , name );
+}
+
+void CPlayer::Connect(const char* address ){
+	bot = IsBot();
+	strcpy(ip,address);
+	rank = 0;
+	clearStats = 0.0f;
+}
+
+void CPlayer::restartStats(bool all)
+{
+	if ( all ) memset(weapons,0,sizeof(weapons));
+	memset(weaponsRnd,0,sizeof(weaponsRnd));   //DEC-Weapon (Round) stats
+	memset(attackers,0,sizeof(attackers));
+	memset(victims,0,sizeof(victims));
+	memset(&life,0,sizeof(life));
+}
+
+void CPlayer::Init( int pi, edict_t* pe )
+{
+    pEdict = pe;
+    index = pi;
+	current = 0;
+	clearStats = 0.0f;
+	rank = 0;
+}
+
+void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
+
+	if ( ignoreBots(pEdict,pVictim->pEdict) )
+		return;
+
+	if ( pVictim->index == index ){ // killed self
+		pVictim->weapons[0].deaths++;
+		pVictim->life.deaths++;
+		pVictim->weaponsRnd[0].deaths++;       // DEC-Weapon (round) stats
+		return;
+	}
+
+	pVictim->attackers[index].name = weaponData[wweapon].name;
+	pVictim->attackers[index].kills++;
+	pVictim->attackers[index].hs += hhs;
+	pVictim->attackers[index].tks += ttk;
+	pVictim->attackers[0].kills++;
+	pVictim->attackers[0].hs += hhs;
+	pVictim->attackers[0].tks += ttk;
+	pVictim->weapons[pVictim->current].deaths++;
+	pVictim->weapons[0].deaths++;
+	pVictim->life.deaths++;
+	
+	
+	pVictim->weaponsRnd[pVictim->current].deaths++; // DEC-Weapon (round) stats
+	pVictim->weaponsRnd[0].deaths++;                   // DEC-Weapon (round) stats
+	
+	int vi = pVictim->index;
+	victims[vi].name = weaponData[wweapon].name;
+	victims[vi].deaths++;
+	victims[vi].hs += hhs;
+	victims[vi].tks += ttk;
+	victims[0].deaths++;
+	victims[0].hs += hhs;
+	victims[0].tks += ttk;
+	
+	weaponsRnd[wweapon].kills++;                // DEC-Weapon (round) stats
+	weaponsRnd[wweapon].hs += hhs;         // DEC-Weapon (round) stats
+	weaponsRnd[wweapon].tks += ttk;     // DEC-Weapon (round) stats
+	weaponsRnd[0].kills++;                     // DEC-Weapon (round) stats
+	weaponsRnd[0].hs += hhs;              // DEC-Weapon (round) stats
+	weaponsRnd[0].tks += ttk;          // DEC-Weapon (round) stats
+	
+	weapons[wweapon].kills++;
+	weapons[wweapon].hs += hhs;
+	weapons[wweapon].tks += ttk;
+	weapons[0].kills++;
+	weapons[0].hs += hhs;
+	weapons[0].tks += ttk;
+	life.kills++;
+	life.hs += hhs;
+	life.tks += ttk;
+}
+
+void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){
+
+	if ( ignoreBots(pEdict,pVictim->pEdict) )
+		return;
+
+	if ( index == pVictim->index ) return;
+
+	pVictim->attackers[index].hits++;
+	pVictim->attackers[index].damage += ddamage;
+	pVictim->attackers[index].bodyHits[bbody]++;
+	pVictim->attackers[0].hits++;
+	pVictim->attackers[0].damage += ddamage;
+	pVictim->attackers[0].bodyHits[bbody]++;
+
+
+	int vi = pVictim->index;
+	victims[vi].hits++;
+	victims[vi].damage += ddamage;
+	victims[vi].bodyHits[bbody]++;
+	victims[0].hits++;
+	victims[0].damage += ddamage;
+	victims[0].bodyHits[bbody]++;
+
+	weaponsRnd[wweapon].hits++;              // DEC-Weapon (round) stats
+	weaponsRnd[wweapon].damage += ddamage;    // DEC-Weapon (round) stats
+	weaponsRnd[wweapon].bodyHits[bbody]++;   // DEC-Weapon (round) stats
+	weaponsRnd[0].hits++;                   // DEC-Weapon (round) stats
+	weaponsRnd[0].damage += ddamage;         // DEC-Weapon (round) stats
+	weaponsRnd[0].bodyHits[bbody]++;        // DEC-Weapon (round) stats
+
+	weapons[wweapon].hits++;
+	weapons[wweapon].damage += ddamage;
+	weapons[wweapon].bodyHits[bbody]++;
+	weapons[0].hits++;
+	weapons[0].damage += ddamage;
+	weapons[0].bodyHits[bbody]++;
+
+	life.hits++;
+	life.damage += ddamage;
+	life.bodyHits[bbody]++;
+}
+
+
+void CPlayer::saveShot(int weapon){
+
+	if ( ignoreBots(pEdict) )
+		return;
+
+	victims[0].shots++;
+	weapons[weapon].shots++;
+	weapons[0].shots++;
+	life.shots++;
+	weaponsRnd[weapon].shots++;       // DEC-Weapon (round) stats
+	weaponsRnd[0].shots++;            // DEC-Weapon (round) stats
+}
+
+
+void CPlayer::saveBPlant(){
+	life.bPlants++;
+}
+
+void CPlayer::saveBExplode(){
+	life.bExplosions++;
+}
+
+void CPlayer::saveBDefusing(){
+	life.bDefusions++;
+}
+
+void CPlayer::saveBDefused(){
+	life.bDefused++;
+}
+
+
+// *****************************************************
+// class Forward
+// *****************************************************
+
+void Forward::put( AMX *a , int i ){
+	head = new AmxCall( a, i , head );
+}
+
+
+void Forward::clear(){
+	while ( head )  {
+		AmxCall* a = head->next;
+		delete head;
+		head = a;
+	}
+}
+
+void Forward::exec(int p1,int p2,int p3,int p4,int p5,int p6){
+	AmxCall* a = head;
+	while ( a ){
+		MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 6,p1, p2, p3, p4, p5, p6);
+		a = a->next;
+	}
+}
+
+void Forward::exec(int p1,int p2,int p3,int p4,int p5){
+	AmxCall* a = head;
+	while ( a ){
+		MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 5,p1, p2, p3, p4, p5);
+		a = a->next;
+	}
+}
+
+void Forward::exec(int p1,int p2){
+	AmxCall* a = head;
+	while ( a ){
+		MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 2,p1, p2);
+		a = a->next;
+	}
+}
+
+// *****************************************************
+
+bool ignoreBots (edict_t *pEnt, edict_t *pOther){
+	if ( !rankBots && ( pEnt->v.flags & FL_FAKECLIENT || ( pOther && pOther->v.flags & FL_FAKECLIENT ) ) )
+		return true;
+	return false;
+}
+
+bool isModuleActive(){
+	if ( !(int)CVAR_GET_FLOAT("csstats_pause") )
+		return true;
+	return false;
+}
\ No newline at end of file
diff --git a/dlls/csx/source/CMisc.h b/dlls/csx/source/CMisc.h
new file mode 100755
index 00000000..d13122f5
--- /dev/null
+++ b/dlls/csx/source/CMisc.h
@@ -0,0 +1,115 @@
+
+
+#ifndef CMISC_H
+#define CMISC_H
+
+#include "amxxmodule.h"
+#include "CRank.h"
+
+#define MAX_CWEAPONS		6
+
+#define CSW_HEGRENADE      4
+#define CSW_SMOKEGRENADE   9
+#define CSW_FLASHBANG     25
+
+// *****************************************************
+// class CPlayer
+// *****************************************************
+
+struct CPlayer {
+	edict_t* pEdict;
+	char ip[32];
+	int index;
+	int aiming;
+	int current;
+	bool bot;
+	float clearStats;
+	RankSystem::RankStats*	rank;
+
+	struct PlayerWeapon : Stats {
+		const char* name;
+		int	ammo;
+		int	clip;
+	};
+
+	PlayerWeapon	weapons[MAX_WEAPONS+MAX_CWEAPONS];
+	PlayerWeapon	attackers[33];
+	PlayerWeapon	victims[33];
+	Stats			weaponsRnd[MAX_WEAPONS+MAX_CWEAPONS]; // DEC-Weapon (Round) stats
+	Stats			life;
+
+	int teamId;
+
+	void Init(  int pi, edict_t* pe );
+	void Connect(const char* ip );
+	void PutInServer();
+	void Disconnect();
+	void saveKill(CPlayer* pVictim, int weapon, int hs, int tk);
+	void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
+	void saveShot(int weapon);
+
+	void saveBPlant();
+	void saveBExplode();
+	void saveBDefusing();
+	void saveBDefused();
+
+	void restartStats(bool all = true);
+	inline bool IsBot(){
+		const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
+		return ( auth && !strcmp( auth , "BOT" ) );
+	}
+	inline bool IsAlive(){
+		return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0));
+	}
+};
+
+// *****************************************************
+// class Grenades
+// *****************************************************
+
+class Grenades
+{
+  struct Obj 
+  {
+    CPlayer* player;
+    edict_t* grenade;
+    float time;
+    int type;
+    Obj* next;
+    Obj* prev;
+  } *head;
+
+public:
+  Grenades() { head = 0; }
+  ~Grenades() { clear(); }
+  void put( edict_t* grenade, float time, int type, CPlayer* player  );
+  bool find( edict_t* enemy, CPlayer** p, int* type );
+  void clear();
+};
+
+// *****************************************************
+// class Forward
+// *****************************************************
+
+class Forward
+{
+	struct AmxCall {
+		AMX *amx;
+		int iFunctionIdx;
+		AmxCall* next;
+		AmxCall( AMX *a , int i, AmxCall* n ): amx(a), iFunctionIdx(i), next(n) {}
+	} *head;
+public:
+	Forward() { head = 0; }
+	~Forward() { clear(); }
+	void clear();
+	void put( AMX *a , int i );
+	void exec(int p1,int p2,int p3,int p4,int p5,int p6);
+	void exec(int p1,int p2,int p3,int p4,int p5);
+	void exec(int p1,int p2);
+};
+
+#endif // CMISC_H
+
+
+
diff --git a/dlls/csx/source/CRank.cpp b/dlls/csx/source/CRank.cpp
new file mode 100755
index 00000000..4fff5f39
--- /dev/null
+++ b/dlls/csx/source/CRank.cpp
@@ -0,0 +1,308 @@
+
+
+#include "amxxmodule.h"
+#include "CRank.h"
+#include "rank.h"
+
+// *****************************************************
+// class Stats
+// *****************************************************
+Stats::Stats(){
+	hits = shots = damage = hs = tks = kills = deaths = bDefusions = bDefused = bPlants = bExplosions = 0;
+	memset( bodyHits , 0 ,sizeof( bodyHits ) );
+}
+void Stats::commit(Stats* a){
+	hits += a->hits;
+	shots += a->shots;
+	damage += a->damage;
+	hs += a->hs;
+	tks += a->tks;
+	kills += a->kills;
+	deaths += a->deaths;
+
+	bDefusions += a->bDefusions;
+	bDefused += a->bDefused;
+	bPlants += a->bPlants;
+	bExplosions += a->bExplosions;
+
+	for(int i = 1; i < 8; ++i)
+		bodyHits[i] += a->bodyHits[i];
+}
+
+
+// *****************************************************
+// class RankSystem
+// *****************************************************
+RankSystem::RankStats::RankStats( const char* uu, const char* nn, RankSystem* pp ) {
+	name = 0;
+	namelen = 0;
+	unique = 0;
+	uniquelen = 0;
+	score = 0;
+	parent = pp;
+	id = ++parent->rankNum;
+	next = prev = 0;
+	setName( nn );
+	setUnique( uu );
+}
+
+RankSystem::RankStats::~RankStats() {
+	delete[] name;
+	delete[] unique;
+	--parent->rankNum;
+}
+
+void RankSystem::RankStats::setName( const char* nn  )	{
+	delete[] name;
+	namelen = strlen(nn) + 1;
+	name = new char[namelen];
+	if ( name )
+		strcpy( name , nn );
+	else
+		namelen = 0;
+}
+
+void RankSystem::RankStats::setUnique( const char* nn  )	{
+	delete[] unique;
+	uniquelen = strlen(nn) + 1;
+	unique = new char[uniquelen];
+	if ( unique )
+		strcpy( unique , nn );	
+	else
+		uniquelen = 0;
+}
+
+RankSystem::RankSystem() { 
+	head = 0; 
+	tail = 0; 
+	rankNum = 0;
+	calc.code = 0;
+}
+
+RankSystem::~RankSystem() {
+	clear();
+}
+
+void RankSystem::put_before( RankStats* a, RankStats* ptr ){
+	a->next = ptr;
+	if ( ptr ){
+		a->prev = ptr->prev;
+		ptr->prev = a;
+	}
+	else{
+		a->prev = head;
+		head = a;
+	}
+	if ( a->prev )	a->prev->next = a;
+	else tail = a;
+}
+
+void  RankSystem::put_after( RankStats* a, RankStats* ptr ) {
+	a->prev = ptr;
+	if ( ptr ){
+		a->next = ptr->next;
+		ptr->next = a;
+	}
+	else{
+		a->next = tail;
+		tail = a;
+	}
+	if ( a->next )	a->next->prev = a;
+	else head = a;
+}
+
+void RankSystem::unlink( RankStats* ptr ){
+	if (ptr->prev) ptr->prev->next = ptr->next;
+	else tail = ptr->next;
+	if (ptr->next) ptr->next->prev = ptr->prev;
+	else head = ptr->prev;
+}
+
+void RankSystem::clear(){
+	while( tail ){
+		head = tail->next;
+		delete tail;
+		tail = head;
+	}
+}
+
+
+
+bool RankSystem::loadCalc(const char* filename, char* error)
+{
+	if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
+		(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
+		(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
+		(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
+		LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename);
+		MF_UnloadAmxScript(&calc.amx, &calc.code);
+		return false;
+	}
+	return true;
+}
+
+void RankSystem::unloadCalc()
+{
+	MF_UnloadAmxScript(&calc.amx , &calc.code);
+}
+
+RankSystem::RankStats* RankSystem::findEntryInRank(const char* unique, const char* name )
+{
+	RankStats* a = head;
+	
+	while ( a )
+	{
+		if (  strcmp( a->getUnique() ,unique ) == 0 )
+			return a;
+
+		a = a->prev;
+	}
+	a = new RankStats( unique ,name,this );
+	if ( a == 0 ) return 0;
+	put_after( a  , 0 );
+	return a;
+}
+
+void RankSystem::updatePos(  RankStats* rr ,  Stats* s )
+{
+	rr->addStats( s );
+	if ( calc.code ) {
+		calc.physAddr1[0] = rr->kills;
+		calc.physAddr1[1] = rr->deaths;
+		calc.physAddr1[2] = rr->hs;
+		calc.physAddr1[3] = rr->tks;
+		calc.physAddr1[4] = rr->shots;
+		calc.physAddr1[5] = rr->hits;
+		calc.physAddr1[6] = rr->damage;
+
+		calc.physAddr1[7] = rr->bDefusions;
+		calc.physAddr1[8] = rr->bDefused;
+		calc.physAddr1[9] = rr->bPlants;
+		calc.physAddr1[10] = rr->bExplosions;
+
+		for(int i = 1; i < 8; ++i)
+			calc.physAddr2[i] = rr->bodyHits[i];
+		cell result = 0;
+		int err;
+		if ((err = MF_AmxExec(&calc.amx,&result, calc.func ,2,calc.amxAddr1,calc.amxAddr2 )) != AMX_ERR_NONE)
+			LOG_CONSOLE( PLID, "Run time error %d on line %ld (plugin \"%s\")",	err,calc.amx.curline,LOCALINFO("csstats_score"));
+		rr->score = result;
+	}
+	else rr->score = rr->kills - rr->deaths;
+	
+
+	RankStats* aa = rr->next;
+	while ( aa && (aa->score <= rr->score) ) { // try to nominate
+		rr->goUp();
+		aa->goDown();
+		aa = aa->next;		// go to next rank
+	}
+	if ( aa != rr->next )
+	{
+		unlink( rr );
+		put_before( rr, aa );
+	}
+	else
+	{
+		aa = rr->prev;
+		while ( aa && (aa->score > rr->score) ) { // go down
+			rr->goDown();
+			aa->goUp();
+			aa = aa->prev;	// go to prev rank
+		}
+		if ( aa != rr->prev ){
+			unlink( rr );
+			put_after( rr, aa );
+		}
+	}
+
+}
+
+void RankSystem::loadRank( const char* filename )
+{
+	FILE *bfp = fopen( filename , "rb" );
+	
+	if ( !bfp ) return;
+	
+	short int i = 0;
+	fread(&i, 1 , sizeof(short int) , bfp);
+	
+	if (i == RANK_VERSION)
+	{
+		Stats d;
+		char unique[64], name[64];
+		fread(&i , 1, sizeof(short int), bfp);
+
+		while( i )
+		{
+			fread(name , i,sizeof(char) , bfp);
+			fread(&i , 1, sizeof(short int), bfp);
+			fread(unique , i,sizeof(char) , bfp);
+			fread(&d.tks, 1,sizeof(int), bfp);
+			fread(&d.damage, 1,sizeof(int), bfp);
+			fread(&d.deaths, 1,sizeof(int), bfp);
+			fread(&d.kills, 1,sizeof(int), bfp);
+			fread(&d.shots, 1,sizeof(int), bfp);
+			fread(&d.hits, 1,sizeof(int), bfp);
+			fread(&d.hs, 1,sizeof(int), bfp);
+
+			fread(&d.bDefusions, 1,sizeof(int), bfp);
+			fread(&d.bDefused, 1,sizeof(int), bfp);
+			fread(&d.bPlants, 1,sizeof(int), bfp);
+			fread(&d.bExplosions, 1,sizeof(int), bfp);
+
+			fread(d.bodyHits, 1,sizeof(d.bodyHits), bfp);
+			fread(&i , 1, sizeof(short int), bfp);
+
+			RankSystem::RankStats* a = findEntryInRank( unique , name );
+
+			if ( a ) a->updatePosition( &d );
+		}
+	}
+	fclose(bfp);
+}
+
+void RankSystem::saveRank( const char* filename )
+{
+	FILE *bfp = fopen(filename, "wb");
+	
+	if ( !bfp ) return;
+
+	short int i = RANK_VERSION;
+	
+	fwrite(&i, 1, sizeof(short int) , bfp);
+	
+	RankSystem::iterator a = front();
+	
+	while ( a )
+	{
+		if ( (*a).score != (1<<31) ) // score must be different than mincell
+		{
+			fwrite( &(*a).namelen , 1, sizeof(short int), bfp);
+			fwrite( (*a).name , (*a).namelen , sizeof(char) , bfp);
+			fwrite( &(*a).uniquelen , 1, sizeof(short int), bfp);
+			fwrite( (*a).unique ,  (*a).uniquelen , sizeof(char) , bfp);
+			fwrite( &(*a).tks, 1, sizeof(int), bfp);
+			fwrite( &(*a).damage, 1, sizeof(int), bfp);
+			fwrite( &(*a).deaths, 1, sizeof(int), bfp);
+			fwrite( &(*a).kills, 1, sizeof(int), bfp);
+			fwrite( &(*a).shots, 1, sizeof(int), bfp);
+			fwrite( &(*a).hits, 1, sizeof(int), bfp);
+			fwrite( &(*a).hs, 1, sizeof(int), bfp);
+
+			fwrite( &(*a).bDefusions, 1, sizeof(int), bfp);
+			fwrite( &(*a).bDefused, 1, sizeof(int), bfp);
+			fwrite( &(*a).bPlants, 1, sizeof(int), bfp);
+			fwrite( &(*a).bExplosions, 1, sizeof(int), bfp);
+
+			fwrite( (*a).bodyHits, 1, sizeof((*a).bodyHits), bfp);
+		}
+		
+		--a;
+	}
+
+	i = 0;
+	fwrite( &i , 1, sizeof(short int), bfp); // null terminator
+	
+	fclose(bfp);
+}
\ No newline at end of file
diff --git a/dlls/csx/source/CRank.h b/dlls/csx/source/CRank.h
new file mode 100755
index 00000000..20a23430
--- /dev/null
+++ b/dlls/csx/source/CRank.h
@@ -0,0 +1,122 @@
+
+
+#ifndef CRANK_H
+#define CRANK_H
+
+#define RANK_VERSION 11
+
+#include "amxxmodule.h"
+
+// *****************************************************
+// class Stats
+// *****************************************************
+
+struct Stats {
+	int hits;
+	int shots;
+	int damage;
+	int hs;
+	int tks;
+	int kills;
+	int deaths;
+	int bodyHits[9]; ////////////////////
+	
+	// SiDLuke start
+	int bPlants;
+	int bExplosions;
+	int bDefusions;
+	int bDefused;
+	// SiDLuke end :D
+
+	Stats();
+	void commit(Stats* a);
+};
+
+// *****************************************************
+// class RankSystem
+// *****************************************************
+
+class RankSystem
+{
+public:
+	class RankStats;
+	friend class RankStats;
+	class iterator;
+
+	class RankStats : public Stats {
+		friend class RankSystem;
+		friend class iterator;
+		RankSystem*	parent;
+		RankStats*	next;
+		RankStats*	prev;
+		char*		unique;
+		short int	uniquelen;
+		char*		name;
+		short int	namelen;
+		int			score;
+		int			id;
+		RankStats( const char* uu, const char* nn,  RankSystem* pp );
+		~RankStats();
+		void setUnique( const char* nn  );
+		inline void goDown() {++id;}
+		inline void goUp() {--id;}
+		inline void addStats(Stats* a) { commit( a ); }
+	public:
+		void setName( const char* nn  );
+		inline const char* getName() const { return name ? name : ""; }
+		inline const char* getUnique() const { return unique ? unique : ""; }
+		inline int getPosition() const { return id; }
+		inline void updatePosition( Stats* points ) {
+			parent->updatePos( this , points );
+		}
+	};
+
+private:
+	RankStats* head;
+	RankStats* tail;
+	int rankNum;
+
+	struct scoreCalc{
+		AMX amx;
+		void* code;
+		int func;
+		cell amxAddr1;
+		cell amxAddr2;
+		cell *physAddr1;
+		cell *physAddr2;
+	} calc;
+
+	void put_before( RankStats* a, RankStats* ptr );
+	void put_after( RankStats* a, RankStats* ptr );
+	void unlink( RankStats* ptr );
+	void updatePos( RankStats* r ,  Stats* s );
+	
+public:
+
+	RankSystem();
+	~RankSystem();
+
+	void saveRank( const char* filename );
+	void loadRank( const char* filename );
+	RankStats* findEntryInRank(const char* unique, const char* name );
+	bool loadCalc(const char* filename, char* error);
+	inline int getRankNum( ) const { return rankNum; }
+	void clear();
+	void unloadCalc();
+
+	class iterator {
+		RankStats* ptr;
+	public:
+		iterator(RankStats* a): ptr(a){}
+		inline iterator& operator--() { ptr = ptr->prev; return *this;}
+		inline iterator& operator++() {	ptr = ptr->next; return *this; }
+		inline RankStats& operator*() {	return *ptr;}
+		operator bool () { return (ptr != 0); }
+	};
+
+	inline iterator front() {  return iterator(head);  }
+	inline iterator begin() {  return iterator(tail);  }
+};
+
+
+#endif
\ No newline at end of file
diff --git a/dlls/csx/source/Makefile b/dlls/csx/source/Makefile
new file mode 100755
index 00000000..3c0c58c3
--- /dev/null
+++ b/dlls/csx/source/Makefile
@@ -0,0 +1,102 @@
+MODNAME = csx_amxx
+SRCFILES = amxxmodule.cpp CMisc.cpp CRank.cpp meta_api.cpp rank.cpp usermsg.cpp
+
+EXTRA_LIBS_LINUX =
+EXTRA_LIBS_WIN32 =
+EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
+EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
+
+EXTRA_INCLUDEDIRS = -Iextra/include -I../amx
+
+EXTRA_FLAGS = -Dstrcmpi=strcasecmp
+
+AMXDIR=../amx
+SDKSRC=../sdk
+METADIR=../metamod
+
+OBJDIR_LINUX=obj.linux
+OBJDIR_WIN32=obj.win32
+SRCDIR=.
+
+ifdef windir
+	OS=WIN32
+else
+	OS=LINUX
+endif
+
+CC_LINUX=gcc
+ifeq "$(OS)" "WIN32"
+	CC_WIN32=gcc
+	LD_WINDLL=dllwrap
+	DEFAULT=win32
+	CLEAN=clean_win32
+else
+	CC_WIN32=/usr/local/cross-tools/i386-mingw32msvc/bin/gcc
+	LD_WINDLL=/usr/local/cross-tools/bin/i386-mingw32msvc-dllwrap
+	DEFAULT=linux win32
+	CLEAN=clean_both
+endif
+
+
+LIBFILE_LINUX = $(MODNAME)_i386.so
+LIBFILE_WIN32 = $(MODNAME).dll
+TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
+TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32)
+
+FILES_ALL = *.cpp *.h [A-Z]* *.rc
+ifeq "$(OS)" "LINUX"
+	ASRCFILES := $(shell ls -t $(SRCFILES))
+else
+	ASRCFILES := $(shell dir /b)
+endif
+OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
+OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
+
+CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
+	-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
+	-malign-jumps=2 -malign-functions=2 -s -DNDEBUG
+
+INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(AMXDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
+CFLAGS=-Wall -Wno-unknown-pragmas
+ODEF = -DOPT_TYPE=\"optimized\"
+CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS)
+
+DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
+DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
+LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
+LINK_WIN32=$(LD_WINDLL) -mwindows --add-stdcall-alias $(OBJ_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@
+
+$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
+	$(DO_CC_LINUX)
+
+$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp
+	$(DO_CC_WIN32)
+
+default: $(DEFAULT)
+
+$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX)
+	$(LINK_LINUX)
+
+$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32)
+	$(LINK_WIN32)
+
+$(OBJDIR_LINUX):
+	mkdir $@
+
+$(OBJDIR_WIN32):
+	mkdir $@
+
+win32: $(TARGET_WIN32)
+
+linux: $(TARGET_LINUX)
+
+clean: $(CLEAN)
+
+clean_both:
+	-rm -f $(OBJDIR_LINUX)/*
+	-rm -f $(OBJDIR_WIN32)/*
+
+clean_win32:
+	del /q $(OBJDIR_WIN32)
+
+
diff --git a/dlls/csx/source/amxxmodule.cpp b/dlls/csx/source/amxxmodule.cpp
new file mode 100755
index 00000000..88a48c5a
--- /dev/null
+++ b/dlls/csx/source/amxxmodule.cpp
@@ -0,0 +1,3004 @@
+/* AMX Mod X
+*
+* by the AMX Mod X Development Team
+*  originally developed by OLO
+*
+* Parts Copyright (C) 2001-2003 Will Day 
+*
+*  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.
+*
+*  Description: AMX Mod X Module Interface Functions
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "amxxmodule.h"
+
+/************* METAMOD SUPPORT *************/
+#ifdef USE_METAMOD
+
+enginefuncs_t g_engfuncs;
+globalvars_t  *gpGlobals;
+
+// GetEntityAPI2 functions
+static DLL_FUNCTIONS g_EntityAPI_Table = 
+{
+#ifdef FN_GameDLLInit
+	FN_GameDLLInit,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchSpawn
+	FN_DispatchSpawn,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchThink
+	FN_DispatchThink,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchUse
+	FN_DispatchUse,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchTouch
+	FN_DispatchTouch,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchBlocked
+	FN_DispatchBlocked,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchKeyValue
+	FN_DispatchKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchSave
+	FN_DispatchSave,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchRestore
+	FN_DispatchRestore,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchObjectCollsionBox
+	FN_DispatchObjectCollsionBox,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveWriteFields
+	FN_SaveWriteFields,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveReadFields
+	FN_SaveReadFields,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveGlobalState
+	FN_SaveGlobalState,
+#else
+	NULL,
+#endif
+#ifdef FN_RestoreGlobalState
+	FN_RestoreGlobalState,
+#else
+	NULL,
+#endif
+#ifdef FN_ResetGlobalState
+	FN_ResetGlobalState,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientConnect
+	FN_ClientConnect,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientDisconnect
+	FN_ClientDisconnect,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientKill
+	FN_ClientKill,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientPutInServer
+	FN_ClientPutInServer,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientCommand
+	FN_ClientCommand,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientUserInfoChanged
+	FN_ClientUserInfoChanged,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerActivate
+	FN_ServerActivate,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerDeactivate
+	FN_ServerDeactivate,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerPreThink
+	FN_PlayerPreThink,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerPostThink
+	FN_PlayerPostThink,
+#else
+	NULL,
+#endif
+#ifdef FN_StartFrame
+	FN_StartFrame,
+#else
+	NULL,
+#endif
+#ifdef FN_ParmsNewLevel
+	FN_ParmsNewLevel,
+#else
+	NULL,
+#endif
+#ifdef FN_ParmsChangeLevel
+	FN_ParmsChangeLevel,
+#else
+	NULL,
+#endif
+#ifdef FN_GetGameDescription
+	FN_GetGameDescription,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerCustomization
+	FN_PlayerCustomization,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorConnect
+	FN_SpectatorConnect,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorDisconnect
+	FN_SpectatorDisconnect,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorThink
+	FN_SpectatorThink,
+#else
+	NULL,
+#endif
+#ifdef FN_Sys_Error
+	FN_Sys_Error,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_Move
+	FN_PM_Move,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_Init
+	FN_PM_Init,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_FindTextureType
+	FN_PM_FindTextureType,
+#else
+	NULL,
+#endif
+#ifdef FN_SetupVisibility
+	FN_SetupVisibility,
+#else
+	NULL,
+#endif
+#ifdef FN_UpdateClientData
+	FN_UpdateClientData,
+#else
+	NULL,
+#endif
+#ifdef FN_AddToFullPack
+	FN_AddToFullPack,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateBaseline
+	FN_CreateBaseline,
+#else
+	NULL,
+#endif
+#ifdef FN_RegisterEncoders
+	FN_RegisterEncoders,
+#else
+	NULL,
+#endif
+#ifdef FN_GetWeaponData
+	FN_GetWeaponData,
+#else
+	NULL,
+#endif
+#ifdef FN_CmdStart
+	FN_CmdStart,
+#else
+	NULL,
+#endif
+#ifdef FN_CmdEnd
+	FN_CmdEnd,
+#else
+	NULL,
+#endif
+#ifdef FN_ConnectionlessPacket
+	FN_ConnectionlessPacket,
+#else
+	NULL,
+#endif
+#ifdef FN_GetHullBounds
+	FN_GetHullBounds,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateInstancedBaselines
+	FN_CreateInstancedBaselines,
+#else
+	NULL,
+#endif
+#ifdef FN_InconsistentFile
+	FN_InconsistentFile,
+#else
+	NULL,
+#endif
+#ifdef FN_AllowLagCompensation
+	FN_AllowLagCompensation
+#else
+	NULL
+#endif
+}; // g_EntityAPI2_Table
+
+// GetEntityAPI2_Post functions
+static DLL_FUNCTIONS g_EntityAPI_Post_Table = 
+{
+#ifdef FN_GameDLLInit_Post
+	FN_GameDLLInit_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchSpawn_Post
+	FN_DispatchSpawn_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchThink_Post
+	FN_DispatchThink_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchUse_Post
+	FN_DispatchUse_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchTouch_Post
+	FN_DispatchTouch_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchBlocked_Post
+	FN_DispatchBlocked_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchKeyValue_Post
+	FN_DispatchKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchSave_Post
+	FN_DispatchSave_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchRestore_Post
+	FN_DispatchRestore_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DispatchObjectCollsionBox_Post
+	FN_DispatchObjectCollsionBox_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveWriteFields_Post
+	FN_SaveWriteFields_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveReadFields_Post
+	FN_SaveReadFields_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveGlobalState_Post
+	FN_SaveGlobalState_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RestoreGlobalState_Post
+	FN_RestoreGlobalState_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ResetGlobalState_Post
+	FN_ResetGlobalState_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientConnect_Post
+	FN_ClientConnect_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientDisconnect_Post
+	FN_ClientDisconnect_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientKill_Post
+	FN_ClientKill_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientPutInServer_Post
+	FN_ClientPutInServer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientCommand_Post
+	FN_ClientCommand_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientUserInfoChanged_Post
+	FN_ClientUserInfoChanged_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerActivate_Post
+	FN_ServerActivate_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerDeactivate_Post
+	FN_ServerDeactivate_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerPreThink_Post
+	FN_PlayerPreThink_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerPostThink_Post
+	FN_PlayerPostThink_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_StartFrame_Post
+	FN_StartFrame_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ParmsNewLevel_Post
+	FN_ParmsNewLevel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ParmsChangeLevel_Post
+	FN_ParmsChangeLevel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetGameDescription_Post
+	FN_GetGameDescription_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PlayerCustomization_Post
+	FN_PlayerCustomization_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorConnect_Post
+	FN_SpectatorConnect_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorDisconnect_Post
+	FN_SpectatorDisconnect_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SpectatorThink_Post
+	FN_SpectatorThink_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Sys_Error_Post
+	FN_Sys_Error_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_Move_Post
+	FN_PM_Move_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_Init_Post
+	FN_PM_Init_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PM_FindTextureType_Post
+	FN_PM_FindTextureType_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetupVisibility_Post
+	FN_SetupVisibility_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_UpdateClientData_Post
+	FN_UpdateClientData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AddToFullPack_Post
+	FN_AddToFullPack_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateBaseline_Post
+	FN_CreateBaseline_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RegisterEncoders_Post
+	FN_RegisterEncoders_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetWeaponData_Post
+	FN_GetWeaponData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CmdStart_Post
+	FN_CmdStart_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CmdEnd_Post
+	FN_CmdEnd_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ConnectionlessPacket_Post
+	FN_ConnectionlessPacket_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetHullBounds_Post
+	FN_GetHullBounds_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateInstancedBaselines_Post
+	FN_CreateInstancedBaselines_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_InconsistentFile_Post
+	FN_InconsistentFile_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AllowLagCompensation
+	FN_AllowLagCompensation,
+#else
+	NULL,
+#endif
+}; // g_EntityAPI2_Table
+
+static enginefuncs_t g_EngineFuncs_Table = 
+{
+#ifdef FN_PrecacheModel
+	FN_PrecacheModel,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheSound
+	FN_PrecacheSound,
+#else
+	NULL,
+#endif
+#ifdef FN_SetModel
+	FN_SetModel,
+#else
+	NULL,
+#endif
+#ifdef FN_ModelIndex
+	FN_ModelIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_ModelFrames
+	FN_ModelFrames,
+#else
+	NULL,
+#endif
+#ifdef FN_SetSize
+	FN_SetSize,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangeLevel
+	FN_ChangeLevel,
+#else
+	NULL,
+#endif
+#ifdef FN_GetSpawnParms
+	FN_GetSpawnParms,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveSpawnParms
+	FN_SaveSpawnParms,
+#else
+	NULL,
+#endif
+#ifdef FN_VecToYaw
+	FN_VecToYaw,
+#else
+	NULL,
+#endif
+#ifdef FN_VecToAngles
+	FN_VecToAngles,
+#else
+	NULL,
+#endif
+#ifdef FN_MoveToOrigin
+	FN_MoveToOrigin,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangeYaw
+	FN_ChangeYaw,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangePitch
+	FN_ChangePitch,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityByString
+	FN_FindEntityByString,
+#else
+	NULL,
+#endif
+#ifdef FN_GetEntityIllum
+	FN_GetEntityIllum,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityInSphere
+	FN_FindEntityInSphere,
+#else
+	NULL,
+#endif
+#ifdef FN_FindClientInPVS
+	FN_FindClientInPVS,
+#else
+	NULL,
+#endif
+#ifdef FN_EntitiesInPVS
+	FN_EntitiesInPVS,
+#else
+	NULL,
+#endif
+#ifdef FN_MakeVectors
+	FN_MakeVectors,
+#else
+	NULL,
+#endif
+#ifdef FN_AngleVectors
+	FN_AngleVectors,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateEntity
+	FN_CreateEntity,
+#else
+	NULL,
+#endif
+#ifdef FN_RemoveEntity
+	FN_RemoveEntity,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateNamedEntity
+	FN_CreateNamedEntity,
+#else
+	NULL,
+#endif
+#ifdef FN_MakeStatic
+	FN_MakeStatic,
+#else
+	NULL,
+#endif
+#ifdef FN_EntIsOnFloor
+	FN_EntIsOnFloor,
+#else
+	NULL,
+#endif
+#ifdef FN_DropToFloor
+	FN_DropToFloor,
+#else
+	NULL,
+#endif
+#ifdef FN_WalkMove
+	FN_WalkMove,
+#else
+	NULL,
+#endif
+#ifdef FN_SetOrigin
+	FN_SetOrigin,
+#else
+	NULL,
+#endif
+#ifdef FN_EmitSound
+	FN_EmitSound,
+#else
+	NULL,
+#endif
+#ifdef FN_EmitAmbientSound
+	FN_EmitAmbientSound,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceLine
+	FN_TraceLine,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceToss
+	FN_TraceToss,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceMonsterHull
+	FN_TraceMonsterHull,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceHull
+	FN_TraceHull,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceModel
+	FN_TraceModel,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceTexture
+	FN_TraceTexture,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceSphere
+	FN_TraceSphere,
+#else
+	NULL,
+#endif
+#ifdef FN_GetAimVector
+	FN_GetAimVector,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerCommand
+	FN_ServerCommand,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerExecute
+	FN_ServerExecute,
+#else
+	NULL,
+#endif
+#ifdef FN_engClientCommand
+	FN_engClientCommand,
+#else
+	NULL,
+#endif
+#ifdef FN_ParticleEffect
+	FN_ParticleEffect,
+#else
+	NULL,
+#endif
+#ifdef FN_LightStyle
+	FN_LightStyle,
+#else
+	NULL,
+#endif
+#ifdef FN_DecalIndex
+	FN_DecalIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_PointContents
+	FN_PointContents,
+#else
+	NULL,
+#endif
+#ifdef FN_MessageBegin
+	FN_MessageBegin,
+#else
+	NULL,
+#endif
+#ifdef FN_MessageEnd
+	FN_MessageEnd,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteByte
+	FN_WriteByte,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteChar
+	FN_WriteChar,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteShort
+	FN_WriteShort,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteLong
+	FN_WriteLong,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteAngle
+	FN_WriteAngle,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteCoord
+	FN_WriteCoord,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteString
+	FN_WriteString,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteEntity
+	FN_WriteEntity,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarRegister
+	FN_CVarRegister,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetFloat
+	FN_CVarGetFloat,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetString
+	FN_CVarGetString,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarSetFloat
+	FN_CVarSetFloat,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarSetString
+	FN_CVarSetString,
+#else
+	NULL,
+#endif
+#ifdef FN_AlertMessage
+	FN_AlertMessage,
+#else
+	NULL,
+#endif
+#ifdef FN_EngineFprintf
+	FN_EngineFprintf,
+#else
+	NULL,
+#endif
+#ifdef FN_PvAllocEntPrivateData
+	FN_PvAllocEntPrivateData,
+#else
+	NULL,
+#endif
+#ifdef FN_PvEntPrivateData
+	FN_PvEntPrivateData,
+#else
+	NULL,
+#endif
+#ifdef FN_FreeEntPrivateData
+	FN_FreeEntPrivateData,
+#else
+	NULL,
+#endif
+#ifdef FN_SzFromIndex
+	FN_SzFromIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_AllocString
+	FN_AllocString,
+#else
+	NULL,
+#endif
+#ifdef FN_GetVarsOfEnt
+	FN_GetVarsOfEnt,
+#else
+	NULL,
+#endif
+#ifdef FN_PEntityOfEntOffset
+	FN_PEntityOfEntOffset,
+#else
+	NULL,
+#endif
+#ifdef FN_EntOffsetOfPEntity
+	FN_EntOffsetOfPEntity,
+#else
+	NULL,
+#endif
+#ifdef FN_IndexOfEdict
+	FN_IndexOfEdict,
+#else
+	NULL,
+#endif
+#ifdef FN_PEntityOfEntIndex
+	FN_PEntityOfEntIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityByVars
+	FN_FindEntityByVars,
+#else
+	NULL,
+#endif
+#ifdef FN_GetModelPtr
+	FN_GetModelPtr,
+#else
+	NULL,
+#endif
+#ifdef FN_RegUserMsg
+	FN_RegUserMsg,
+#else
+	NULL,
+#endif
+#ifdef FN_AnimationAutomove
+	FN_AnimationAutomove,
+#else
+	NULL,
+#endif
+#ifdef FN_GetBonePosition
+	FN_GetBonePosition,
+#else
+	NULL,
+#endif
+#ifdef FN_FunctionFromName
+	FN_FunctionFromName,
+#else
+	NULL,
+#endif
+#ifdef FN_NameForFunction
+	FN_NameForFunction,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientPrintf
+	FN_ClientPrintf,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerPrint
+	FN_ServerPrint,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Args
+	FN_Cmd_Args,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Argv
+	FN_Cmd_Argv,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Argc
+	FN_Cmd_Argc,
+#else
+	NULL,
+#endif
+#ifdef FN_GetAttachment
+	FN_GetAttachment,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_Init
+	FN_CRC32_Init,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_ProcessBuffer
+	FN_CRC32_ProcessBuffer,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_ProcessByte
+	FN_CRC32_ProcessByte,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_Final
+	FN_CRC32_Final,
+#else
+	NULL,
+#endif
+#ifdef FN_RandomLong
+	FN_RandomLong,
+#else
+	NULL,
+#endif
+#ifdef FN_RandomFloat
+	FN_RandomFloat,
+#else
+	NULL,
+#endif
+#ifdef FN_SetView
+	FN_SetView,
+#else
+	NULL,
+#endif
+#ifdef FN_Time
+	FN_Time,
+#else
+	NULL,
+#endif
+#ifdef FN_CrosshairAngle
+	FN_CrosshairAngle,
+#else
+	NULL,
+#endif
+#ifdef FN_LoadFileForMe
+	FN_LoadFileForMe,
+#else
+	NULL,
+#endif
+#ifdef FN_FreeFile
+	FN_FreeFile,
+#else
+	NULL,
+#endif
+#ifdef FN_EndSection
+	FN_EndSection,
+#else
+	NULL,
+#endif
+#ifdef FN_CompareFileTime
+	FN_CompareFileTime,
+#else
+	NULL,
+#endif
+#ifdef FN_GetGameDir
+	FN_GetGameDir,
+#else
+	NULL,
+#endif
+#ifdef FN_Cvar_RegisterVariable
+	FN_Cvar_RegisterVariable,
+#else
+	NULL,
+#endif
+#ifdef FN_FadeClientVolume
+	FN_FadeClientVolume,
+#else
+	NULL,
+#endif
+#ifdef FN_SetClientMaxspeed
+	FN_SetClientMaxspeed,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateFakeClient
+	FN_CreateFakeClient,
+#else
+	NULL,
+#endif
+#ifdef FN_RunPlayerMove
+	FN_RunPlayerMove,
+#else
+	NULL,
+#endif
+#ifdef FN_NumberOfEntities
+	FN_NumberOfEntities,
+#else
+	NULL,
+#endif
+#ifdef FN_GetInfoKeyBuffer
+	FN_GetInfoKeyBuffer,
+#else
+	NULL,
+#endif
+#ifdef FN_InfoKeyValue
+	FN_InfoKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_SetKeyValue
+	FN_SetKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_SetClientKeyValue
+	FN_SetClientKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_IsMapValid
+	FN_IsMapValid,
+#else
+	NULL,
+#endif
+#ifdef FN_StaticDecal
+	FN_StaticDecal,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheGeneric
+	FN_PrecacheGeneric,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerUserId
+	FN_GetPlayerUserId,
+#else
+	NULL,
+#endif
+#ifdef FN_BuildSoundMsg
+	FN_BuildSoundMsg,
+#else
+	NULL,
+#endif
+#ifdef FN_IsDedicatedServer
+	FN_IsDedicatedServer,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetPointer
+	FN_CVarGetPointer,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerWONId
+	FN_GetPlayerWONId,
+#else
+	NULL,
+#endif
+#ifdef FN_Info_RemoveKey
+	FN_Info_RemoveKey,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPhysicsKeyValue
+	FN_GetPhysicsKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_SetPhysicsKeyValue
+	FN_SetPhysicsKeyValue,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPhysicsInfoString
+	FN_GetPhysicsInfoString,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheEvent
+	FN_PrecacheEvent,
+#else
+	NULL,
+#endif
+#ifdef FN_PlaybackEvent
+	FN_PlaybackEvent,
+#else
+	NULL,
+#endif
+#ifdef FN_SetFatPVS
+	FN_SetFatPVS,
+#else
+	NULL,
+#endif
+#ifdef FN_SetFatPAS
+	FN_SetFatPAS,
+#else
+	NULL,
+#endif
+#ifdef FN_CheckVisibility
+	FN_CheckVisibility,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaSetField
+	FN_DeltaSetField,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaUnsetField
+	FN_DeltaUnsetField,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaAddEncoder
+	FN_DeltaAddEncoder,
+#else
+	NULL,
+#endif
+#ifdef FN_GetCurrentPlayer
+	FN_GetCurrentPlayer,
+#else
+	NULL,
+#endif
+#ifdef FN_CanSkipPlayer
+	FN_CanSkipPlayer,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaFindField
+	FN_DeltaFindField,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaSetFieldByIndex
+	FN_DeltaSetFieldByIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaUnsetFieldByIndex
+	FN_DeltaUnsetFieldByIndex,
+#else
+	NULL,
+#endif
+#ifdef FN_SetGroupMask
+	FN_SetGroupMask,
+#else
+	NULL,
+#endif
+#ifdef FN_engCreateInstancedBaseline
+	FN_engCreateInstancedBaseline,
+#else
+	NULL,
+#endif
+#ifdef FN_Cvar_DirectSet
+	FN_Cvar_DirectSet,
+#else
+	NULL,
+#endif
+#ifdef FN_ForceUnmodified
+	FN_ForceUnmodified,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerStats
+	FN_GetPlayerStats,
+#else
+	NULL,
+#endif
+#ifdef FN_AddServerCommand
+	FN_AddServerCommand,
+#else
+	NULL,
+#endif
+#ifdef FN_Voice_GetClientListening
+	FN_Voice_GetClientListening,
+#else
+	NULL,
+#endif
+#ifdef FN_Voice_SetClientListening
+	FN_Voice_SetClientListening,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerAuthId
+	FN_GetPlayerAuthId
+#else
+	NULL
+#endif
+}; // g_EngineFuncs_Table
+
+
+static enginefuncs_t g_EngineFuncs_Post_Table =
+{
+#ifdef FN_PrecacheModel_Post
+	FN_PrecacheModel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheSound_Post
+	FN_PrecacheSound_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetModel_Post
+	FN_SetModel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ModelIndex_Post
+	FN_ModelIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ModelFrames_Post
+	FN_ModelFrames_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetSize_Post
+	FN_SetSize_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangeLevel_Post
+	FN_ChangeLevel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetSpawnParms_Post
+	FN_GetSpawnParms_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SaveSpawnParms_Post
+	FN_SaveSpawnParms_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_VecToYaw_Post
+	FN_VecToYaw_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_VecToAngles_Post
+	FN_VecToAngles_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_MoveToOrigin_Post
+	FN_MoveToOrigin_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangeYaw_Post
+	FN_ChangeYaw_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ChangePitch_Post
+	FN_ChangePitch_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityByString_Post
+	FN_FindEntityByString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetEntityIllum_Post
+	FN_GetEntityIllum_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityInSphere_Post
+	FN_FindEntityInSphere_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FindClientInPVS_Post
+	FN_FindClientInPVS_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EntitiesInPVS_Post
+	FN_EntitiesInPVS_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_MakeVectors_Post
+	FN_MakeVectors_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AngleVectors_Post
+	FN_AngleVectors_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateEntity_Post
+	FN_CreateEntity_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RemoveEntity_Post
+	FN_RemoveEntity_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateNamedEntity_Post
+	FN_CreateNamedEntity_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_MakeStatic_Post
+	FN_MakeStatic_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EntIsOnFloor_Post
+	FN_EntIsOnFloor_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DropToFloor_Post
+	FN_DropToFloor_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WalkMove_Post
+	FN_WalkMove_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetOrigin_Post
+	FN_SetOrigin_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EmitSound_Post
+	FN_EmitSound_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EmitAmbientSound_Post
+	FN_EmitAmbientSound_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceLine_Post
+	FN_TraceLine_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceToss_Post
+	FN_TraceToss_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceMonsterHull_Post
+	FN_TraceMonsterHull_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceHull_Post
+	FN_TraceHull_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceModel_Post
+	FN_TraceModel_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceTexture_Post
+	FN_TraceTexture_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_TraceSphere_Post
+	FN_TraceSphere_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetAimVector_Post
+	FN_GetAimVector_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerCommand_Post
+	FN_ServerCommand_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerExecute_Post
+	FN_ServerExecute_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_engClientCommand_Post
+	FN_engClientCommand_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ParticleEffect_Post
+	FN_ParticleEffect_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_LightStyle_Post
+	FN_LightStyle_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DecalIndex_Post
+	FN_DecalIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PointContents_Post
+	FN_PointContents_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_MessageBegin_Post
+	FN_MessageBegin_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_MessageEnd_Post
+	FN_MessageEnd_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteByte_Post
+	FN_WriteByte_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteChar_Post
+	FN_WriteChar_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteShort_Post
+	FN_WriteShort_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteLong_Post
+	FN_WriteLong_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteAngle_Post
+	FN_WriteAngle_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteCoord_Post
+	FN_WriteCoord_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteString_Post
+	FN_WriteString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_WriteEntity_Post
+	FN_WriteEntity_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarRegister_Post
+	FN_CVarRegister_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetFloat_Post
+	FN_CVarGetFloat_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetString_Post
+	FN_CVarGetString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarSetFloat_Post
+	FN_CVarSetFloat_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarSetString_Post
+	FN_CVarSetString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AlertMessage_Post
+	FN_AlertMessage_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EngineFprintf_Post
+	FN_EngineFprintf_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PvAllocEntPrivateData_Post
+	FN_PvAllocEntPrivateData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PvEntPrivateData_Post
+	FN_PvEntPrivateData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FreeEntPrivateData_Post
+	FN_FreeEntPrivateData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SzFromIndex_Post
+	FN_SzFromIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AllocString_Post
+	FN_AllocString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetVarsOfEnt_Post
+	FN_GetVarsOfEnt_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PEntityOfEntOffset_Post
+	FN_PEntityOfEntOffset_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EntOffsetOfPEntity_Post
+	FN_EntOffsetOfPEntity_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_IndexOfEdict_Post
+	FN_IndexOfEdict_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PEntityOfEntIndex_Post
+	FN_PEntityOfEntIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FindEntityByVars_Post
+	FN_FindEntityByVars_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetModelPtr_Post
+	FN_GetModelPtr_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RegUserMsg_Post
+	FN_RegUserMsg_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AnimationAutomove_Post
+	FN_AnimationAutomove_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetBonePosition_Post
+	FN_GetBonePosition_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FunctionFromName_Post
+	FN_FunctionFromName_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_NameForFunction_Post
+	FN_NameForFunction_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ClientPrintf_Post
+	FN_ClientPrintf_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ServerPrint_Post
+	FN_ServerPrint_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Args_Post
+	FN_Cmd_Args_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Argv_Post
+	FN_Cmd_Argv_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Cmd_Argc_Post
+	FN_Cmd_Argc_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetAttachment_Post
+	FN_GetAttachment_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_Init_Post
+	FN_CRC32_Init_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_ProcessBuffer_Post
+	FN_CRC32_ProcessBuffer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_ProcessByte_Post
+	FN_CRC32_ProcessByte_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CRC32_Final_Post
+	FN_CRC32_Final_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RandomLong_Post
+	FN_RandomLong_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RandomFloat_Post
+	FN_RandomFloat_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetView_Post
+	FN_SetView_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Time_Post
+	FN_Time_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CrosshairAngle_Post
+	FN_CrosshairAngle_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_LoadFileForMe_Post
+	FN_LoadFileForMe_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FreeFile_Post
+	FN_FreeFile_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_EndSection_Post
+	FN_EndSection_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CompareFileTime_Post
+	FN_CompareFileTime_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetGameDir_Post
+	FN_GetGameDir_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Cvar_RegisterVariable_Post
+	FN_Cvar_RegisterVariable_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_FadeClientVolume_Post
+	FN_FadeClientVolume_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetClientMaxspeed_Post
+	FN_SetClientMaxspeed_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CreateFakeClient_Post
+	FN_CreateFakeClient_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_RunPlayerMove_Post
+	FN_RunPlayerMove_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_NumberOfEntities_Post
+	FN_NumberOfEntities_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetInfoKeyBuffer_Post
+	FN_GetInfoKeyBuffer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_InfoKeyValue_Post
+	FN_InfoKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetKeyValue_Post
+	FN_SetKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetClientKeyValue_Post
+	FN_SetClientKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_IsMapValid_Post
+	FN_IsMapValid_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_StaticDecal_Post
+	FN_StaticDecal_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheGeneric_Post
+	FN_PrecacheGeneric_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerUserId_Post
+	FN_GetPlayerUserId_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_BuildSoundMsg_Post
+	FN_BuildSoundMsg_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_IsDedicatedServer_Post
+	FN_IsDedicatedServer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CVarGetPointer_Post
+	FN_CVarGetPointer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerWONId_Post
+	FN_GetPlayerWONId_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Info_RemoveKey_Post
+	FN_Info_RemoveKey_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPhysicsKeyValue_Post
+	FN_GetPhysicsKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetPhysicsKeyValue_Post
+	FN_SetPhysicsKeyValue_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPhysicsInfoString_Post
+	FN_GetPhysicsInfoString_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PrecacheEvent_Post
+	FN_PrecacheEvent_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_PlaybackEvent_Post
+	FN_PlaybackEvent_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetFatPVS_Post
+	FN_SetFatPVS_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetFatPAS_Post
+	FN_SetFatPAS_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CheckVisibility_Post
+	FN_CheckVisibility_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaSetField_Post
+	FN_DeltaSetField_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaUnsetField_Post
+	FN_DeltaUnsetField_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaAddEncoder_Post
+	FN_DeltaAddEncoder_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetCurrentPlayer_Post
+	FN_GetCurrentPlayer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_CanSkipPlayer_Post
+	FN_CanSkipPlayer_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaFindField_Post
+	FN_DeltaFindField_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaSetFieldByIndex_Post
+	FN_DeltaSetFieldByIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_DeltaUnsetFieldByIndex_Post
+	FN_DeltaUnsetFieldByIndex_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_SetGroupMask_Post
+	FN_SetGroupMask_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_engCreateInstancedBaseline_Post
+	FN_engCreateInstancedBaseline_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Cvar_DirectSet_Post
+	FN_Cvar_DirectSet_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ForceUnmodified_Post
+	FN_ForceUnmodified_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerStats_Post
+	FN_GetPlayerStats_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_AddServerCommand_Post
+	FN_AddServerCommand_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Voice_GetClientListening_Post
+	FN_Voice_GetClientListening_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_Voice_SetClientListening_Post
+	FN_Voice_SetClientListening_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GetPlayerAuthId_Post
+	FN_GetPlayerAuthId_Post
+#else
+	NULL
+#endif
+}; // g_EngineFuncs_Post_Table
+
+
+static NEW_DLL_FUNCTIONS g_NewFuncs_Table = 
+{
+#ifdef FN_OnFreeEntPrivateData
+	FN_OnFreeEntPrivateData,
+#else
+	NULL,
+#endif
+#ifdef FN_GameShutdown
+	FN_GameShutdown,
+#else
+	NULL,
+#endif
+#ifdef FN_ShouldCollide
+	ShouldCollide,
+#else
+	NULL,
+#endif
+};
+
+
+static NEW_DLL_FUNCTIONS g_NewFuncs_Post_Table = 
+{
+#ifdef FN_OnFreeEntPrivateData_Post
+	FN_OnFreeEntPrivateData_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_GameShutdown_Post
+	FN_GameShutdown_Post,
+#else
+	NULL,
+#endif
+#ifdef FN_ShouldCollide_Post
+	ShouldCollide_Post,
+#else
+	NULL,
+#endif
+};
+
+// Global variables from metamod.  These variable names are referenced by
+// various macros.
+meta_globals_t *gpMetaGlobals;		// metamod globals
+gamedll_funcs_t *gpGamedllFuncs;	// gameDLL function tables
+mutil_funcs_t *gpMetaUtilFuncs;		// metamod utility functions
+
+
+plugin_info_t Plugin_info = {
+		META_INTERFACE_VERSION,
+		MODULE_NAME,
+		MODULE_VERSION,
+		MODULE_DATE,
+		MODULE_AUTHOR,
+		MODULE_URL,
+		MODULE_LOGTAG,
+		PT_ANYTIME,
+		PT_ANYTIME
+};
+
+/*
+C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEntityAPI; version=%d", interfaceVersion);
+	if(!pFunctionTable) {
+		LOG_ERROR(PLID, "GetEntityAPI called with null pFunctionTable");
+		return(FALSE);
+	}
+	else if(interfaceVersion != INTERFACE_VERSION) {
+		LOG_ERROR(PLID, "GetEntityAPI version mismatch; requested=%d ours=%d", interfaceVersion, INTERFACE_VERSION);
+		return(FALSE);
+	}
+	memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof( DLL_FUNCTIONS ) );
+
+	return (TRUE);
+}
+
+C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEntityAPI_Post; version=%d", interfaceVersion);
+	if(!pFunctionTable) {
+		LOG_ERROR(PLID, "GetEntityAPI_Post called with null pFunctionTable");
+		return(FALSE);
+	}
+	else if(interfaceVersion != INTERFACE_VERSION) {
+		LOG_ERROR(PLID, "GetEntityAPI_Post version mismatch; requested=%d ours=%d", interfaceVersion, INTERFACE_VERSION);
+		return(FALSE);
+	}
+	memcpy(pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
+
+	return(TRUE);
+}
+*/
+
+C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion);
+	if(!pFunctionTable) {
+		LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != INTERFACE_VERSION) {
+		LOG_ERROR(PLID, 
+				"GetEntityAPI2 version mismatch; requested=%d ours=%d", 
+				*interfaceVersion, INTERFACE_VERSION);
+		//! Tell engine what version we had, so it can figure out who is 
+		//! out of date.
+		*interfaceVersion = INTERFACE_VERSION;
+		return(FALSE);
+	}
+	memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
+	return(TRUE);
+}
+
+C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEntityAPI2_Post; version=%d", *interfaceVersion);
+	if(!pFunctionTable) {
+		LOG_ERROR(PLID, "GetEntityAPI2_Post called with null pFunctionTable");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != INTERFACE_VERSION) {
+		LOG_ERROR(PLID, "GetEntityAPI2_Post version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);
+		//! Tell engine what version we had, so it can figure out who is out of date.
+		*interfaceVersion = INTERFACE_VERSION;
+		return(FALSE);
+	}
+	memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
+
+	return(TRUE);
+}
+
+C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEngineFunctions; version=%d", 
+			*interfaceVersion);
+	if(!pengfuncsFromEngine) {
+		LOG_ERROR(PLID, 
+				"GetEngineFunctions called with null pengfuncsFromEngine");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) {
+		LOG_ERROR(PLID, 
+				"GetEngineFunctions version mismatch; requested=%d ours=%d", 
+				*interfaceVersion, ENGINE_INTERFACE_VERSION);
+		// Tell metamod what version we had, so it can figure out who is 
+		// out of date.
+		*interfaceVersion = ENGINE_INTERFACE_VERSION;
+		return(FALSE);
+	}
+	memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
+	return TRUE;
+}
+
+C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion)
+{
+	LOG_DEVELOPER(PLID, "called: GetEngineFunctions_Post; version=%d", *interfaceVersion);
+	if(!pengfuncsFromEngine) {
+		LOG_ERROR(PLID, "GetEngineFunctions_Post called with null pengfuncsFromEngine");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != ENGINE_INTERFACE_VERSION) {
+		LOG_ERROR(PLID, "GetEngineFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
+		// Tell metamod what version we had, so it can figure out who is out of date.
+		*interfaceVersion = ENGINE_INTERFACE_VERSION;
+		return(FALSE);
+	}
+	memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
+	return TRUE;
+
+}
+
+C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, 
+		int *interfaceVersion) 
+{
+	LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions; version=%d", 
+			*interfaceVersion);
+	if(!pNewFunctionTable) {
+		LOG_ERROR(PLID, 
+				"GetNewDLLFunctions called with null pNewFunctionTable");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
+		LOG_ERROR(PLID, 
+				"GetNewDLLFunctions version mismatch; requested=%d ours=%d", 
+				*interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
+		//! Tell engine what version we had, so it can figure out who is 
+		//! out of date.
+		*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
+		return(FALSE);
+	}
+	memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
+	return TRUE;
+}
+
+C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion ) 
+{
+	LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions_Post; version=%d", *interfaceVersion);
+	if(!pNewFunctionTable) {
+		LOG_ERROR(PLID, "GetNewDLLFunctions_Post called with null pNewFunctionTable");
+		return(FALSE);
+	}
+	else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
+		LOG_ERROR(PLID, "GetNewDLLFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
+		//! Tell engine what version we had, so it can figure out who is out of date.
+		*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
+		return(FALSE);
+	}
+	memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
+	return TRUE;
+}
+
+
+static META_FUNCTIONS g_MetaFunctions_Table =
+{
+	NULL,
+	NULL,
+	GetEntityAPI2,
+	GetEntityAPI2_Post,
+	GetNewDLLFunctions,
+	GetNewDLLFunctions_Post,
+	GetEngineFunctions,
+	GetEngineFunctions_Post
+};
+
+C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
+{
+	if ((int) CVAR_GET_FLOAT("developer") != 0)
+		UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n", 
+				Plugin_info.logtag, ifvers, Plugin_info.ifvers);
+
+	// Check for valid pMetaUtilFuncs before we continue.
+	if(!pMetaUtilFuncs) {
+		UTIL_LogPrintf("[%s] ERROR: Meta_Query called with null pMetaUtilFuncs\n", Plugin_info.logtag);
+		return(FALSE);
+	}
+
+	gpMetaUtilFuncs = pMetaUtilFuncs;
+
+	*pPlugInfo = &Plugin_info;
+
+	// Check for interface version compatibility.
+	if(!FStrEq(ifvers, Plugin_info.ifvers)) {
+		int mmajor=0, mminor=0, pmajor=0, pminor=0;
+		LOG_MESSAGE(PLID, "WARNING: meta-interface version mismatch; requested=%s ours=%s",
+				Plugin_info.logtag, ifvers);
+		// If plugin has later interface version, it's incompatible (update
+		// metamod).
+		sscanf(ifvers, "%d:%d", &mmajor, &mminor);
+		sscanf(META_INTERFACE_VERSION, "%d:%d", &pmajor, &pminor);
+		if(pmajor > mmajor || (pmajor==mmajor && pminor > mminor)) {
+			LOG_ERROR(PLID, "metamod version is too old for this module; update metamod");
+			return(FALSE);
+		}
+		// If plugin has older major interface version, it's incompatible
+		// (update plugin).
+		else if(pmajor < mmajor) {
+			LOG_ERROR(PLID, "metamod version is incompatible with this module; please find a newer version of this module");
+			return(FALSE);
+		}
+		// Minor interface is older, but this is guaranteed to be backwards
+		// compatible, so we warn, but we still accept it.
+		else if(pmajor==mmajor && pminor < mminor)
+			LOG_MESSAGE(PLID, "WARNING: metamod version is newer than expected; consider finding a newer version of this module");
+		else
+			LOG_ERROR(PLID, "unexpected version comparison; metavers=%s, mmajor=%d, mminor=%d; plugvers=%s, pmajor=%d, pminor=%d", ifvers, mmajor, mminor, META_INTERFACE_VERSION, pmajor, pminor);
+	}
+
+#ifdef FN_META_QUERY
+	return FN_META_QUERY();
+#endif	// FN_META_QUERY
+
+	return 1;
+}
+
+
+C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
+{
+	if(now > Plugin_info.loadable) {
+		LOG_ERROR(PLID, "Can't load module right now");
+		return(FALSE);
+	}
+	if(!pMGlobals) {
+		LOG_ERROR(PLID, "Meta_Attach called with null pMGlobals");
+		return(FALSE);
+	}
+	gpMetaGlobals=pMGlobals;
+	if(!pFunctionTable) {
+		LOG_ERROR(PLID, "Meta_Attach called with null pFunctionTable");
+		return(FALSE);
+	}
+
+	memcpy(pFunctionTable, &g_MetaFunctions_Table, sizeof(META_FUNCTIONS));
+	gpGamedllFuncs=pGamedllFuncs;
+
+	// Let's go.
+
+#ifdef FN_META_ATTACH
+	FN_META_ATTACH();
+#endif	// FN_META_ATTACH
+
+	return TRUE;
+}
+
+C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
+{
+	if(now > Plugin_info.unloadable && reason != PNL_CMD_FORCED) {
+		LOG_ERROR(PLID, "Can't unload plugin right now");
+		return(FALSE);
+	}
+
+#ifdef FN_META_DETACH
+	return FN_META_DETACH();
+#endif	// FN_META_DETACH
+	return TRUE;
+}
+
+
+
+#ifdef __linux__
+// linux prototype
+C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
+
+#else
+#ifdef _MSC_VER
+// MSVC: Simulate __stdcall calling convention
+C_DLLEXPORT __declspec(naked) void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
+{
+	__asm			// Prolog
+	{
+		// Save ebp
+		push		ebp
+		// Set stack frame pointer
+		mov			ebp, esp
+		// Allocate space for local variables
+		// The MSVC compiler gives us the needed size in __LOCAL_SIZE.
+		sub			esp, __LOCAL_SIZE
+		// Push registers
+		push		ebx
+		push		esi
+		push		edi
+	}
+#else	// _MSC_VER
+#ifdef __GNUC__
+// GCC can also work with this
+C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
+{
+#else	// __GNUC__
+// compiler not known
+#error There is no support (yet) for your compiler. Please use MSVC or GCC compilers or contact the AMX Mod X dev team.
+#endif	// __GNUC__
+#endif // _MSC_VER
+#endif // __linux__
+
+	// ** Function core <--
+	memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
+	gpGlobals = pGlobals;
+	// NOTE!  Have to call logging function _after_ copying into g_engfuncs, so
+	// that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :)
+	UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag);
+	// --> ** Function core
+
+#ifdef _MSC_VER
+	// Epilog
+	if (sizeof(int*) == 8)
+	{	// 64 bit
+		__asm
+		{
+			// Pop registers
+			pop	edi
+			pop	esi
+			pop	ebx
+			// Restore stack frame pointer
+			mov	esp, ebp
+			// Restore ebp
+			pop	ebp
+			// 2 * sizeof(int*) = 16 on 64 bit
+			ret 16
+		}
+	}
+	else
+	{	// 32 bit
+		__asm
+		{
+			// Pop registers
+			pop	edi
+			pop	esi
+			pop	ebx
+			// Restore stack frame pointer
+			mov	esp, ebp
+			// Restore ebp
+			pop	ebp
+			// 2 * sizeof(int*) = 8 on 32 bit
+			ret 8
+		}
+	}
+#endif // #ifdef _MSC_VER
+}
+
+#endif	// #ifdef USE_METAMOD
+
+/************* AMXX Stuff *************/
+
+// *** Types ***
+typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/);
+
+// *** Globals ***
+// Module info
+static amxx_module_info_s g_ModuleInfo = 
+{
+	MODULE_NAME,
+	MODULE_AUTHOR,
+	MODULE_VERSION,
+#ifdef MODULE_RELOAD_ON_MAPCHANGE
+	1
+#else // MODULE_RELOAD_ON_MAPCHANGE
+	0
+#endif // MODULE_RELOAD_ON_MAPCHANGE
+};
+
+// Storage for the requested functions
+PFN_ADD_NATIVES				g_fn_AddNatives;
+PFN_BUILD_PATHNAME			g_fn_BuildPathname;
+PFN_GET_AMXADDR				g_fn_GetAmxAddr;
+PFN_PRINT_SRVCONSOLE		g_fn_PrintSrvConsole;
+PFN_GET_MODNAME				g_fn_GetModname;
+PFN_GET_AMXSCRIPTNAME		g_fn_GetAmxScriptName;
+PFN_GET_AMXSCRIPT			g_fn_GetAmxScript;
+PFN_FIND_AMXSCRIPT_BYAMX	g_fn_FindAmxScriptByAmx;
+PFN_FIND_AMXSCRIPT_BYNAME	g_fn_FindAmxScriptByName;
+PFN_SET_AMXSTRING			g_fn_SetAmxString;
+PFN_GET_AMXSTRING			g_fn_GetAmxString;
+PFN_GET_AMXSTRINGLEN		g_fn_GetAmxStringLen;
+PFN_FORMAT_AMXSTRING		g_fn_FormatAmxString;
+PFN_COPY_AMXMEMORY			g_fn_CopyAmxMemory;
+PFN_LOG						g_fn_Log;
+PFN_RAISE_AMXERROR			g_fn_RaiseAmxError;
+PFN_REGISTER_FORWARD		g_fn_RegisterForward;
+PFN_EXECUTE_FORWARD			g_fn_ExecuteForward;
+PFN_PREPARE_CELLARRAY		g_fn_PrepareCellArray;
+PFN_PREPARE_CHARARRAY		g_fn_PrepareCharArray;
+PFN_IS_PLAYER_VALID			g_fn_IsPlayerValid;
+PFN_GET_PLAYER_NAME			g_fn_GetPlayerName;
+PFN_GET_PLAYER_IP			g_fn_GetPlayerIP;
+PFN_IS_PLAYER_INGAME		g_fn_IsPlayerIngame;
+PFN_IS_PLAYER_BOT			g_fn_IsPlayerBot;
+PFN_IS_PLAYER_AUTHORIZED	g_fn_IsPlayerAuthorized;
+PFN_GET_PLAYER_TIME			g_fn_GetPlayerTime;
+PFN_GET_PLAYER_PLAYTIME		g_fn_GetPlayerPlayTime;
+PFN_GET_PLAYER_CURWEAPON	g_fn_GetPlayerCurweapon;
+PFN_GET_PLAYER_TEAMID		g_fn_GetPlayerTeamID;
+PFN_GET_PLAYER_DEATHS		g_fn_GetPlayerDeaths;
+PFN_GET_PLAYER_MENU			g_fn_GetPlayerMenu;
+PFN_GET_PLAYER_KEYS			g_fn_GetPlayerKeys;
+PFN_IS_PLAYER_ALIVE			g_fn_IsPlayerAlive;
+PFN_GET_PLAYER_FRAGS		g_fn_GetPlayerFrags;
+PFN_IS_PLAYER_CONNECTING	g_fn_IsPlayerConnecting;
+PFN_IS_PLAYER_HLTV			g_fn_IsPlayerHLTV;
+PFN_GET_PLAYER_ARMOR		g_fn_GetPlayerArmor;
+PFN_GET_PLAYER_HEALTH		g_fn_GetPlayerHealth;
+PFN_ALLOCATOR				g_fn_Allocator;
+PFN_REALLOCATOR				g_fn_Reallocator;
+PFN_DEALLOCATOR				g_fn_Deallocator;
+PFN_AMX_EXEC				g_fn_AmxExec;
+PFN_AMX_EXECV				g_fn_AmxExecv;
+PFN_AMX_ALLOT				g_fn_AmxAllot;
+PFN_AMX_FINDPUBLIC			g_fn_AmxFindPublic;
+PFN_LOAD_AMXSCRIPT			g_fn_LoadAmxScript;
+PFN_UNLOAD_AMXSCRIPT		g_fn_UnloadAmxScript;
+PFN_REAL_TO_CELL			g_fn_RealToCell;
+PFN_CELL_TO_REAL			g_fn_CellToReal;
+PFN_REGISTER_SPFORWARD		g_fn_RegisterSPForward;
+PFN_REGISTER_SPFORWARD_BYNAME	g_fn_RegisterSPForwardByName;
+PFN_UNREGISTER_SPFORWARD	g_fn_UnregisterSPForward;
+PFN_MERGEDEFINITION_FILE	g_fn_MergeDefinition_File;
+PFN_AMX_FINDNATIVE			g_fn_AmxFindNative;
+PFN_GETPLAYERFLAGS			g_fn_GetPlayerFlags;
+PFN_GET_PLAYER_EDICT		g_fn_GetPlayerEdict;
+PFN_FORMAT					g_fn_Format;
+
+// *** Exports ***
+C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
+{
+	// check parameters
+	if (!interfaceVersion || !moduleInfo)
+		return AMXX_PARAM;
+
+	// check interface version
+	if (*interfaceVersion != AMXX_INTERFACE_VERSION)
+	{
+		// Tell amxx core our interface version
+		*interfaceVersion = AMXX_INTERFACE_VERSION;
+		return AMXX_IFVERS;
+	}
+
+	// copy module info
+	memcpy(moduleInfo, &g_ModuleInfo, sizeof(amxx_module_info_s));
+
+#ifdef FN_AMXX_QUERY
+	FN_AMXX_QUERY();
+#endif // FN_AMXX_QUERY
+	// Everything ok :)
+	return AMXX_OK;
+}
+
+// request function
+#define REQFUNC(name, fptr, type) if ((fptr = (type)reqFnptrFunc(name)) == 0) return AMXX_FUNC_NOT_PRESENT
+// request optional function
+#define REQFUNC_OPT(name, fptr, type) fptr = (type)reqFnptrFunc(name)
+
+C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
+{
+	// Check pointer
+	if (!reqFnptrFunc)
+		return AMXX_PARAM;
+
+	// Req all known functions
+	// Misc
+	REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME);
+	REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
+	REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
+	REQFUNC("Log", g_fn_Log, PFN_LOG);
+	REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
+	REQFUNC("Format", g_fn_Format, PFN_FORMAT);
+
+	// Amx scripts
+	REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
+	REQFUNC("FindAmxScriptByAmx", g_fn_FindAmxScriptByAmx, PFN_FIND_AMXSCRIPT_BYAMX);
+	REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
+	REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
+	REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
+    REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
+
+	// String / mem in amx scripts support
+	REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
+	REQFUNC("GetAmxString", g_fn_GetAmxString, PFN_GET_AMXSTRING);
+	REQFUNC("GetAmxStringLen", g_fn_GetAmxStringLen, PFN_GET_AMXSTRINGLEN);
+	REQFUNC("FormatAmxString", g_fn_FormatAmxString, PFN_FORMAT_AMXSTRING);
+	REQFUNC("CopyAmxMemory", g_fn_CopyAmxMemory, PFN_COPY_AMXMEMORY);
+	REQFUNC("GetAmxAddr", g_fn_GetAmxAddr, PFN_GET_AMXADDR);
+
+	REQFUNC("amx_Exec", g_fn_AmxExec, PFN_AMX_EXEC);
+	REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
+	REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
+	REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
+	REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
+
+	// Natives / Forwards
+	REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
+	REQFUNC("RaiseAmxError", g_fn_RaiseAmxError, PFN_RAISE_AMXERROR);
+	REQFUNC("RegisterForward", g_fn_RegisterForward, PFN_REGISTER_FORWARD);
+	REQFUNC("RegisterSPForward", g_fn_RegisterSPForward, PFN_REGISTER_SPFORWARD);
+	REQFUNC("RegisterSPForwardByName", g_fn_RegisterSPForwardByName, PFN_REGISTER_SPFORWARD_BYNAME);
+	REQFUNC("UnregisterSPForward", g_fn_UnregisterSPForward, PFN_UNREGISTER_SPFORWARD);
+	REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
+	REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
+	REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
+
+	// Player
+	REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
+	REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
+	REQFUNC("GetPlayerIP", g_fn_GetPlayerIP, PFN_GET_PLAYER_IP);
+	REQFUNC("IsPlayerInGame", g_fn_IsPlayerIngame, PFN_IS_PLAYER_INGAME);		
+	REQFUNC("IsPlayerBot", g_fn_IsPlayerBot, PFN_IS_PLAYER_BOT);	
+	REQFUNC("IsPlayerAuthorized", g_fn_IsPlayerAuthorized, PFN_IS_PLAYER_AUTHORIZED);
+	REQFUNC("GetPlayerTime", g_fn_GetPlayerTime, PFN_GET_PLAYER_TIME);
+	REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
+	REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
+	REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
+	REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
+	REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
+	REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
+	REQFUNC("IsPlayerAlive", g_fn_IsPlayerAlive, PFN_IS_PLAYER_ALIVE);
+	REQFUNC("GetPlayerFrags", g_fn_GetPlayerFrags, PFN_GET_PLAYER_FRAGS);
+	REQFUNC("IsPlayerConnecting", g_fn_IsPlayerConnecting, PFN_IS_PLAYER_CONNECTING);
+	REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
+	REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
+	REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
+	REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
+	REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
+
+	// Memory
+	REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
+	REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
+	REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
+
+	REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
+	REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
+
+#ifdef FN_AMXX_ATTACH
+	FN_AMXX_ATTACH();
+#endif // FN_AMXX_ATACH
+
+	return AMXX_OK;
+}
+
+C_DLLEXPORT int AMXX_Detach()
+{
+#ifdef FN_AMXX_DETACH
+	FN_AMXX_DETACH();
+#endif // FN_AMXX_DETACH
+
+	return AMXX_OK;
+}
+
+C_DLLEXPORT int AMXX_PluginsLoaded()
+{
+#ifdef FN_AMXX_PLUGINSLOADED
+	FN_AMXX_PLUGINSLOADED();
+#endif // FN_AMXX_PLUGINSLOADED
+	return AMXX_OK;
+}
+
+// Advanced MF functions
+void MF_Log(const char *fmt, ...)
+{
+	// :TODO: Overflow possible here
+	char msg[3072];
+	va_list arglst;
+	va_start(arglst, fmt);
+	vsprintf(msg, fmt, arglst);
+	va_end(arglst);
+
+	g_fn_Log("[%s] %s", MODULE_NAME, msg);
+}
+
+
+#ifdef _DEBUG
+// validate macros
+// Makes sure compiler reports errors when macros are invalid
+void ValidateMacros_DontCallThis_Smiley()
+{
+	MF_BuildPathname("str", "str", 0);
+	MF_FormatAmxString(NULL, 0, 0, NULL);
+	MF_GetAmxAddr(NULL, 0);
+	MF_PrintSrvConsole("str", "str", 0);
+	MF_GetModname();
+	MF_GetScriptName(0);
+	MF_GetScriptAmx(0);
+	MF_FindScriptByAmx(NULL);
+	MF_FindScriptByName("str");
+	MF_SetAmxString(NULL, 0, "str", 0);
+	MF_GetAmxString(NULL, 0, 0, 0);
+	MF_GetAmxStringLen(NULL);
+	MF_CopyAmxMemory(NULL, NULL, 0);
+	MF_Log("str", "str", 0);
+	MF_RaiseAmxError(NULL, 0);
+	MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
+	MF_ExecuteForward(0, 0, 0);
+	MF_PrepareCellArray(NULL, 0);
+	MF_PrepareCharArray(NULL, 0);
+	MF_IsPlayerValid(0);
+	MF_GetPlayerName(0);
+	MF_GetPlayerIP(0);
+	MF_IsPlayerIngame(0);
+	MF_IsPlayerBot(0);
+	MF_IsPlayerAuthorized(0);
+	MF_GetPlayerTime(0);
+	MF_GetPlayerPlayTime(0);
+	MF_GetPlayerCurweapon(0);
+	MF_GetPlayerTeamID(0);
+	MF_GetPlayerDeaths(0);
+	MF_GetPlayerMenu(0);
+	MF_GetPlayerKeys(0);
+	MF_IsPlayerAlive(0);
+	MF_GetPlayerFrags(0);
+	MF_IsPlayerConnecting(0);
+	MF_IsPlayerHLTV(0);
+	MF_GetPlayerArmor(0);
+	MF_GetPlayerHealth(0);
+	MF_AmxExec(0, 0, 0, 0);
+	MF_AmxExecv(0, 0, 0, 0, 0);
+	MF_AmxFindPublic(0, 0, 0);
+	MF_AmxAllot(0, 0, 0, 0);
+	MF_LoadAmxScript(0, 0, 0, 0, 0);
+	MF_UnloadAmxScript(0, 0);
+	MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
+	MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
+	MF_UnregisterSPForward(0);
+	MF_GetPlayerFrags(0);
+	MF_GetPlayerEdict(0);
+	MF_Format("", 4, "str");
+}
+#endif
+
+/************* MEMORY *************/
+// undef all defined macros
+#undef new
+#undef delete
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+
+const		unsigned int	m_alloc_unknown        = 0;
+const		unsigned int	m_alloc_new            = 1;
+const		unsigned int	m_alloc_new_array      = 2;
+const		unsigned int	m_alloc_malloc         = 3;
+const		unsigned int	m_alloc_calloc         = 4;
+const		unsigned int	m_alloc_realloc        = 5;
+const		unsigned int	m_alloc_delete         = 6;
+const		unsigned int	m_alloc_delete_array   = 7;
+const		unsigned int	m_alloc_free           = 8;
+
+const char *g_Mem_CurrentFilename = "??";
+int g_Mem_CurrentLine = 0;
+const char *g_Mem_CurrentFunc = "??";
+
+const char *Mem_MakeSourceFile(const char *sourceFile)
+{
+	static char buffer[512];
+	static size_t pos = 0;
+	if (!pos)
+	{
+		// init
+		buffer[0] = '[';
+		strcpy(buffer + 1, MODULE_NAME);
+		pos = strlen(MODULE_NAME) + 1;
+		buffer[pos++] = ']';
+	}
+
+	// convert from absolute path to [modulename]filename
+	const char *ptr = strrchr(sourceFile, '\\');
+	if (ptr)
+		ptr++;
+	else
+	{
+		ptr = strrchr(sourceFile, '/');
+		if (ptr)
+			ptr++;
+		else
+			ptr = sourceFile;
+	}
+	strcpy(buffer + pos, ptr);
+	return buffer;
+}
+
+void Mem_SetOwner(const char *filename, int line, const char *function)
+{
+	g_Mem_CurrentFilename = filename;
+	g_Mem_CurrentLine = line;
+	g_Mem_CurrentFunc = function;
+}
+
+void Mem_ResetGlobals()
+{
+	Mem_SetOwner("??", 0, "??");
+}
+
+// raw (re/de)allocators
+void *	Mem_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+			     const unsigned int allocationType, const size_t reportedSize)
+{
+	if (g_fn_Allocator)
+		return g_fn_Allocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, allocationType, reportedSize);
+	else
+		return malloc(reportedSize);
+}
+
+void *	Mem_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+			       const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress)
+{
+	if (g_fn_Reallocator)
+		return g_fn_Reallocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, reallocationType, reportedSize, reportedAddress);
+	else
+		return realloc(reportedAddress, reportedSize);
+}
+
+void	Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+			      const unsigned int deallocationType, void *reportedAddress)
+{
+	// If you you get user breakpoint here, something failed :)
+	//  - invalid pointer
+	//  - alloc type mismatch	( for example
+	//							char *a = new char[5]; delete char;
+	//							)
+	//  - The allocation unit is damaged (for example
+	//							char *a = new char[5]; a[6] = 8;
+	//							)
+	//  - break on dealloc flag set (somehow)
+
+	if (g_fn_Deallocator)
+		g_fn_Deallocator(Mem_MakeSourceFile(sourceFile), sourceLine, sourceFunc, deallocationType, reportedAddress);
+	else
+		free(reportedAddress);
+}
+
+// new and delete operators
+void	*operator new(size_t reportedSize)
+{
+	if (reportedSize == 0)
+		reportedSize = 1;
+	void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new, reportedSize);
+	// :TODO: Handler support ?
+	if (ptr)
+		return ptr;
+
+	// allocation failed
+	return NULL;
+}
+
+void	*operator new[](size_t reportedSize)
+{
+	if (reportedSize == 0)
+		reportedSize = 1;
+	void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new_array, reportedSize);
+	// :TODO: Handler support ?
+	if (ptr)
+		return ptr;
+
+	// allocation failed
+	return NULL;
+}
+
+// Microsoft memory tracking operators
+void	*operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
+{
+	if (reportedSize == 0)
+		reportedSize = 1;
+	void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new, reportedSize);
+	// :TODO: Handler support ?
+	if (ptr)
+		return ptr;
+
+	// allocation failed
+	return NULL;
+}
+void	*operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
+{
+	if (reportedSize == 0)
+		reportedSize = 1;
+	void *ptr = Mem_Allocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_new_array, reportedSize);
+	// :TODO: Handler support ?
+	if (ptr)
+		return ptr;
+
+	// allocation failed
+	return NULL;
+}
+
+void	operator delete(void *reportedAddress)
+{
+	if (!reportedAddress)
+		return;
+
+	Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete, reportedAddress);
+}
+
+void	operator delete[](void *reportedAddress)
+{
+	if (!reportedAddress)
+		return;
+
+	Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
+}
+
+/************* stuff from dlls/util.cpp *************/
+//				must come here because cbase.h declares it's own operator new
+
+#ifdef USE_METAMOD
+
+// Selected portions of dlls/util.cpp from SDK 2.1.
+// Functions copied from there as needed...
+// And modified to avoid buffer overflows (argh).
+
+/***
+*
+*	Copyright (c) 1999, 2000 Valve LLC. All rights reserved.
+*	
+*	This product contains software technology licensed from Id 
+*	Software, Inc. ("Id Technology").  Id Technology (c) 1996 Id Software, Inc. 
+*	All Rights Reserved.
+*
+*   Use, distribution, and modification of this source code and/or resulting
+*   object code is restricted to non-commercial enhancements to products from
+*   Valve LLC.  All other use, distribution, or modification is prohibited
+*   without written permission from Valve LLC.
+*
+****/
+/*
+
+===== util.cpp ========================================================
+
+  Utility code.  Really not optional after all.
+
+*/
+
+#include 
+#include "sdk_util.h"
+#include 
+
+#include 			// for strncpy(), etc
+
+#include "osdep.h"			// win32 vsnprintf, etc
+
+char* UTIL_VarArgs( char *format, ... )
+{
+	va_list		argptr;
+	static char		string[1024];
+	
+	va_start (argptr, format);
+	vsnprintf (string, sizeof(string), format, argptr);
+	va_end (argptr);
+
+	return string;
+}
+	
+
+//=========================================================
+// UTIL_LogPrintf - Prints a logged message to console.
+// Preceded by LOG: ( timestamp ) < message >
+//=========================================================
+void UTIL_LogPrintf( char *fmt, ... )
+{
+	va_list			argptr;
+	static char		string[1024];
+	
+	va_start ( argptr, fmt );
+	vsnprintf ( string, sizeof(string), fmt, argptr );
+	va_end   ( argptr );
+
+	// Print to server console
+	ALERT( at_logged, "%s", string );
+}
+
+
+void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, 
+		const char *pMessage)
+{
+	if ( !pEntity )
+		return;
+
+	MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, ENT(pEntity->pev) );
+		WRITE_BYTE( TE_TEXTMESSAGE );
+		WRITE_BYTE( textparms.channel & 0xFF );
+
+		WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
+		WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
+		WRITE_BYTE( textparms.effect );
+
+		WRITE_BYTE( textparms.r1 );
+		WRITE_BYTE( textparms.g1 );
+		WRITE_BYTE( textparms.b1 );
+		WRITE_BYTE( textparms.a1 );
+
+		WRITE_BYTE( textparms.r2 );
+		WRITE_BYTE( textparms.g2 );
+		WRITE_BYTE( textparms.b2 );
+		WRITE_BYTE( textparms.a2 );
+
+		WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) );
+		WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) );
+		WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) );
+
+		if ( textparms.effect == 2 )
+			WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) );
+		
+		if ( strlen( pMessage ) < 512 )
+		{
+			WRITE_STRING( pMessage );
+		}
+		else
+		{
+			char tmp[512];
+			strncpy( tmp, pMessage, 511 );
+			tmp[511] = 0;
+			WRITE_STRING( tmp );
+		}
+	MESSAGE_END();
+}
+
+short FixedSigned16( float value, float scale )
+{
+	int output;
+
+	output = (int) (value * scale);
+
+	if ( output > 32767 )
+		output = 32767;
+
+	if ( output < -32768 )
+		output = -32768;
+
+	return (short)output;
+}
+
+unsigned short FixedUnsigned16( float value, float scale )
+{
+	int output;
+
+	output = (int) (value * scale);
+	if ( output < 0 )
+		output = 0;
+	if ( output > 0xFFFF )
+		output = 0xFFFF;
+
+	return (unsigned short)output;
+}
+#endif // USE_METAMOD
diff --git a/dlls/csx/source/amxxmodule.h b/dlls/csx/source/amxxmodule.h
new file mode 100755
index 00000000..0d44ad13
--- /dev/null
+++ b/dlls/csx/source/amxxmodule.h
@@ -0,0 +1,2181 @@
+/*
+ * AMX Mod X Module Interface Functions
+ * This file may be freely used
+*/
+
+// prevent double include
+#ifndef __AMXXMODULE_H__
+#define __AMXXMODULE_H__
+
+// config
+#include "moduleconfig.h"
+
+// metamod include files
+#ifdef USE_METAMOD
+#include 
+#include 
+#include "osdep.h"
+#endif // #ifdef USE_METAMOD
+
+// DLL Export
+#undef DLLEXPORT
+#ifndef __linux__
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT
+#define LINUX
+#endif
+
+#undef C_DLLEXPORT
+#define C_DLLEXPORT extern "C" DLLEXPORT
+
+// ***** AMXX stuff *****
+
+// module interface version is 1
+#define AMXX_INTERFACE_VERSION 1
+
+// amxx module info
+struct amxx_module_info_s
+{
+	const char *name;
+	const char *author;
+	const char *version;
+	int reload;				// reload on mapchange when nonzero
+};
+
+
+
+// return values from functions called by amxx
+#define AMXX_OK					0			/* no error */
+#define AMXX_IFVERS				1			/* interface version */
+#define AMXX_PARAM				2			/* Invalid parameter */
+#define AMXX_FUNC_NOT_PRESENT	3			/* Function not present */
+
+// *** Small stuff ***
+// The next section is copied from the amx.h file
+// Copyright (c) ITB CompuPhase, 1997-2004
+
+#if defined __LCC__ || defined __DMC__ || defined __linux__
+  #include 
+#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+  /* The ISO C99 defines the int16_t and int_32t types. If the compiler got
+   * here, these types are probably undefined.
+   */
+  #if defined __FreeBSD__
+    #include 
+  #else
+    typedef short int           int16_t;
+    typedef unsigned short int  uint16_t;
+    #if defined SN_TARGET_PS2
+      typedef int               int32_t;
+      typedef unsigned int      uint32_t;
+    #else
+      typedef long int          int32_t;
+      typedef unsigned long int uint32_t;
+    #endif
+    #if defined __WIN32__ || defined _WIN32 || defined WIN32
+      typedef __int64			int64_t;
+      typedef unsigned __int64	uint64_t;
+      #define HAVE_I64
+    #elif defined __GNUC__
+      typedef long long			int64_t;
+      typedef unsigned long long uint64_t;
+      #define HAVE_I64
+    #endif
+  #endif
+#endif
+
+
+/* calling convention for native functions */
+#if !defined AMX_NATIVE_CALL
+  #define AMX_NATIVE_CALL
+#endif
+/* calling convention for all interface functions and callback functions */
+#if !defined AMXAPI
+  #if defined STDECL
+    #define AMXAPI      __stdcall
+  #elif defined CDECL
+    #define AMXAPI      __cdecl
+  #else
+    #define AMXAPI
+  #endif
+#endif
+#if !defined AMXEXPORT
+  #define AMXEXPORT
+#endif
+
+
+
+#if !defined SMALL_CELL_SIZE
+  #define SMALL_CELL_SIZE 32    /* by default, use 32-bit cells */
+#endif
+#if SMALL_CELL_SIZE==32
+  typedef uint32_t  ucell;
+  typedef int32_t   cell;
+  typedef float		REAL;
+#elif SMALL_CELL_SIZE==64
+  typedef uint64_t  ucell;
+  typedef int64_t   cell;
+  typedef double	REAL;
+#else
+  #error Unsupported cell size (SMALL_CELL_SIZE)
+#endif
+
+#define UNPACKEDMAX   ((1 << (sizeof(cell)-1)*8) - 1)
+
+struct tagAMX;
+typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
+typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
+                                   cell *result, cell *params);
+typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
+#if !defined _FAR
+  #define _FAR
+#endif
+
+#if defined _MSC_VER
+  #pragma warning(disable:4103)  /* disable warning message 4103 that complains
+                                  * about pragma pack in a header file */
+  #pragma warning(disable:4100)  /* "'%$S' : unreferenced formal parameter" */
+#endif
+
+
+#if defined SN_TARGET_PS2 || defined __GNUC__
+  #define AMX_NO_ALIGN
+#endif
+
+
+#if defined __GNUC__
+  #define PACKED        __attribute__((packed))
+#else
+  #define PACKED
+#endif
+
+
+#if !defined AMX_NO_ALIGN
+  #if defined __linux__
+    #pragma pack(1)         /* structures must be packed (byte-aligned) */
+  #else
+    #pragma pack(push)
+    #pragma pack(1)         /* structures must be packed (byte-aligned) */
+    #if defined __TURBOC__
+      #pragma option -a-    /* "pack" pragma for older Borland compilers */
+    #endif
+  #endif
+#endif
+
+typedef struct {
+  const char _FAR *name PACKED;
+  AMX_NATIVE func       PACKED;
+} AMX_NATIVE_INFO;
+
+#define AMX_USERNUM     4
+
+/* The AMX structure is the internal structure for many functions. Not all
+ * fields are valid at all times; many fields are cached in local variables.
+ */
+typedef struct tagAMX {
+  unsigned char _FAR *base PACKED; /* points to the AMX header ("amxhdr") plus the code, optionally also the data */
+  unsigned char _FAR *data PACKED; /* points to separate data+stack+heap, may be NULL */
+  AMX_CALLBACK callback PACKED;
+  AMX_DEBUG debug       PACKED; /* debug callback */
+  /* for external functions a few registers must be accessible from the outside */
+  cell cip              PACKED; /* instruction pointer: relative to base + amxhdr->cod */
+  cell frm              PACKED; /* stack frame base: relative to base + amxhdr->dat */
+  cell hea              PACKED; /* top of the heap: relative to base + amxhdr->dat */
+  cell hlw              PACKED; /* bottom of the heap: relative to base + amxhdr->dat */
+  cell stk              PACKED; /* stack pointer: relative to base + amxhdr->dat */
+  cell stp              PACKED; /* top of the stack: relative to base + amxhdr->dat */
+  int flags             PACKED; /* current status, see amx_Flags() */
+  /* for assertions and debug hook */
+  cell curline          PACKED;
+  cell curfile          PACKED;
+  int dbgcode           PACKED;
+  cell dbgaddr          PACKED;
+  cell dbgparam         PACKED;
+  char _FAR *dbgname    PACKED;
+  /* user data */
+  long usertags[AMX_USERNUM] PACKED;
+  void _FAR *userdata[AMX_USERNUM] PACKED;
+  /* native functions can raise an error */
+  int error             PACKED;
+  /* the sleep opcode needs to store the full AMX status */
+  cell pri              PACKED;
+  cell alt              PACKED;
+  cell reset_stk        PACKED;
+  cell reset_hea        PACKED;
+  cell sysreq_d         PACKED; /* relocated address/value for the SYSREQ.D opcode */
+    /* support variables for the JIT */
+    int reloc_size      PACKED; /* required temporary buffer for relocations */
+    long code_size      PACKED; /* estimated memory footprint of the native code */
+} AMX;
+
+enum {
+  AMX_ERR_NONE,
+  /* reserve the first 15 error codes for exit codes of the abstract machine */
+  AMX_ERR_EXIT,         /* forced exit */
+  AMX_ERR_ASSERT,       /* assertion failed */
+  AMX_ERR_STACKERR,     /* stack/heap collision */
+  AMX_ERR_BOUNDS,       /* index out of bounds */
+  AMX_ERR_MEMACCESS,    /* invalid memory access */
+  AMX_ERR_INVINSTR,     /* invalid instruction */
+  AMX_ERR_STACKLOW,     /* stack underflow */
+  AMX_ERR_HEAPLOW,      /* heap underflow */
+  AMX_ERR_CALLBACK,     /* no callback, or invalid callback */
+  AMX_ERR_NATIVE,       /* native function failed */
+  AMX_ERR_DIVIDE,       /* divide by zero */
+  AMX_ERR_SLEEP,        /* go into sleepmode - code can be restarted */
+
+  AMX_ERR_MEMORY = 16,  /* out of memory */
+  AMX_ERR_FORMAT,       /* invalid file format */
+  AMX_ERR_VERSION,      /* file is for a newer version of the AMX */
+  AMX_ERR_NOTFOUND,     /* function not found */
+  AMX_ERR_INDEX,        /* invalid index parameter (bad entry point) */
+  AMX_ERR_DEBUG,        /* debugger cannot run */
+  AMX_ERR_INIT,         /* AMX not initialized (or doubly initialized) */
+  AMX_ERR_USERDATA,     /* unable to set user data field (table full) */
+  AMX_ERR_INIT_JIT,     /* cannot initialize the JIT */
+  AMX_ERR_PARAMS,       /* parameter error */
+  AMX_ERR_DOMAIN,       /* domain error, expression result does not fit in range */
+};
+
+#if !defined AMX_NO_ALIGN
+  #if defined __linux__
+    #pragma pack()    /* reset default packing */
+  #else
+    #pragma pack(pop) /* reset previous packing */
+  #endif
+#endif
+
+
+// ***** declare functions *****
+
+#ifdef USE_METAMOD
+void UTIL_LogPrintf( char *fmt, ... );
+void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
+short FixedSigned16( float value, float scale );
+unsigned short FixedUnsigned16( float value, float scale );
+
+#ifdef FN_META_QUERY
+void FN_META_QUERY(void);
+#endif // FN_META_QUERY
+
+#ifdef FN_META_ATTACH
+void FN_META_ATTACH(void);
+#endif // FN_META_ATTACH
+
+#ifdef FN_META_DETACH
+void FN_META_DETACH(void);
+#endif // FN_META_DETACH
+
+
+
+
+
+#ifdef FN_GameDLLInit
+void FN_GameDLLInit(void);
+#endif // FN_GameDLLInit
+
+#ifdef FN_DispatchSpawn
+int FN_DispatchSpawn(edict_t *pent);
+#endif // FN_DispatchSpawn
+
+#ifdef FN_DispatchThink
+void FN_DispatchThink(edict_t *pent);
+#endif // FN_DispatchThink
+
+#ifdef FN_DispatchUse
+void FN_DispatchUse(edict_t *pentUser, edict_t *pentOther);
+#endif // FN_DispatchUse
+
+#ifdef FN_DispatchTouch
+void FN_DispatchTouch(edict_t *pentTouched, edict_t *pentOther);
+#endif // FN_DispatchTouch
+
+#ifdef FN_DispatchBlocked
+void FN_DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther);
+#endif // FN_DispatchBlocked
+
+#ifdef FN_DispatchKeyValue
+void FN_DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);
+#endif // FN_DispatchKeyValue
+
+#ifdef FN_DispatchSave
+void FN_DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData);
+#endif // FN_DispatchSave
+
+#ifdef FN_DispatchRestore
+int FN_DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity);
+#endif // FN_DispatchRestore
+
+#ifdef FN_DispatchObjectCollsionBox
+void FN_DispatchObjectCollsionBox(edict_t *pent);
+#endif // FN_DispatchObjectCollsionBox
+
+#ifdef FN_SaveWriteFields
+void FN_SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
+#endif // FN_SaveWriteFields
+
+#ifdef FN_SaveReadFields
+void FN_SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
+#endif // FN_SaveReadFields
+
+#ifdef FN_SaveGlobalState
+void FN_SaveGlobalState(SAVERESTOREDATA *pSaveData);
+#endif // FN_SaveGlobalState
+
+#ifdef FN_RestoreGlobalState
+void FN_RestoreGlobalState(SAVERESTOREDATA *pSaveData);
+#endif // FN_RestoreGlobalState
+
+#ifdef FN_ResetGlobalState
+void FN_ResetGlobalState(void);
+#endif // FN_ResetGlobalState
+
+#ifdef FN_ClientConnect
+BOOL FN_ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ]);
+#endif // FN_ClientConnect
+
+#ifdef FN_ClientDisconnect
+void FN_ClientDisconnect(edict_t *pEntity);
+#endif // FN_ClientDisconnect
+
+#ifdef FN_ClientKill
+void FN_ClientKill(edict_t *pEntity);
+#endif // FN_ClientKill
+
+#ifdef FN_ClientPutInServer
+void FN_ClientPutInServer(edict_t *pEntity);
+#endif // FN_ClientPutInServer
+
+#ifdef FN_ClientCommand
+void FN_ClientCommand(edict_t *pEntity);
+#endif // FN_ClientCommand
+
+#ifdef FN_ClientUserInfoChanged
+void FN_ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);
+#endif // FN_ClientUserInfoChanged
+
+#ifdef FN_ServerActivate
+void FN_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
+#endif // FN_ServerActivate
+
+#ifdef FN_ServerDeactivate
+void FN_ServerDeactivate(void);
+#endif // FN_ServerDeactivate
+
+#ifdef FN_PlayerPreThink
+void FN_PlayerPreThink(edict_t *pEntity);
+#endif // FN_PlayerPreThink
+
+#ifdef FN_PlayerPostThink
+void FN_PlayerPostThink(edict_t *pEntity);
+#endif // FN_PlayerPostThink
+
+#ifdef FN_StartFrame
+void FN_StartFrame(void);
+#endif // FN_StartFrame
+
+#ifdef FN_ParmsNewLevel
+void FN_ParmsNewLevel(void);
+#endif // FN_ParmsNewLevel
+
+#ifdef FN_ParmsChangeLevel
+void FN_ParmsChangeLevel(void);
+#endif // FN_ParmsChangeLevel
+
+#ifdef FN_GetGameDescription
+const char *FN_GetGameDescription(void);
+#endif // FN_GetGameDescription
+
+#ifdef FN_PlayerCustomization
+void FN_PlayerCustomization(edict_t *pEntity, customization_t *pCust);
+#endif // FN_PlayerCustomization
+
+#ifdef FN_SpectatorConnect
+void FN_SpectatorConnect(edict_t *pEntity);
+#endif // FN_SpectatorConnect
+
+#ifdef FN_SpectatorDisconnect
+void FN_SpectatorDisconnect(edict_t *pEntity);
+#endif // FN_SpectatorDisconnect
+
+#ifdef FN_SpectatorThink
+void FN_SpectatorThink(edict_t *pEntity);
+#endif // FN_SpectatorThink
+
+#ifdef FN_Sys_Error
+void FN_Sys_Error(const char *error_string);
+#endif // FN_Sys_Error
+
+#ifdef FN_PM_Move
+void FN_PM_Move(struct playermove_s *ppmove, int server);
+#endif // FN_PM_Move
+
+#ifdef FN_PM_Init
+void FN_PM_Init(struct playermove_s *ppmove);
+#endif // FN_PM_Init
+
+#ifdef FN_PM_FindTextureType
+char FN_PM_FindTextureType(char *name);
+#endif // FN_PM_FindTextureType
+
+#ifdef FN_SetupVisibility
+void FN_SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas);
+#endif // FN_SetupVisibility
+
+#ifdef FN_UpdateClientData
+void FN_UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
+#endif // FN_UpdateClientData
+
+#ifdef FN_AddToFullPack
+int FN_AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
+#endif // FN_AddToFullPack
+
+#ifdef FN_CreateBaseline
+void FN_CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
+#endif // FN_CreateBaseline
+
+#ifdef FN_RegisterEncoders
+void FN_RegisterEncoders(void);
+#endif // FN_RegisterEncoders
+
+#ifdef FN_GetWeaponData
+int FN_GetWeaponData(struct edict_s *player, struct weapon_data_s *info);
+#endif // FN_GetWeaponData
+
+#ifdef FN_CmdStart
+void FN_CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
+#endif // FN_CmdStart
+
+#ifdef FN_CmdEnd
+void FN_CmdEnd(const edict_t *player);
+#endif // FN_CmdEnd
+
+#ifdef FN_ConnectionlessPacket
+int FN_ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);
+#endif // FN_ConnectionlessPacket
+
+#ifdef FN_GetHullBounds
+int FN_GetHullBounds(int hullnumber, float *mins, float *maxs);
+#endif // FN_GetHullBounds
+
+#ifdef FN_CreateInstancedBaselines
+void FN_CreateInstancedBaselines(void);
+#endif // FN_CreateInstancedBaselines
+
+#ifdef FN_InconsistentFile
+int FN_InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message);
+#endif // FN_InconsistentFile
+
+#ifdef FN_AllowLagCompensation
+int FN_AllowLagCompensation(void);
+#endif // FN_AllowLagCompensation
+
+
+
+
+#ifdef FN_GameDLLInit_Post
+void FN_GameDLLInit_Post(void);
+#endif // FN_GameDLLInit_Post
+
+#ifdef FN_DispatchSpawn_Post
+int FN_DispatchSpawn_Post(edict_t *pent);
+#endif // FN_DispatchSpawn_Post
+
+#ifdef FN_DispatchThink_Post
+void FN_DispatchThink_Post(edict_t *pent);
+#endif // FN_DispatchThink_Post
+
+#ifdef FN_DispatchUse_Post
+void FN_DispatchUse_Post(edict_t *pentUser, edict_t *pentOther);
+#endif // FN_DispatchUse_Post
+
+#ifdef FN_DispatchTouch_Post
+void FN_DispatchTouch_Post(edict_t *pentTouched, edict_t *pentOther);
+#endif // FN_DispatchTouch_Post
+
+#ifdef FN_DispatchBlocked_Post
+void FN_DispatchBlocked_Post(edict_t *pentBlocked, edict_t *pentOther);
+#endif // FN_DispatchBlocked_Post
+
+#ifdef FN_DispatchKeyValue_Post
+void FN_DispatchKeyValue_Post(edict_t *pentKeyvalue, KeyValueData *pkvd);
+#endif // FN_DispatchKeyValue_Post
+
+#ifdef FN_DispatchSave_Post
+void FN_DispatchSave_Post(edict_t *pent, SAVERESTOREDATA *pSaveData);
+#endif // FN_DispatchSave_Post
+
+#ifdef FN_DispatchRestore_Post
+int FN_DispatchRestore_Post(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity);
+#endif // FN_DispatchRestore_Post
+
+#ifdef FN_DispatchObjectCollsionBox_Post
+void FN_DispatchObjectCollsionBox_Post(edict_t *pent);
+#endif // FN_DispatchObjectCollsionBox_Post
+
+#ifdef FN_SaveWriteFields_Post
+void FN_SaveWriteFields_Post(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
+#endif // FN_SaveWriteFields_Post
+
+#ifdef FN_SaveReadFields_Post
+void FN_SaveReadFields_Post(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount);
+#endif // FN_SaveReadFields_Post
+
+#ifdef FN_SaveGlobalState_Post
+void FN_SaveGlobalState_Post(SAVERESTOREDATA *pSaveData);
+#endif // FN_SaveGlobalState_Post
+
+#ifdef FN_RestoreGlobalState_Post
+void FN_RestoreGlobalState_Post(SAVERESTOREDATA *pSaveData);
+#endif // FN_RestoreGlobalState_Post
+
+#ifdef FN_ResetGlobalState_Post
+void FN_ResetGlobalState_Post(void);
+#endif // FN_ResetGlobalState_Post
+
+#ifdef FN_ClientConnect_Post
+BOOL FN_ClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ]);
+#endif // FN_ClientConnect_Post
+
+#ifdef FN_ClientDisconnect_Post
+void FN_ClientDisconnect_Post(edict_t *pEntity);
+#endif // FN_ClientDisconnect_Post
+
+#ifdef FN_ClientKill_Post
+void FN_ClientKill_Post(edict_t *pEntity);
+#endif // FN_ClientKill_Post
+
+#ifdef FN_ClientPutInServer_Post
+void FN_ClientPutInServer_Post(edict_t *pEntity);
+#endif // FN_ClientPutInServer_Post
+
+#ifdef FN_ClientCommand_Post
+void FN_ClientCommand_Post(edict_t *pEntity);
+#endif // FN_ClientCommand_Post
+
+#ifdef FN_ClientUserInfoChanged_Post
+void FN_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer);
+#endif // FN_ClientUserInfoChanged_Post
+
+#ifdef FN_ServerActivate_Post
+void FN_ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax);
+#endif // FN_ServerActivate_Post
+
+#ifdef FN_ServerDeactivate_Post
+void FN_ServerDeactivate_Post(void);
+#endif // FN_ServerDeactivate_Post
+
+#ifdef FN_PlayerPreThink_Post
+void FN_PlayerPreThink_Post(edict_t *pEntity);
+#endif // FN_PlayerPreThink_Post
+
+#ifdef FN_PlayerPostThink_Post
+void FN_PlayerPostThink_Post(edict_t *pEntity);
+#endif // FN_PlayerPostThink_Post
+
+#ifdef FN_StartFrame_Post
+void FN_StartFrame_Post(void);
+#endif // FN_StartFrame_Post
+
+#ifdef FN_ParmsNewLevel_Post
+void FN_ParmsNewLevel_Post(void);
+#endif // FN_ParmsNewLevel_Post
+
+#ifdef FN_ParmsChangeLevel_Post
+void FN_ParmsChangeLevel_Post(void);
+#endif // FN_ParmsChangeLevel_Post
+
+#ifdef FN_GetGameDescription_Post
+const char *FN_GetGameDescription_Post(void);
+#endif // FN_GetGameDescription_Post
+
+#ifdef FN_PlayerCustomization_Post
+void FN_PlayerCustomization_Post(edict_t *pEntity, customization_t *pCust);
+#endif // FN_PlayerCustomization_Post
+
+#ifdef FN_SpectatorConnect_Post
+void FN_SpectatorConnect_Post(edict_t *pEntity);
+#endif // FN_SpectatorConnect_Post
+
+#ifdef FN_SpectatorDisconnect_Post
+void FN_SpectatorDisconnect_Post(edict_t *pEntity);
+#endif // FN_SpectatorDisconnect_Post
+
+#ifdef FN_SpectatorThink_Post
+void FN_SpectatorThink_Post(edict_t *pEntity);
+#endif // FN_SpectatorThink_Post
+
+#ifdef FN_Sys_Error_Post
+void FN_Sys_Error_Post(const char *error_string);
+#endif // FN_Sys_Error_Post
+
+#ifdef FN_PM_Move_Post
+void FN_PM_Move_Post(struct playermove_s *ppmove, int server);
+#endif // FN_PM_Move_Post
+
+#ifdef FN_PM_Init_Post
+void FN_PM_Init_Post(struct playermove_s *ppmove);
+#endif // FN_PM_Init_Post
+
+#ifdef FN_PM_FindTextureType_Post
+char FN_PM_FindTextureType_Post(char *name);
+#endif // FN_PM_FindTextureType_Post
+
+#ifdef FN_SetupVisibility_Post
+void FN_SetupVisibility_Post(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas);
+#endif // FN_SetupVisibility_Post
+
+#ifdef FN_UpdateClientData_Post
+void FN_UpdateClientData_Post(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
+#endif // FN_UpdateClientData_Post
+
+#ifdef FN_AddToFullPack_Post
+int FN_AddToFullPack_Post(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
+#endif // FN_AddToFullPack_Post
+
+#ifdef FN_CreateBaseline_Post
+void FN_CreateBaseline_Post(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
+#endif // FN_CreateBaseline_Post
+
+#ifdef FN_RegisterEncoders_Post
+void FN_RegisterEncoders_Post(void);
+#endif // FN_RegisterEncoders_Post
+
+#ifdef FN_GetWeaponData_Post
+int FN_GetWeaponData_Post(struct edict_s *player, struct weapon_data_s *info);
+#endif // FN_GetWeaponData_Post
+
+#ifdef FN_CmdStart_Post
+void FN_CmdStart_Post(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
+#endif // FN_CmdStart_Post
+
+#ifdef FN_CmdEnd_Post
+void FN_CmdEnd_Post(const edict_t *player);
+#endif // FN_CmdEnd_Post
+
+#ifdef FN_ConnectionlessPacket_Post
+int FN_ConnectionlessPacket_Post(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);
+#endif // FN_ConnectionlessPacket_Post
+
+#ifdef FN_GetHullBounds_Post
+int FN_GetHullBounds_Post(int hullnumber, float *mins, float *maxs);
+#endif // FN_GetHullBounds_Post
+
+#ifdef FN_CreateInstancedBaselines_Post
+void FN_CreateInstancedBaselines_Post(void);
+#endif // FN_CreateInstancedBaselines_Post
+
+#ifdef FN_InconsistentFile_Post
+int FN_InconsistentFile_Post(const edict_t *player, const char *filename, char *disconnect_message);
+#endif // FN_InconsistentFile_Post
+
+#ifdef FN_AllowLagCompensation_Post
+int FN_AllowLagCompensation_Post(void);
+#endif // FN_AllowLagCompensation_Post
+
+
+
+#ifdef FN_PrecacheModel
+int FN_PrecacheModel(char *s);
+#endif // FN_PrecacheModel
+
+#ifdef FN_PrecacheSound
+int FN_PrecacheSound(char *s);
+#endif // FN_PrecacheSound
+
+#ifdef FN_SetModel
+void FN_SetModel(edict_t *e, const char *m);
+#endif // FN_SetModel
+
+#ifdef FN_ModelIndex
+int FN_ModelIndex(const char *m);
+#endif // FN_ModelIndex
+
+#ifdef FN_ModelFrames
+int FN_ModelFrames(int modelIndex);
+#endif // FN_ModelFrames
+
+#ifdef FN_SetSize
+void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
+#endif // FN_SetSize
+
+#ifdef FN_ChangeLevel
+void FN_ChangeLevel(char *s1, char *s2);
+#endif // FN_ChangeLevel
+
+#ifdef FN_GetSpawnParms
+void FN_GetSpawnParms(edict_t *ent);
+#endif // FN_GetSpawnParms
+
+#ifdef FN_SaveSpawnParms
+void FN_SaveSpawnParms(edict_t *ent);
+#endif // FN_SaveSpawnParms
+
+#ifdef FN_VecToYaw
+float FN_VecToYaw(const float *rgflVector);
+#endif // FN_VecToYaw
+
+#ifdef FN_VecToAngles
+void FN_VecToAngles(const float *rgflVectorIn, float *rgflVectorOut);
+#endif // FN_VecToAngles
+
+#ifdef FN_MoveToOrigin
+void FN_MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType);
+#endif // FN_MoveToOrigin
+
+#ifdef FN_ChangeYaw
+void FN_ChangeYaw(edict_t *ent);
+#endif // FN_ChangeYaw
+
+#ifdef FN_ChangePitch
+void FN_ChangePitch(edict_t *ent);
+#endif // FN_ChangePitch
+
+#ifdef FN_FindEntityByString
+edict_t *FN_FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
+#endif // FN_FindEntityByString
+
+#ifdef FN_GetEntityIllum
+int FN_GetEntityIllum(edict_t *pEnt);
+#endif // FN_GetEntityIllum
+
+#ifdef FN_FindEntityInSphere
+edict_t *FN_FindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad);
+#endif // FN_FindEntityInSphere
+
+#ifdef FN_FindClientInPVS
+edict_t *FN_FindClientInPVS(edict_t *pEdict);
+#endif // FN_FindClientInPVS
+
+#ifdef FN_EntitiesInPVS
+edict_t *FN_EntitiesInPVS(edict_t *pplayer);
+#endif // FN_EntitiesInPVS
+
+#ifdef FN_MakeVectors
+void FN_MakeVectors(const float *rgflVector);
+#endif // FN_MakeVectors
+
+#ifdef FN_AngleVectors
+void FN_AngleVectors(const float *rgflVector, float *forward, float *right, float *up);
+#endif // FN_AngleVectors
+
+#ifdef FN_CreateEntity
+edict_t *FN_CreateEntity(void);
+#endif // FN_CreateEntity
+
+#ifdef FN_RemoveEntity
+void FN_RemoveEntity(edict_t *e);
+#endif // FN_RemoveEntity
+
+#ifdef FN_CreateNamedEntity
+edict_t *FN_CreateNamedEntity(int className);
+#endif // FN_CreateNamedEntity
+
+#ifdef FN_MakeStatic
+void FN_MakeStatic(edict_t *ent);
+#endif // FN_MakeStatic
+
+#ifdef FN_EntIsOnFloor
+int FN_EntIsOnFloor(edict_t *ent);
+#endif // FN_EntIsOnFloor
+
+#ifdef FN_DropToFloor
+int FN_DropToFloor(edict_t *ent);
+#endif // FN_DropToFloor
+
+#ifdef FN_WalkMove
+int FN_WalkMove(edict_t *ent, float yaw, float dist, int iMode);
+#endif // FN_WalkMove
+
+#ifdef FN_SetOrigin
+void FN_SetOrigin(edict_t *e, const float *rgflOrigin);
+#endif // FN_SetOrigin
+
+#ifdef FN_EmitSound
+void FN_EmitSound(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
+#endif // FN_EmitSound
+
+#ifdef FN_EmitAmbientSound
+void FN_EmitAmbientSound(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
+#endif // FN_EmitAmbientSound
+
+#ifdef FN_TraceLine
+void FN_TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceLine
+
+#ifdef FN_TraceToss
+void FN_TraceToss(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
+#endif // FN_TraceToss
+
+#ifdef FN_TraceMonsterHull
+int FN_TraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceMonsterHull
+
+#ifdef FN_TraceHull
+void FN_TraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceHull
+
+#ifdef FN_TraceModel
+void FN_TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
+#endif // FN_TraceModel
+
+#ifdef FN_TraceTexture
+const char *FN_TraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2 );
+#endif // FN_TraceTexture
+
+#ifdef FN_TraceSphere
+void FN_TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceSphere
+
+#ifdef FN_GetAimVector
+void FN_GetAimVector(edict_t *ent, float speed, float *rgflReturn);
+#endif // FN_GetAimVector
+
+#ifdef FN_ServerCommand
+void FN_ServerCommand(char *str);
+#endif // FN_ServerCommand
+
+#ifdef FN_ServerExecute
+void FN_ServerExecute(void);
+#endif // FN_ServerExecute
+
+#ifdef FN_engClientCommand
+void FN_engClientCommand(edict_t *pEdict, char *szFmt, ...);
+#endif // FN_engClientCommand
+
+#ifdef FN_ParticleEffect
+void FN_ParticleEffect(const float *org, const float *dir, float color, float count);
+#endif // FN_ParticleEffect
+
+#ifdef FN_LightStyle
+void FN_LightStyle(int style, char *val);
+#endif // FN_LightStyle
+
+#ifdef FN_DecalIndex
+int FN_DecalIndex(const char *name);
+#endif // FN_DecalIndex
+
+#ifdef FN_PointContents
+int FN_PointContents(const float *rgflVector);
+#endif // FN_PointContents
+
+#ifdef FN_MessageBegin
+void FN_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
+#endif // FN_MessageBegin
+
+#ifdef FN_MessageEnd
+void FN_MessageEnd(void);
+#endif // FN_MessageEnd
+
+#ifdef FN_WriteByte
+void FN_WriteByte(int iValue);
+#endif // FN_WriteByte
+
+#ifdef FN_WriteChar
+void FN_WriteChar(int iValue);
+#endif // FN_WriteChar
+
+#ifdef FN_WriteShort
+void FN_WriteShort(int iValue);
+#endif // FN_WriteShort
+
+#ifdef FN_WriteLong
+void FN_WriteLong(int iValue);
+#endif // FN_WriteLong
+
+#ifdef FN_WriteAngle
+void FN_WriteAngle(float flValue);
+#endif // FN_WriteAngle
+
+#ifdef FN_WriteCoord
+void FN_WriteCoord(float flValue);
+#endif // FN_WriteCoord
+
+#ifdef FN_WriteString
+void FN_WriteString(const char *sz);
+#endif // FN_WriteString
+
+#ifdef FN_WriteEntity
+void FN_WriteEntity(int iValue);
+#endif // FN_WriteEntity
+
+#ifdef FN_CVarRegister
+void FN_CVarRegister(cvar_t *pCvar);
+#endif // FN_CVarRegister
+
+#ifdef FN_CVarGetFloat
+float FN_CVarGetFloat(const char *szVarName);
+#endif // FN_CVarGetFloat
+
+#ifdef FN_CVarGetString
+const char *FN_CVarGetString(const char *szVarName);
+#endif // FN_CVarGetString
+
+#ifdef FN_CVarSetFloat
+void FN_CVarSetFloat(const char *szVarName, float flValue);
+#endif // FN_CVarSetFloat
+
+#ifdef FN_CVarSetString
+void FN_CVarSetString(const char *szVarName, const char *szValue);
+#endif // FN_CVarSetString
+
+#ifdef FN_AlertMessage
+void FN_AlertMessage(ALERT_TYPE atype, char *szFmt, ...);
+#endif // FN_AlertMessage
+
+#ifdef FN_EngineFprintf
+void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
+#endif // FN_EngineFprintf
+
+#ifdef FN_PvAllocEntPrivateData
+void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
+#endif // FN_PvAllocEntPrivateData
+
+#ifdef FN_PvEntPrivateData
+void *FN_PvEntPrivateData(edict_t *pEdict);
+#endif // FN_PvEntPrivateData
+
+#ifdef FN_FreeEntPrivateData
+void FN_FreeEntPrivateData(edict_t *pEdict);
+#endif // FN_FreeEntPrivateData
+
+#ifdef FN_SzFromIndex
+const char *FN_SzFromIndex(int iString);
+#endif // FN_SzFromIndex
+
+#ifdef FN_AllocString
+int FN_AllocString(const char *szValue);
+#endif // FN_AllocString
+
+#ifdef FN_GetVarsOfEnt
+struct entvars_s *FN_GetVarsOfEnt(edict_t *pEdict);
+#endif // FN_GetVarsOfEnt
+
+#ifdef FN_PEntityOfEntOffset
+edict_t *FN_PEntityOfEntOffset(int iEntOffset);
+#endif // FN_PEntityOfEntOffset
+
+#ifdef FN_EntOffsetOfPEntity
+int FN_EntOffsetOfPEntity(const edict_t *pEdict);
+#endif // FN_EntOffsetOfPEntity
+
+#ifdef FN_IndexOfEdict
+int FN_IndexOfEdict(const edict_t *pEdict);
+#endif // FN_IndexOfEdict
+
+#ifdef FN_PEntityOfEntIndex
+edict_t *FN_PEntityOfEntIndex(int iEntIndex);
+#endif // FN_PEntityOfEntIndex
+
+#ifdef FN_FindEntityByVars
+edict_t *FN_FindEntityByVars(struct entvars_s *pvars);
+#endif // FN_FindEntityByVars
+
+#ifdef FN_GetModelPtr
+void *FN_GetModelPtr(edict_t *pEdict);
+#endif // FN_GetModelPtr
+
+#ifdef FN_RegUserMsg
+int FN_RegUserMsg(const char *pszName, int iSize);
+#endif // FN_RegUserMsg
+
+#ifdef FN_AnimationAutomove
+void FN_AnimationAutomove(const edict_t *pEdict, float flTime);
+#endif // FN_AnimationAutomove
+
+#ifdef FN_GetBonePosition
+void FN_GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
+#endif // FN_GetBonePosition
+
+#ifdef FN_FunctionFromName
+unsigned long FN_FunctionFromName(const char *pName);
+#endif // FN_FunctionFromName
+
+#ifdef FN_NameForFunction
+const char *FN_NameForFunction(unsigned long function);
+#endif // FN_NameForFunction
+
+#ifdef FN_ClientPrintf
+void FN_ClientPrintf(edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg);
+#endif // FN_ClientPrintf
+
+#ifdef FN_ServerPrint
+void FN_ServerPrint(const char *szMsg);
+#endif // FN_ServerPrint
+
+#ifdef FN_Cmd_Args
+const char *FN_Cmd_Args(void);
+#endif // FN_Cmd_Args
+
+#ifdef FN_Cmd_Argv
+const char *FN_Cmd_Argv(int argc);
+#endif // FN_Cmd_Argv
+
+#ifdef FN_Cmd_Argc
+int FN_Cmd_Argc(void);
+#endif // FN_Cmd_Argc
+
+#ifdef FN_GetAttachment
+void FN_GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
+#endif // FN_GetAttachment
+
+#ifdef FN_CRC32_Init
+void FN_CRC32_Init(CRC32_t *pulCRC);
+#endif // FN_CRC32_Init
+
+#ifdef FN_CRC32_ProcessBuffer
+void FN_CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len);
+#endif // FN_CRC32_ProcessBuffer
+
+#ifdef FN_CRC32_ProcessByte
+void FN_CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
+#endif // FN_CRC32_ProcessByte
+
+#ifdef FN_CRC32_Final
+CRC32_t FN_CRC32_Final(CRC32_t pulCRC);
+#endif // FN_CRC32_Final
+
+#ifdef FN_RandomLong
+long FN_RandomLong(long lLow, long lHigh);
+#endif // FN_RandomLong
+
+#ifdef FN_RandomFloat
+float FN_RandomFloat(float flLow, float flHigh);
+#endif // FN_RandomFloat
+
+#ifdef FN_SetView
+void FN_SetView(const edict_t *pClient, const edict_t *pViewent);
+#endif // FN_SetView
+
+#ifdef FN_Time
+float FN_Time(void);
+#endif // FN_Time
+
+#ifdef FN_CrosshairAngle
+void FN_CrosshairAngle(const edict_t *pClient, float pitch, float yaw);
+#endif // FN_CrosshairAngle
+
+#ifdef FN_LoadFileForMe
+byte *FN_LoadFileForMe(char *filename, int *pLength);
+#endif // FN_LoadFileForMe
+
+#ifdef FN_FreeFile
+void FN_FreeFile(void *buffer);
+#endif // FN_FreeFile
+
+#ifdef FN_EndSection
+void FN_EndSection(const char *pszSectionName);
+#endif // FN_EndSection
+
+#ifdef FN_CompareFileTime
+int FN_CompareFileTime(char *filename1, char *filename2, int *iCompare);
+#endif // FN_CompareFileTime
+
+#ifdef FN_GetGameDir
+void FN_GetGameDir(char *szGetGameDir);
+#endif // FN_GetGameDir
+
+#ifdef FN_Cvar_RegisterVariable
+void FN_Cvar_RegisterVariable(cvar_t *variable);
+#endif // FN_Cvar_RegisterVariable
+
+#ifdef FN_FadeClientVolume
+void FN_FadeClientVolume(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
+#endif // FN_FadeClientVolume
+
+#ifdef FN_SetClientMaxspeed
+void FN_SetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed);
+#endif // FN_SetClientMaxspeed
+
+#ifdef FN_CreateFakeClient
+edict_t *FN_CreateFakeClient(const char *netname);
+#endif // FN_CreateFakeClient
+
+#ifdef FN_RunPlayerMove
+void FN_RunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
+#endif // FN_RunPlayerMove
+
+#ifdef FN_NumberOfEntities
+int FN_NumberOfEntities(void);
+#endif // FN_NumberOfEntities
+
+#ifdef FN_GetInfoKeyBuffer
+char *FN_GetInfoKeyBuffer(edict_t *e);
+#endif // FN_GetInfoKeyBuffer
+
+#ifdef FN_InfoKeyValue
+char *FN_InfoKeyValue(char *infobuffer, char *key);
+#endif // FN_InfoKeyValue
+
+#ifdef FN_SetKeyValue
+void FN_SetKeyValue(char *infobuffer, char *key, char *value);
+#endif // FN_SetKeyValue
+
+#ifdef FN_SetClientKeyValue
+void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
+#endif // FN_SetClientKeyValue
+
+#ifdef FN_IsMapValid
+int FN_IsMapValid(char *filename);
+#endif // FN_IsMapValid
+
+#ifdef FN_StaticDecal
+void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex);
+#endif // FN_StaticDecal
+
+#ifdef FN_PrecacheGeneric
+int FN_PrecacheGeneric(char *s);
+#endif // FN_PrecacheGeneric
+
+#ifdef FN_GetPlayerUserId
+int FN_GetPlayerUserId(edict_t *e );
+#endif // FN_GetPlayerUserId
+
+#ifdef FN_BuildSoundMsg
+void FN_BuildSoundMsg(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);
+#endif // FN_BuildSoundMsg
+
+#ifdef FN_IsDedicatedServer
+int FN_IsDedicatedServer(void);
+#endif // FN_IsDedicatedServer
+
+#ifdef FN_CVarGetPointer
+cvar_t *FN_CVarGetPointer(const char *szVarName);
+#endif // FN_CVarGetPointer
+
+#ifdef FN_GetPlayerWONId
+unsigned int FN_GetPlayerWONId(edict_t *e);
+#endif // FN_GetPlayerWONId
+
+#ifdef FN_Info_RemoveKey
+void FN_Info_RemoveKey( char *s, const char *key);
+#endif // FN_Info_RemoveKey
+
+#ifdef FN_GetPhysicsKeyValue
+const char *FN_GetPhysicsKeyValue(const edict_t *pClient, const char *key);
+#endif // FN_GetPhysicsKeyValue
+
+#ifdef FN_SetPhysicsKeyValue
+void FN_SetPhysicsKeyValue(const edict_t *pClient, const char *key, const char *value);
+#endif // FN_SetPhysicsKeyValue
+
+#ifdef FN_GetPhysicsInfoString
+const char *FN_GetPhysicsInfoString( const edict_t *pClient);
+#endif // FN_GetPhysicsInfoString
+
+#ifdef FN_PrecacheEvent
+unsigned short FN_PrecacheEvent(int type, const char *psz);
+#endif // FN_PrecacheEvent
+
+#ifdef FN_PlaybackEvent
+void FN_PlaybackEvent(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);
+#endif // FN_PlaybackEvent
+
+#ifdef FN_SetFatPVS
+unsigned char *FN_SetFatPVS(float *org);
+#endif // FN_SetFatPVS
+
+#ifdef FN_SetFatPAS
+unsigned char *FN_SetFatPAS(float *org);
+#endif // FN_SetFatPAS
+
+#ifdef FN_CheckVisibility
+int FN_CheckVisibility(const edict_t *entity, unsigned char *pset);
+#endif // FN_CheckVisibility
+
+#ifdef FN_DeltaSetField
+void FN_DeltaSetField(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaSetField
+
+#ifdef FN_DeltaUnsetField
+void FN_DeltaUnsetField(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaUnsetField
+
+#ifdef FN_DeltaAddEncoder
+void FN_DeltaAddEncoder(char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
+#endif // FN_DeltaAddEncoder
+
+#ifdef FN_GetCurrentPlayer
+int FN_GetCurrentPlayer(void);
+#endif // FN_GetCurrentPlayer
+
+#ifdef FN_CanSkipPlayer
+int FN_CanSkipPlayer(const edict_t *player);
+#endif // FN_CanSkipPlayer
+
+#ifdef FN_DeltaFindField
+int FN_DeltaFindField(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaFindField
+
+#ifdef FN_DeltaSetFieldByIndex
+void FN_DeltaSetFieldByIndex(struct delta_s *pFields, int fieldNumber);
+#endif // FN_DeltaSetFieldByIndex
+
+#ifdef FN_DeltaUnsetFieldByIndex
+void FN_DeltaUnsetFieldByIndex(struct delta_s *pFields, int fieldNumber);
+#endif // FN_DeltaUnsetFieldByIndex
+
+#ifdef FN_SetGroupMask
+void FN_SetGroupMask(int mask, int op);
+#endif // FN_SetGroupMask
+
+#ifdef FN_engCreateInstancedBaseline
+int FN_engCreateInstancedBaseline(int classname, struct entity_state_s *baseline);
+#endif // FN_engCreateInstancedBaseline
+
+#ifdef FN_Cvar_DirectSet
+void FN_Cvar_DirectSet(struct cvar_s *var, char *value);
+#endif // FN_Cvar_DirectSet
+
+#ifdef FN_ForceUnmodified
+void FN_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, const char *filename);
+#endif // FN_ForceUnmodified
+
+#ifdef FN_GetPlayerStats
+void FN_GetPlayerStats(const edict_t *pClient, int *ping, int *packet_loss);
+#endif // FN_GetPlayerStats
+
+#ifdef FN_AddServerCommand
+void FN_AddServerCommand(char *cmd_name, void (*function) (void));
+#endif // FN_AddServerCommand
+
+#ifdef FN_Voice_GetClientListening
+qboolean FN_Voice_GetClientListening(int iReceiver, int iSender);
+#endif // FN_Voice_GetClientListening
+
+#ifdef FN_Voice_SetClientListening
+qboolean FN_Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen);
+#endif // FN_Voice_SetClientListening
+
+#ifdef FN_GetPlayerAuthId
+const char *FN_GetPlayerAuthId(edict_t *e);
+#endif // FN_GetPlayerAuthId
+
+
+
+
+
+
+#ifdef FN_PrecacheModel_Post
+int FN_PrecacheModel_Post(char *s);
+#endif // FN_PrecacheModel_Post
+
+#ifdef FN_PrecacheSound_Post
+int FN_PrecacheSound_Post(char *s);
+#endif // FN_PrecacheSound_Post
+
+#ifdef FN_SetModel_Post
+void FN_SetModel_Post(edict_t *e, const char *m);
+#endif // FN_SetModel_Post
+
+#ifdef FN_ModelIndex_Post
+int FN_ModelIndex_Post(const char *m);
+#endif // FN_ModelIndex_Post
+
+#ifdef FN_ModelFrames_Post
+int FN_ModelFrames_Post(int modelIndex);
+#endif // FN_ModelFrames_Post
+
+#ifdef FN_SetSize_Post
+void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
+#endif // FN_SetSize_Post
+
+#ifdef FN_ChangeLevel_Post
+void FN_ChangeLevel_Post(char *s1, char *s2);
+#endif // FN_ChangeLevel_Post
+
+#ifdef FN_GetSpawnParms_Post
+void FN_GetSpawnParms_Post(edict_t *ent);
+#endif // FN_GetSpawnParms_Post
+
+#ifdef FN_SaveSpawnParms_Post
+void FN_SaveSpawnParms_Post(edict_t *ent);
+#endif // FN_SaveSpawnParms_Post
+
+#ifdef FN_VecToYaw_Post
+float FN_VecToYaw_Post(const float *rgflVector);
+#endif // FN_VecToYaw_Post
+
+#ifdef FN_VecToAngles_Post
+void FN_VecToAngles_Post(const float *rgflVectorIn, float *rgflVectorOut);
+#endif // FN_VecToAngles_Post
+
+#ifdef FN_MoveToOrigin_Post
+void FN_MoveToOrigin_Post(edict_t *ent, const float *pflGoal, float dist, int iMoveType);
+#endif // FN_MoveToOrigin_Post
+
+#ifdef FN_ChangeYaw_Post
+void FN_ChangeYaw_Post(edict_t *ent);
+#endif // FN_ChangeYaw_Post
+
+#ifdef FN_ChangePitch_Post
+void FN_ChangePitch_Post(edict_t *ent);
+#endif // FN_ChangePitch_Post
+
+#ifdef FN_FindEntityByString_Post
+edict_t *FN_FindEntityByString_Post(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
+#endif // FN_FindEntityByString_Post
+
+#ifdef FN_GetEntityIllum_Post
+int FN_GetEntityIllum_Post(edict_t *pEnt);
+#endif // FN_GetEntityIllum_Post
+
+#ifdef FN_FindEntityInSphere_Post
+edict_t *FN_FindEntityInSphere_Post(edict_t *pEdictStartSearchAfter, const float *org, float rad);
+#endif // FN_FindEntityInSphere_Post
+
+#ifdef FN_FindClientInPVS_Post
+edict_t *FN_FindClientInPVS_Post(edict_t *pEdict);
+#endif // FN_FindClientInPVS_Post
+
+#ifdef FN_EntitiesInPVS_Post
+edict_t *FN_EntitiesInPVS_Post(edict_t *pplayer);
+#endif // FN_EntitiesInPVS_Post
+
+#ifdef FN_MakeVectors_Post
+void FN_MakeVectors_Post(const float *rgflVector);
+#endif // FN_MakeVectors_Post
+
+#ifdef FN_AngleVectors_Post
+void FN_AngleVectors_Post(const float *rgflVector, float *forward, float *right, float *up);
+#endif // FN_AngleVectors_Post
+
+#ifdef FN_CreateEntity_Post
+edict_t *FN_CreateEntity_Post(void);
+#endif // FN_CreateEntity_Post
+
+#ifdef FN_RemoveEntity_Post
+void FN_RemoveEntity_Post(edict_t *e);
+#endif // FN_RemoveEntity_Post
+
+#ifdef FN_CreateNamedEntity_Post
+edict_t *FN_CreateNamedEntity_Post(int className);
+#endif // FN_CreateNamedEntity_Post
+
+#ifdef FN_MakeStatic_Post
+void FN_MakeStatic_Post(edict_t *ent);
+#endif // FN_MakeStatic_Post
+
+#ifdef FN_EntIsOnFloor_Post
+int FN_EntIsOnFloor_Post(edict_t *ent);
+#endif // FN_EntIsOnFloor_Post
+
+#ifdef FN_DropToFloor_Post
+int FN_DropToFloor_Post(edict_t *ent);
+#endif // FN_DropToFloor_Post
+
+#ifdef FN_WalkMove_Post
+int FN_WalkMove_Post(edict_t *ent, float yaw, float dist, int iMode);
+#endif // FN_WalkMove_Post
+
+#ifdef FN_SetOrigin_Post
+void FN_SetOrigin_Post(edict_t *e, const float *rgflOrigin);
+#endif // FN_SetOrigin_Post
+
+#ifdef FN_EmitSound_Post
+void FN_EmitSound_Post(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
+#endif // FN_EmitSound_Post
+
+#ifdef FN_EmitAmbientSound_Post
+void FN_EmitAmbientSound_Post(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
+#endif // FN_EmitAmbientSound_Post
+
+#ifdef FN_TraceLine_Post
+void FN_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceLine_Post
+
+#ifdef FN_TraceToss_Post
+void FN_TraceToss_Post(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
+#endif // FN_TraceToss_Post
+
+#ifdef FN_TraceMonsterHull_Post
+int FN_TraceMonsterHull_Post(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceMonsterHull_Post
+
+#ifdef FN_TraceHull_Post
+void FN_TraceHull_Post(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceHull_Post
+
+#ifdef FN_TraceModel_Post
+void FN_TraceModel_Post(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
+#endif // FN_TraceModel_Post
+
+#ifdef FN_TraceTexture_Post
+const char *FN_TraceTexture_Post(edict_t *pTextureEntity, const float *v1, const float *v2 );
+#endif // FN_TraceTexture_Post
+
+#ifdef FN_TraceSphere_Post
+void FN_TraceSphere_Post(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
+#endif // FN_TraceSphere_Post
+
+#ifdef FN_GetAimVector_Post
+void FN_GetAimVector_Post(edict_t *ent, float speed, float *rgflReturn);
+#endif // FN_GetAimVector_Post
+
+#ifdef FN_ServerCommand_Post
+void FN_ServerCommand_Post(char *str);
+#endif // FN_ServerCommand_Post
+
+#ifdef FN_ServerExecute_Post
+void FN_ServerExecute_Post(void);
+#endif // FN_ServerExecute_Post
+
+#ifdef FN_engClientCommand_Post
+void FN_engClientCommand_Post(edict_t *pEdict, char *szFmt, ...);
+#endif // FN_engClientCommand_Post
+
+#ifdef FN_ParticleEffect_Post
+void FN_ParticleEffect_Post(const float *org, const float *dir, float color, float count);
+#endif // FN_ParticleEffect_Post
+
+#ifdef FN_LightStyle_Post
+void FN_LightStyle_Post(int style, char *val);
+#endif // FN_LightStyle_Post
+
+#ifdef FN_DecalIndex_Post
+int FN_DecalIndex_Post(const char *name);
+#endif // FN_DecalIndex_Post
+
+#ifdef FN_PointContents_Post
+int FN_PointContents_Post(const float *rgflVector);
+#endif // FN_PointContents_Post
+
+#ifdef FN_MessageBegin_Post
+void FN_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
+#endif // FN_MessageBegin_Post
+
+#ifdef FN_MessageEnd_Post
+void FN_MessageEnd_Post(void);
+#endif // FN_MessageEnd_Post
+
+#ifdef FN_WriteByte_Post
+void FN_WriteByte_Post(int iValue);
+#endif // FN_WriteByte_Post
+
+#ifdef FN_WriteChar_Post
+void FN_WriteChar_Post(int iValue);
+#endif // FN_WriteChar_Post
+
+#ifdef FN_WriteShort_Post
+void FN_WriteShort_Post(int iValue);
+#endif // FN_WriteShort_Post
+
+#ifdef FN_WriteLong_Post
+void FN_WriteLong_Post(int iValue);
+#endif // FN_WriteLong_Post
+
+#ifdef FN_WriteAngle_Post
+void FN_WriteAngle_Post(float flValue);
+#endif // FN_WriteAngle_Post
+
+#ifdef FN_WriteCoord_Post
+void FN_WriteCoord_Post(float flValue);
+#endif // FN_WriteCoord_Post
+
+#ifdef FN_WriteString_Post
+void FN_WriteString_Post(const char *sz);
+#endif // FN_WriteString_Post
+
+#ifdef FN_WriteEntity_Post
+void FN_WriteEntity_Post(int iValue);
+#endif // FN_WriteEntity_Post
+
+#ifdef FN_CVarRegister_Post
+void FN_CVarRegister_Post(cvar_t *pCvar);
+#endif // FN_CVarRegister_Post
+
+#ifdef FN_CVarGetFloat_Post
+float FN_CVarGetFloat_Post(const char *szVarName);
+#endif // FN_CVarGetFloat_Post
+
+#ifdef FN_CVarGetString_Post
+const char *FN_CVarGetString_Post(const char *szVarName);
+#endif // FN_CVarGetString_Post
+
+#ifdef FN_CVarSetFloat_Post
+void FN_CVarSetFloat_Post(const char *szVarName, float flValue);
+#endif // FN_CVarSetFloat_Post
+
+#ifdef FN_CVarSetString_Post
+void FN_CVarSetString_Post(const char *szVarName, const char *szValue);
+#endif // FN_CVarSetString_Post
+
+#ifdef FN_AlertMessage_Post
+void FN_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...);
+#endif // FN_AlertMessage_Post
+
+#ifdef FN_EngineFprintf_Post
+void FN_EngineFprintf_Post(FILE *pfile, char *szFmt, ...);
+#endif // FN_EngineFprintf_Post
+
+#ifdef FN_PvAllocEntPrivateData_Post
+void *FN_PvAllocEntPrivateData_Post(edict_t *pEdict, long cb);
+#endif // FN_PvAllocEntPrivateData_Post
+
+#ifdef FN_PvEntPrivateData_Post
+void *FN_PvEntPrivateData_Post(edict_t *pEdict);
+#endif // FN_PvEntPrivateData_Post
+
+#ifdef FN_FreeEntPrivateData_Post
+void FN_FreeEntPrivateData_Post(edict_t *pEdict);
+#endif // FN_FreeEntPrivateData_Post
+
+#ifdef FN_SzFromIndex_Post
+const char *FN_SzFromIndex_Post(int iString);
+#endif // FN_SzFromIndex_Post
+
+#ifdef FN_AllocString_Post
+int FN_AllocString_Post(const char *szValue);
+#endif // FN_AllocString_Post
+
+#ifdef FN_GetVarsOfEnt_Post
+struct entvars_s *FN_GetVarsOfEnt_Post(edict_t *pEdict);
+#endif // FN_GetVarsOfEnt_Post
+
+#ifdef FN_PEntityOfEntOffset_Post
+edict_t *FN_PEntityOfEntOffset_Post(int iEntOffset);
+#endif // FN_PEntityOfEntOffset_Post
+
+#ifdef FN_EntOffsetOfPEntity_Post
+int FN_EntOffsetOfPEntity_Post(const edict_t *pEdict);
+#endif // FN_EntOffsetOfPEntity_Post
+
+#ifdef FN_IndexOfEdict_Post
+int FN_IndexOfEdict_Post(const edict_t *pEdict);
+#endif // FN_IndexOfEdict_Post
+
+#ifdef FN_PEntityOfEntIndex_Post
+edict_t *FN_PEntityOfEntIndex_Post(int iEntIndex);
+#endif // FN_PEntityOfEntIndex_Post
+
+#ifdef FN_FindEntityByVars_Post
+edict_t *FN_FindEntityByVars_Post(struct entvars_s *pvars);
+#endif // FN_FindEntityByVars_Post
+
+#ifdef FN_GetModelPtr_Post
+void *FN_GetModelPtr_Post(edict_t *pEdict);
+#endif // FN_GetModelPtr_Post
+
+#ifdef FN_RegUserMsg_Post
+int FN_RegUserMsg_Post(const char *pszName, int iSize);
+#endif // FN_RegUserMsg_Post
+
+#ifdef FN_AnimationAutomove_Post
+void FN_AnimationAutomove_Post(const edict_t *pEdict, float flTime);
+#endif // FN_AnimationAutomove_Post
+
+#ifdef FN_GetBonePosition_Post
+void FN_GetBonePosition_Post(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
+#endif // FN_GetBonePosition_Post
+
+#ifdef FN_FunctionFromName_Post
+unsigned long FN_FunctionFromName_Post(const char *pName);
+#endif // FN_FunctionFromName_Post
+
+#ifdef FN_NameForFunction_Post
+const char *FN_NameForFunction_Post(unsigned long function);
+#endif // FN_NameForFunction_Post
+
+#ifdef FN_ClientPrintf_Post
+void FN_ClientPrintf_Post(edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg);
+#endif // FN_ClientPrintf_Post
+
+#ifdef FN_ServerPrint_Post
+void FN_ServerPrint_Post(const char *szMsg);
+#endif // FN_ServerPrint_Post
+
+#ifdef FN_Cmd_Args_Post
+const char *FN_Cmd_Args_Post(void);
+#endif // FN_Cmd_Args_Post
+
+#ifdef FN_Cmd_Argv_Post
+const char *FN_Cmd_Argv_Post(int argc);
+#endif // FN_Cmd_Argv_Post
+
+#ifdef FN_Cmd_Argc_Post
+int FN_Cmd_Argc_Post(void);
+#endif // FN_Cmd_Argc_Post
+
+#ifdef FN_GetAttachment_Post
+void FN_GetAttachment_Post(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
+#endif // FN_GetAttachment_Post
+
+#ifdef FN_CRC32_Init_Post
+void FN_CRC32_Init_Post(CRC32_t *pulCRC);
+#endif // FN_CRC32_Init_Post
+
+#ifdef FN_CRC32_ProcessBuffer_Post
+void FN_CRC32_ProcessBuffer_Post(CRC32_t *pulCRC, void *p, int len);
+#endif // FN_CRC32_ProcessBuffer_Post
+
+#ifdef FN_CRC32_ProcessByte_Post
+void FN_CRC32_ProcessByte_Post(CRC32_t *pulCRC, unsigned char ch);
+#endif // FN_CRC32_ProcessByte_Post
+
+#ifdef FN_CRC32_Final_Post
+CRC32_t FN_CRC32_Final_Post(CRC32_t pulCRC);
+#endif // FN_CRC32_Final_Post
+
+#ifdef FN_RandomLong_Post
+long FN_RandomLong_Post(long lLow, long lHigh);
+#endif // FN_RandomLong_Post
+
+#ifdef FN_RandomFloat_Post
+float FN_RandomFloat_Post(float flLow, float flHigh);
+#endif // FN_RandomFloat_Post
+
+#ifdef FN_SetView_Post
+void FN_SetView_Post(const edict_t *pClient, const edict_t *pViewent);
+#endif // FN_SetView_Post
+
+#ifdef FN_Time_Post
+float FN_Time_Post(void);
+#endif // FN_Time_Post
+
+#ifdef FN_CrosshairAngle_Post
+void FN_CrosshairAngle_Post(const edict_t *pClient, float pitch, float yaw);
+#endif // FN_CrosshairAngle_Post
+
+#ifdef FN_LoadFileForMe_Post
+byte *FN_LoadFileForMe_Post(char *filename, int *pLength);
+#endif // FN_LoadFileForMe_Post
+
+#ifdef FN_FreeFile_Post
+void FN_FreeFile_Post(void *buffer);
+#endif // FN_FreeFile_Post
+
+#ifdef FN_EndSection_Post
+void FN_EndSection_Post(const char *pszSectionName);
+#endif // FN_EndSection_Post
+
+#ifdef FN_CompareFileTime_Post
+int FN_CompareFileTime_Post(char *filename1, char *filename2, int *iCompare);
+#endif // FN_CompareFileTime_Post
+
+#ifdef FN_GetGameDir_Post
+void FN_GetGameDir_Post(char *szGetGameDir);
+#endif // FN_GetGameDir_Post
+
+#ifdef FN_Cvar_RegisterVariable_Post
+void FN_Cvar_RegisterVariable_Post(cvar_t *variable);
+#endif // FN_Cvar_RegisterVariable_Post
+
+#ifdef FN_FadeClientVolume_Post
+void FN_FadeClientVolume_Post(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
+#endif // FN_FadeClientVolume_Post
+
+#ifdef FN_SetClientMaxspeed_Post
+void FN_SetClientMaxspeed_Post(const edict_t *pEdict, float fNewMaxspeed);
+#endif // FN_SetClientMaxspeed_Post
+
+#ifdef FN_CreateFakeClient_Post
+edict_t *FN_CreateFakeClient_Post(const char *netname);
+#endif // FN_CreateFakeClient_Post
+
+#ifdef FN_RunPlayerMove_Post
+void FN_RunPlayerMove_Post(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
+#endif // FN_RunPlayerMove_Post
+
+#ifdef FN_NumberOfEntities_Post
+int FN_NumberOfEntities_Post(void);
+#endif // FN_NumberOfEntities_Post
+
+#ifdef FN_GetInfoKeyBuffer_Post
+char *FN_GetInfoKeyBuffer_Post(edict_t *e);
+#endif // FN_GetInfoKeyBuffer_Post
+
+#ifdef FN_InfoKeyValue_Post
+char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
+#endif // FN_InfoKeyValue_Post
+
+#ifdef FN_SetKeyValue_Post
+void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
+#endif // FN_SetKeyValue_Post
+
+#ifdef FN_SetClientKeyValue_Post
+void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
+#endif // FN_SetClientKeyValue_Post
+
+#ifdef FN_IsMapValid_Post
+int FN_IsMapValid_Post(char *filename);
+#endif // FN_IsMapValid_Post
+
+#ifdef FN_StaticDecal_Post
+void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, int modelIndex);
+#endif // FN_StaticDecal_Post
+
+#ifdef FN_PrecacheGeneric_Post
+int FN_PrecacheGeneric_Post(char *s);
+#endif // FN_PrecacheGeneric_Post
+
+#ifdef FN_GetPlayerUserId_Post
+int FN_GetPlayerUserId_Post(edict_t *e );
+#endif // FN_GetPlayerUserId_Post
+
+#ifdef FN_BuildSoundMsg_Post
+void FN_BuildSoundMsg_Post(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);
+#endif // FN_BuildSoundMsg_Post
+
+#ifdef FN_IsDedicatedServer_Post
+int FN_IsDedicatedServer_Post(void);
+#endif // FN_IsDedicatedServer_Post
+
+#ifdef FN_CVarGetPointer_Post
+cvar_t *FN_CVarGetPointer_Post(const char *szVarName);
+#endif // FN_CVarGetPointer_Post
+
+#ifdef FN_GetPlayerWONId_Post
+unsigned int FN_GetPlayerWONId_Post(edict_t *e);
+#endif // FN_GetPlayerWONId_Post
+
+#ifdef FN_Info_RemoveKey_Post
+void FN_Info_RemoveKey_Post( char *s, const char *key);
+#endif // FN_Info_RemoveKey_Post
+
+#ifdef FN_GetPhysicsKeyValue_Post
+const char *FN_GetPhysicsKeyValue_Post(const edict_t *pClient, const char *key);
+#endif // FN_GetPhysicsKeyValue_Post
+
+#ifdef FN_SetPhysicsKeyValue_Post
+void FN_SetPhysicsKeyValue_Post(const edict_t *pClient, const char *key, const char *value);
+#endif // FN_SetPhysicsKeyValue_Post
+
+#ifdef FN_GetPhysicsInfoString_Post
+const char *FN_GetPhysicsInfoString_Post( const edict_t *pClient);
+#endif // FN_GetPhysicsInfoString_Post
+
+#ifdef FN_PrecacheEvent_Post
+unsigned short FN_PrecacheEvent_Post(int type, const char *psz);
+#endif // FN_PrecacheEvent_Post
+
+#ifdef FN_PlaybackEvent_Post
+void FN_PlaybackEvent_Post(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);
+#endif // FN_PlaybackEvent_Post
+
+#ifdef FN_SetFatPVS_Post
+unsigned char *FN_SetFatPVS_Post(float *org);
+#endif // FN_SetFatPVS_Post
+
+#ifdef FN_SetFatPAS_Post
+unsigned char *FN_SetFatPAS_Post(float *org);
+#endif // FN_SetFatPAS_Post
+
+#ifdef FN_CheckVisibility_Post
+int FN_CheckVisibility_Post(const edict_t *entity, unsigned char *pset);
+#endif // FN_CheckVisibility_Post
+
+#ifdef FN_DeltaSetField_Post
+void FN_DeltaSetField_Post(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaSetField_Post
+
+#ifdef FN_DeltaUnsetField_Post
+void FN_DeltaUnsetField_Post(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaUnsetField_Post
+
+#ifdef FN_DeltaAddEncoder_Post
+void FN_DeltaAddEncoder_Post(char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
+#endif // FN_DeltaAddEncoder_Post
+
+#ifdef FN_GetCurrentPlayer_Post
+int FN_GetCurrentPlayer_Post(void);
+#endif // FN_GetCurrentPlayer_Post
+
+#ifdef FN_CanSkipPlayer_Post
+int FN_CanSkipPlayer_Post(const edict_t *player);
+#endif // FN_CanSkipPlayer_Post
+
+#ifdef FN_DeltaFindField_Post
+int FN_DeltaFindField_Post(struct delta_s *pFields, const char *fieldname);
+#endif // FN_DeltaFindField_Post
+
+#ifdef FN_DeltaSetFieldByIndex_Post
+void FN_DeltaSetFieldByIndex_Post(struct delta_s *pFields, int fieldNumber);
+#endif // FN_DeltaSetFieldByIndex_Post
+
+#ifdef FN_DeltaUnsetFieldByIndex_Post
+void FN_DeltaUnsetFieldByIndex_Post(struct delta_s *pFields, int fieldNumber);
+#endif // FN_DeltaUnsetFieldByIndex_Post
+
+#ifdef FN_SetGroupMask_Post
+void FN_SetGroupMask_Post(int mask, int op);
+#endif // FN_SetGroupMask_Post
+
+#ifdef FN_engCreateInstancedBaseline_Post
+int FN_engCreateInstancedBaseline_Post(int classname, struct entity_state_s *baseline);
+#endif // FN_engCreateInstancedBaseline_Post
+
+#ifdef FN_Cvar_DirectSet_Post
+void FN_Cvar_DirectSet_Post(struct cvar_s *var, char *value);
+#endif // FN_Cvar_DirectSet_Post
+
+#ifdef FN_ForceUnmodified_Post
+void FN_ForceUnmodified_Post(FORCE_TYPE type, float *mins, float *maxs, const char *filename);
+#endif // FN_ForceUnmodified_Post
+
+#ifdef FN_GetPlayerStats_Post
+void FN_GetPlayerStats_Post(const edict_t *pClient, int *ping, int *packet_loss);
+#endif // FN_GetPlayerStats_Post
+
+#ifdef FN_AddServerCommand_Post
+void FN_AddServerCommand_Post(char *cmd_name, void (*function)(void));
+#endif // FN_AddServerCommand_Post
+
+#ifdef FN_Voice_GetClientListening_Post
+qboolean FN_Voice_GetClientListening_Post(int iReceiver, int iSender);
+#endif // FN_Voice_GetClientListening_Post
+
+#ifdef FN_Voice_SetClientListening_Post
+qboolean FN_Voice_SetClientListening_Post(int iReceiver, int iSender, qboolean bListen);
+#endif // FN_Voice_SetClientListening_Post
+
+#ifdef FN_GetPlayerAuthId_Post
+const char *FN_GetPlayerAuthId_Post(edict_t *e);
+#endif // FN_GetPlayerAuthId
+
+
+
+
+#ifdef FN_OnFreeEntPrivateData
+void FN_OnFreeEntPrivateData(edict_t *pEnt);
+#endif // FN_OnFreeEntPrivateData
+
+#ifdef FN_GameShutdown
+void FN_GameShutdown(void);
+#endif // FN_GameShutdown
+
+#ifdef FN_ShouldCollide
+int FN_ShouldCollide(edict_t *pentTouched, edict_t *pentOther);
+#endif // FN_ShouldCollide
+
+
+
+
+
+#ifdef FN_OnFreeEntPrivateData_Post
+void FN_OnFreeEntPrivateData_Post(edict_t *pEnt);
+#endif // FN_OnFreeEntPrivateData_Post
+
+#ifdef FN_GameShutdown_Post
+void FN_GameShutdown_Post(void);
+#endif // FN_GameShutdown_Post
+
+#ifdef FN_ShouldCollide_Post
+int FN_ShouldCollide_Post(edict_t *pentTouched, edict_t *pentOther);
+#endif // FN_ShouldCollide_Post
+
+#endif // USE_METAMOD
+
+
+#ifdef FN_AMXX_QUERY
+void FN_AMXX_QUERY(void);
+#endif // FN_AMXX_QUERY
+
+#ifdef FN_AMXX_ATTACH
+void FN_AMXX_ATTACH(void);
+#endif // FN_AMXX_ATTACH
+
+#ifdef FN_AMXX_DETACH
+void FN_AMXX_DETACH(void);
+#endif // FN_AMXX_DETACH
+
+#ifdef FN_AMXX_PLUGINSLOADED
+void FN_AMXX_PLUGINSLOADED(void);
+#endif // FN_AMXX_PLUGINSLOADED
+
+// ***** Module funcs stuff *****
+enum ForwardExecType
+{
+	ET_IGNORE = 0,					// Ignore return vaue
+	ET_STOP,						// Stop on PLUGIN_HANDLED
+	ET_STOP2,						// Stop on PLUGIN_HANDLED, continue on other values, return biggest return value
+	ET_CONTINUE,					// Continue; return biggest return value
+};
+
+enum ForwardParam
+{
+	FP_DONE = -1,					// specify this as the last argument
+									// only tells the function that there are no more arguments
+	FP_CELL,						// normal cell
+	FP_FLOAT,						// float; used as normal cell though
+	FP_STRING,						// string
+	FP_STRINGEX,					// string; will be updated to the last function's value
+	FP_ARRAY,						// array; use the return value of prepareArray.
+};
+
+
+typedef int				(*PFN_ADD_NATIVES)				(const AMX_NATIVE_INFO * /*list*/);
+typedef char *			(*PFN_BUILD_PATHNAME)			(const char * /*format*/, ...);
+typedef cell *			(*PFN_GET_AMXADDR)				(AMX * /*amx*/, cell /*offset*/);
+typedef void			(*PFN_PRINT_SRVCONSOLE)			(char * /*format*/, ...);
+typedef const char *	(*PFN_GET_MODNAME)				(void);
+typedef const char *	(*PFN_GET_AMXSCRIPTNAME)		(int /*id*/);
+typedef AMX *			(*PFN_GET_AMXSCRIPT)			(int /*id*/);
+typedef int				(*PFN_FIND_AMXSCRIPT_BYAMX)		(const AMX * /*amx*/);
+typedef int				(*PFN_FIND_AMXSCRIPT_BYNAME)	(const char * /*name*/);
+typedef int				(*PFN_SET_AMXSTRING)			(AMX * /*amx*/, cell /*amx_addr*/, const char * /* source */, int /* max */);
+typedef char *			(*PFN_GET_AMXSTRING)			(AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/);
+typedef int				(*PFN_GET_AMXSTRINGLEN)			(const cell *ptr);
+typedef char *			(*PFN_FORMAT_AMXSTRING)			(AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
+typedef void			(*PFN_COPY_AMXMEMORY)			(cell * /*dest*/, const cell * /*src*/, int /*len*/);
+typedef void			(*PFN_LOG)						(const char * /*fmt*/, ...);
+typedef int				(*PFN_RAISE_AMXERROR)			(AMX * /*amx*/, int /*error*/);
+typedef int				(*PFN_REGISTER_FORWARD)			(const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
+typedef int				(*PFN_EXECUTE_FORWARD)			(int /*id*/, ... /*params*/);
+typedef cell			(*PFN_PREPARE_CELLARRAY)		(cell * /*ptr*/, unsigned int /*size*/);
+typedef cell			(*PFN_PREPARE_CHARARRAY)		(char * /*ptr*/, unsigned int /*size*/);
+typedef int				(*PFN_IS_PLAYER_VALID)			(int /*id*/);
+typedef const char *	(*PFN_GET_PLAYER_NAME)			(int /*id*/);
+typedef const char *	(*PFN_GET_PLAYER_IP)			(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_INGAME)			(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_BOT)			(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_AUTHORIZED)		(int /*id*/);
+typedef float			(*PFN_GET_PLAYER_TIME)			(int /*id*/);
+typedef float			(*PFN_GET_PLAYER_PLAYTIME)		(int /*id*/);
+typedef int			(*PFN_GETPLAYERFLAGS) 			(int /* id*/);
+typedef int				(*PFN_GET_PLAYER_CURWEAPON)		(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_TEAMID)		(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_DEATHS)		(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_MENU)			(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_KEYS)			(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_ALIVE)			(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_FRAGS)			(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_CONNECTING)		(int /*id*/);
+typedef int				(*PFN_IS_PLAYER_HLTV)			(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_ARMOR)			(int /*id*/);
+typedef int				(*PFN_GET_PLAYER_HEALTH)		(int /*id*/);
+#ifdef USE_METAMOD
+typedef edict_t *		(*PFN_GET_PLAYER_EDICT)			(int /*id*/);
+#else
+typedef void *			(*PFN_GET_PLAYER_EDICT)			(int /*id*/);
+#endif
+
+typedef void *			(*PFN_ALLOCATOR)				(const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
+														 const unsigned int /*type*/, const size_t /*size*/);
+typedef void *			(*PFN_REALLOCATOR)				(const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
+														 const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
+typedef void			(*PFN_DEALLOCATOR)				(const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
+														 const unsigned int /*type*/, const void* /*addr*/ );
+typedef int				(*PFN_AMX_EXEC)					(AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
+typedef int				(*PFN_AMX_EXECV)				(AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
+typedef int				(*PFN_AMX_ALLOT)				(AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
+typedef int				(*PFN_AMX_FINDPUBLIC)			(AMX* /*amx*/, char* /*func name*/, int* /*index*/);
+typedef int				(*PFN_AMX_FINDNATIVE)			(AMX* /*amx*/, char* /*func name*/, int* /*index*/);
+typedef int				(*PFN_LOAD_AMXSCRIPT)			(AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
+typedef int				(*PFN_UNLOAD_AMXSCRIPT)			(AMX* /*amx*/,void** /*code*/);
+typedef cell			(*PFN_REAL_TO_CELL)				(REAL /*x*/);
+typedef REAL			(*PFN_CELL_TO_REAL)				(cell /*x*/);
+typedef int				(*PFN_REGISTER_SPFORWARD)		(AMX * /*amx*/, int /*func*/, ... /*params*/);
+typedef int				(*PFN_REGISTER_SPFORWARD_BYNAME)	(AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
+typedef void			(*PFN_UNREGISTER_SPFORWARD)		(int /*id*/);
+typedef	void			(*PFN_MERGEDEFINITION_FILE)		(const char * /*filename*/);
+typedef const char *	(*PFN_FORMAT)					(const char * /*fmt*/, ... /*params*/);
+
+extern PFN_ADD_NATIVES				g_fn_AddNatives;
+extern PFN_BUILD_PATHNAME			g_fn_BuildPathname;
+extern PFN_GET_AMXADDR				g_fn_GetAmxAddr;
+extern PFN_PRINT_SRVCONSOLE			g_fn_PrintSrvConsole;
+extern PFN_GET_MODNAME				g_fn_GetModname;
+extern PFN_GET_AMXSCRIPTNAME		g_fn_GetAmxScriptName;
+extern PFN_GET_AMXSCRIPT			g_fn_GetAmxScript;
+extern PFN_FIND_AMXSCRIPT_BYAMX		g_fn_FindAmxScriptByAmx;
+extern PFN_FIND_AMXSCRIPT_BYNAME	g_fn_FindAmxScriptByName;
+extern PFN_SET_AMXSTRING			g_fn_SetAmxString;
+extern PFN_GET_AMXSTRING			g_fn_GetAmxString;
+extern PFN_GET_AMXSTRINGLEN			g_fn_GetAmxStringLen;
+extern PFN_FORMAT_AMXSTRING			g_fn_FormatAmxString;
+extern PFN_COPY_AMXMEMORY			g_fn_CopyAmxMemory;
+extern PFN_LOG						g_fn_Log;
+extern PFN_RAISE_AMXERROR			g_fn_RaiseAmxError;
+extern PFN_REGISTER_FORWARD			g_fn_RegisterForward;
+extern PFN_EXECUTE_FORWARD			g_fn_ExecuteForward;
+extern PFN_PREPARE_CELLARRAY		g_fn_PrepareCellArray;
+extern PFN_PREPARE_CHARARRAY		g_fn_PrepareCharArray;
+extern PFN_IS_PLAYER_VALID			g_fn_IsPlayerValid;
+extern PFN_GET_PLAYER_NAME			g_fn_GetPlayerName;
+extern PFN_GET_PLAYER_IP			g_fn_GetPlayerIP;
+extern PFN_IS_PLAYER_INGAME			g_fn_IsPlayerIngame;
+extern PFN_IS_PLAYER_BOT			g_fn_IsPlayerBot;
+extern PFN_IS_PLAYER_AUTHORIZED		g_fn_IsPlayerAuthorized;
+extern PFN_GET_PLAYER_TIME			g_fn_GetPlayerTime;
+extern PFN_GET_PLAYER_PLAYTIME		g_fn_GetPlayerPlayTime;
+extern PFN_GET_PLAYER_CURWEAPON		g_fn_GetPlayerCurweapon;
+extern PFN_GET_PLAYER_TEAMID		g_fn_GetPlayerTeamID;
+extern PFN_GET_PLAYER_DEATHS		g_fn_GetPlayerDeaths;
+extern PFN_GET_PLAYER_MENU			g_fn_GetPlayerMenu;
+extern PFN_GET_PLAYER_KEYS			g_fn_GetPlayerKeys;
+extern PFN_IS_PLAYER_ALIVE			g_fn_IsPlayerAlive;
+extern PFN_GET_PLAYER_FRAGS			g_fn_GetPlayerFrags;
+extern PFN_IS_PLAYER_CONNECTING		g_fn_IsPlayerConnecting;
+extern PFN_IS_PLAYER_HLTV			g_fn_IsPlayerHLTV;
+extern PFN_GET_PLAYER_ARMOR			g_fn_GetPlayerArmor;
+extern PFN_GET_PLAYER_HEALTH		g_fn_GetPlayerHealth;
+extern PFN_AMX_EXEC					g_fn_AmxExec;
+extern PFN_AMX_EXECV				g_fn_AmxExecv;
+extern PFN_AMX_ALLOT				g_fn_AmxAllot;
+extern PFN_AMX_FINDPUBLIC			g_fn_AmxFindPublic;
+extern PFN_LOAD_AMXSCRIPT			g_fn_LoadAmxScript;
+extern PFN_UNLOAD_AMXSCRIPT			g_fn_UnloadAmxScript;
+extern PFN_REAL_TO_CELL				g_fn_RealToCell;
+extern PFN_CELL_TO_REAL				g_fn_CellToReal;
+extern PFN_REGISTER_SPFORWARD		g_fn_RegisterSPForward;
+extern PFN_REGISTER_SPFORWARD_BYNAME	g_fn_RegisterSPForwardByName;
+extern PFN_UNREGISTER_SPFORWARD		g_fn_UnregisterSPForward;
+extern PFN_MERGEDEFINITION_FILE		g_fn_MergeDefinition_File;
+extern PFN_AMX_FINDNATIVE			g_fn_AmxFindNative;
+extern PFN_GETPLAYERFLAGS		g_fn_GetPlayerFlags;
+extern PFN_GET_PLAYER_EDICT			g_fn_GetPlayerEdict;
+extern PFN_FORMAT					g_fn_Format;
+
+#ifdef MAY_NEVER_BE_DEFINED
+// Function prototypes for intellisense and similar systems
+// They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED
+int				MF_AddNatives				(const AMX_NATIVE_INFO *list) { }
+char *			MF_BuildPathname			(const char * format, ...) { }
+cell *			MF_GetAmxAddr				(AMX * amx, cell offset) { }
+void			MF_PrintSrvConsole			(char * format, ...) { }
+const char *	MF_GetModname				(void) { }
+const char *	MF_GetScriptName			(int id) { }
+AMX *			MF_GetScriptAmx				(int id) { }
+int				MF_FindScriptByAmx			(const AMX * amx) { }
+int				MF_FindScriptByAmx			(const char * name) { }
+int				MF_SetAmxString				(AMX * amx, cell amx_addr, const char *  source , int  max ) { }
+char *			MF_GetAmxString				(AMX * amx, cell amx_addr, int bufferId, int * pLen) { }
+int				MF_GetAmxStringLen			(const cell *ptr) { }
+char *			MF_FormatAmxString			(AMX * amx, cell * params, int startParam, int * pLen) { }
+void			MF_CopyAmxMemory			(cell * dest, const cell * src, int len) { }
+void			MF_Log						(const char * fmt, ...) { }
+int				MF_RaiseAmxError			(AMX * amx, int error) { }
+int				MF_RegisterForward			(const char * funcname, ForwardExecType exectype, ...) { }
+int				MF_ExecuteForward			(int id, ...) { }
+cell			MF_PrepareCellArray			(cell * ptr, unsigned int size) { }
+cell			MF_PrepareCharArray			(char * ptr, unsigned int size) { }
+int				MF_IsPlayerValid			(int id) { }
+const char *	MF_GetPlayerName			(int id) { }
+const char *	MF_GetPlayerIP				(int id) { }
+int				MF_IsPlayerIngame			(int id) { }
+int				MF_IsPlayerBot				(int id) { }
+int				MF_IsPlayerAuthorized		(int id) { }
+float			MF_GetPlayerTime			(int id) { }
+float			MF_GetPlayerPlayTime		(int id) { }
+int				MF_GetPlayerCurweapon		(int id) { }
+int				MF_GetPlayerTeamID			(int id) { }
+int				MF_GetPlayerDeaths			(int id) { }
+int				MF_GetPlayerMenu			(int id) { }
+int				MF_GetPlayerKeys			(int id) { }
+int				MF_IsPlayerAlive			(int id) { }
+int				MF_GetPlayerFrags			(int id) { }
+int				MF_IsPlayerConnecting		(int id) { }
+int				MF_IsPlayerHLTV				(int id) { }
+int				MF_GetPlayerArmor			(int id) { }
+int				MF_GetPlayerHealth			(int id) { }
+REAL			amx_ctof					(cell x) { }
+cell			amx_ftoc					(float x) { }
+int				MF_RegisterSPForwardByName	(AMX * amx, const char *str, ...) { }
+int				MF_RegisterSPForward		(AMX * amx, int func, ...) { }
+void			MF_UnregisterSPForward		(int id) { }
+int				MF_GetPlayerFlags			(int id) { }
+edict_t*		MF_GetPlayerEdict			(int id) { }
+const char *	MF_Format					(const char *fmt, ...) { }
+#endif	// MAY_NEVER_BE_DEFINED
+
+#define MF_AddNatives g_fn_AddNatives
+#define MF_BuildPathname g_fn_BuildPathname
+#define MF_FormatAmxString g_fn_FormatAmxString
+#define MF_GetAmxAddr g_fn_GetAmxAddr
+#define MF_PrintSrvConsole g_fn_PrintSrvConsole
+#define MF_GetModname g_fn_GetModname
+#define MF_GetScriptName g_fn_GetAmxScriptName
+#define MF_GetScriptAmx g_fn_GetAmxScript
+#define MF_FindScriptByAmx g_fn_FindAmxScriptByAmx
+#define MF_FindScriptByName g_fn_FindAmxScriptByName
+#define MF_SetAmxString g_fn_SetAmxString
+#define MF_GetAmxString g_fn_GetAmxString
+#define MF_GetAmxStringLen g_fn_GetAmxStringLen
+#define MF_CopyAmxMemory g_fn_CopyAmxMemory
+void MF_Log(const char *fmt, ...);
+#define MF_RaiseAmxError g_fn_RaiseAmxError
+#define MF_RegisterForward g_fn_RegisterForward
+#define MF_ExecuteForward g_fn_ExecuteForward
+#define MF_PrepareCellArray g_fn_PrepareCellArray
+#define MF_PrepareCharArray g_fn_PrepareCharArray
+#define MF_IsPlayerValid g_fn_IsPlayerValid
+#define MF_GetPlayerName g_fn_GetPlayerName
+#define MF_GetPlayerIP g_fn_GetPlayerIP
+#define MF_IsPlayerIngame g_fn_IsPlayerIngame
+#define MF_IsPlayerBot g_fn_IsPlayerBot
+#define MF_IsPlayerAuthorized g_fn_IsPlayerAuthorized
+#define MF_GetPlayerTime g_fn_GetPlayerTime
+#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
+#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
+#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
+#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
+#define MF_GetPlayerMenu g_fn_GetPlayerMenu
+#define MF_GetPlayerKeys g_fn_GetPlayerKeys
+#define MF_IsPlayerAlive g_fn_IsPlayerAlive
+#define MF_GetPlayerFrags g_fn_GetPlayerFrags
+#define MF_IsPlayerConnecting g_fn_IsPlayerConnecting
+#define MF_IsPlayerHLTV g_fn_IsPlayerHLTV
+#define MF_GetPlayerArmor g_fn_GetPlayerArmor
+#define MF_GetPlayerHealth g_fn_GetPlayerHealth
+#define MF_AmxExec g_fn_AmxExec
+#define MF_AmxExecv g_fn_AmxExecv
+#define MF_AmxFindPublic g_fn_AmxFindPublic
+#define MF_AmxAllot g_fn_AmxAllot
+#define MF_AmxFindNative g_fn_AmxFindNative
+#define MF_LoadAmxScript g_fn_LoadAmxScript
+#define MF_UnloadAmxScript g_fn_UnloadAmxScript
+#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
+#define amx_ctof g_fn_CellToReal
+#define amx_ftoc g_fn_RealToCell
+#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
+#define MF_RegisterSPForward g_fn_RegisterSPForward
+#define MF_UnregisterSPForward g_fn_UnregisterSPForward
+#define MF_GetPlayerFlags g_fn_GetPlayerFlags
+#define MF_GetPlayerEdict g_fn_GetPlayerEdict
+#define MF_Format g_fn_Format;
+
+/*** Memory ***/
+void	*operator new(size_t reportedSize);
+void	*operator new[](size_t reportedSize);
+void	*operator new(size_t reportedSize, const char *sourceFile, int sourceLine);
+void	*operator new[](size_t reportedSize, const char *sourceFile, int sourceLine);
+void	operator delete(void *reportedAddress);
+void	operator delete[](void *reportedAddress);
+
+// Allocation types
+extern	const	unsigned int	m_alloc_unknown;
+extern	const	unsigned int	m_alloc_new;
+extern	const	unsigned int	m_alloc_new_array;
+extern	const	unsigned int	m_alloc_malloc;
+extern	const	unsigned int	m_alloc_calloc;
+extern	const	unsigned int	m_alloc_realloc;
+extern	const	unsigned int	m_alloc_delete;
+extern	const	unsigned int	m_alloc_delete_array;
+extern	const	unsigned int	m_alloc_free;
+
+// To be called before new / delete
+void	Mem_SetOwner(const char *filename, int line, const char *function);
+// Actual allocator
+void *	Mem_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+					const unsigned int allocationType, const size_t reportedSize);
+void *	Mem_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+					const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress);
+void	Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc,
+					const unsigned int deallocationType, void *reportedAddress);
+
+// memory macros
+#ifndef __FUNCTION__
+#define __FUNCTION__ "??"
+#endif
+
+// call Mem_SetOwner, followed by the actual new operator
+#define	new			(Mem_SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new
+// call Mem_SetOwner, followed by the actual delete operator
+#define	delete		(Mem_SetOwner(__FILE__,__LINE__,__FUNCTION__),false) ? Mem_SetOwner("",0,"") : delete
+#define	malloc(sz)	Mem_Allocator  (__FILE__,__LINE__,__FUNCTION__,m_alloc_malloc,sz)
+#define	calloc(sz)	Mem_Allocator  (__FILE__,__LINE__,__FUNCTION__,m_alloc_calloc,sz)
+#define	realloc(ptr,sz)	Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
+#define	free(ptr)	Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
+
+#endif // #ifndef __AMXXMODULE_H__
diff --git a/dlls/csx/source/compile.bat b/dlls/csx/source/compile.bat
new file mode 100755
index 00000000..60e889c2
--- /dev/null
+++ b/dlls/csx/source/compile.bat
@@ -0,0 +1,6 @@
+@echo off
+PATH=D:\gcc\bin;%PATH%
+
+make
+
+pause
diff --git a/dlls/csx/source/meta_api.cpp b/dlls/csx/source/meta_api.cpp
new file mode 100755
index 00000000..c6cd7ba2
--- /dev/null
+++ b/dlls/csx/source/meta_api.cpp
@@ -0,0 +1,368 @@
+#include "amxxmodule.h"
+#include "rank.h"
+
+funEventCall modMsgsEnd[MAX_REG_MSGS];
+funEventCall modMsgs[MAX_REG_MSGS];
+
+void (*function)(void*);
+void (*endfunction)(void*);
+
+CPlayer players[33];
+
+CPlayer* mPlayer;
+
+int mPlayerIndex;
+int mState;
+
+RankSystem g_rank;
+
+Grenades g_grenades;
+
+int iFGrenade;
+int iFDeath;
+int iFDamage;
+
+int iFBPlanted;
+int iFBDefused;
+int iFBPlanting;
+int iFBDefusing;
+int iFBExplode;
+
+int g_bombAnnounce;
+int g_Planter;
+int g_Defuser;
+
+bool rankBots;
+
+int gmsgCurWeapon;
+int gmsgDeathMsg;
+int gmsgDamage;
+int gmsgDamageEnd;
+int gmsgWeaponList;
+int gmsgResetHUD;
+int gmsgAmmoX;
+int gmsgScoreInfo;
+int gmsgAmmoPickup;
+
+int gmsgSendAudio;
+int gmsgTextMsg;
+int gmsgBarTime;
+
+cvar_t init_csstats_maxsize ={"csstats_maxsize","3500", 0 , 3500.0 };
+cvar_t init_csstats_reset ={"csstats_reset","0"};
+cvar_t init_csstats_rank ={"csstats_rank","0"};
+cvar_t *csstats_maxsize;
+cvar_t *csstats_reset;
+cvar_t *csstats_rank;
+
+cvar_t* csstats_rankbots;
+cvar_t* csstats_pause;
+cvar_t init_csstats_rankbots ={"csstats_rankbots","1"};
+cvar_t init_csstats_pause = {"csstats_pause","0"};
+
+struct sUserMsg {
+	const char* name;
+	int* id;
+	funEventCall func;
+	bool endmsg;
+} g_user_msg[] = {
+	{ "CurWeapon" , &gmsgCurWeapon , Client_CurWeapon, false },
+	{ "Damage" , &gmsgDamage,Client_Damage, false  },	
+	{ "Damage" , &gmsgDamageEnd, Client_Damage_End, true },
+	{ "WeaponList" , &gmsgWeaponList, Client_WeaponList, false },
+	{ "ResetHUD" , &gmsgResetHUD,Client_ResetHUD, true },
+	{ "AmmoX" , &gmsgAmmoX, Client_AmmoX , false },
+	{ "ScoreInfo" , &gmsgScoreInfo, Client_ScoreInfo, false },
+	{ "AmmoPickup" , &gmsgAmmoPickup, Client_AmmoPickup , false },
+
+	{ "SendAudio" , &gmsgSendAudio , Client_SendAudio , false },
+	{ "TextMsg" , &gmsgTextMsg , Client_TextMsg , false },
+	{ "BarTime" , &gmsgBarTime , Client_BarTime , false },
+
+	{ 0 , 0,0,false }
+};
+
+int RegUserMsg_Post(const char *pszName, int iSize)
+{
+	for (int i = 0; g_user_msg[ i ].name; ++i )
+	{
+		if ( !*g_user_msg[i].id && strcmp( g_user_msg[ i ].name , pszName  ) == 0 )
+		{
+			int id = META_RESULT_ORIG_RET( int );
+
+			*g_user_msg[ i ].id = id;
+		
+			if ( g_user_msg[ i ].endmsg )
+				modMsgsEnd[ id  ] = g_user_msg[ i ].func;
+			else
+				modMsgs[ id  ] = g_user_msg[ i ].func;
+			//break;
+		}
+	}
+	RETURN_META_VALUE(MRES_IGNORED, 0);
+}
+
+const char* get_localinfo( const char* name , const char* def = 0 )
+{
+	const char* b = LOCALINFO( (char*)name );
+	if (((b==0)||(*b==0)) && def )
+		SET_LOCALINFO((char*)name,(char*)(b = def) );
+	return b;
+}
+
+void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
+
+	rankBots = (int)csstats_rankbots->value ? true:false;
+
+	for( int i = 1; i <= gpGlobals->maxClients; ++i)
+		GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i );
+	RETURN_META(MRES_IGNORED);
+}
+
+void PlayerPreThink_Post( edict_t *pEntity ) {
+    if ( !isModuleActive() )
+		return;
+
+	CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
+	if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time ){
+
+		if ( !ignoreBots(pEntity) ){
+			pPlayer->clearStats = 0.0f;
+			if (pPlayer->rank)
+				pPlayer->rank->updatePosition( &pPlayer->life );
+			pPlayer->restartStats(false);
+		}
+	}
+	RETURN_META(MRES_IGNORED);
+}
+
+void ServerDeactivate() {
+	int i;
+	for( i = 1;i<=gpGlobals->maxClients; ++i){
+		CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
+		if (pPlayer->rank) pPlayer->Disconnect();
+	}
+	if ( (g_rank.getRankNum() >= (int)csstats_maxsize->value) || ((int)csstats_reset->value == 1 ) ) {
+		CVAR_SET_FLOAT("csstats_reset",0.0);
+		g_rank.clear(); // clear before save to file
+	}
+	g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) );	
+
+	// clear custom weapons info
+	for ( i=MAX_WEAPONS;iConnect(pszAddress);
+	RETURN_META_VALUE(MRES_IGNORED, TRUE);
+}
+
+void ClientDisconnect( edict_t *pEntity ) {
+	CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
+	if (pPlayer->rank) pPlayer->Disconnect();
+	RETURN_META(MRES_IGNORED);
+}
+
+void ClientPutInServer_Post( edict_t *pEntity ) {
+	GET_PLAYER_POINTER(pEntity)->PutInServer();
+	RETURN_META(MRES_IGNORED);
+}
+
+void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
+	CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
+	const char* name = INFOKEY_VALUE(infobuffer,"name");
+	const char* oldname = STRING(pEntity->v.netname);
+
+	if ( pPlayer->rank ){
+		if ( strcmp(oldname,name) != 0 ) {
+			if ((int)csstats_rank->value == 0)
+				pPlayer->rank = g_rank.findEntryInRank( name, name );
+			else
+				pPlayer->rank->setName( name );
+		}
+	}
+	else if ( pPlayer->IsBot() ) {
+		pPlayer->Connect( "127.0.0.1" );
+		pPlayer->PutInServer();
+	}
+	RETURN_META(MRES_IGNORED);
+}
+
+void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) {
+	if (ed){
+		mPlayerIndex = ENTINDEX(ed);
+		mPlayer = GET_PLAYER_POINTER_I(mPlayerIndex);
+	} else {
+		mPlayerIndex = 0;
+		mPlayer = 0;
+	}
+	mState = 0;	
+	if ( msg_type < 0 || msg_type >= MAX_REG_MSGS )
+		msg_type = 0;
+	function=modMsgs[msg_type];
+	endfunction=modMsgsEnd[msg_type];
+	RETURN_META(MRES_IGNORED);
+}
+
+void MessageEnd_Post(void) {
+	if (endfunction) (*endfunction)(NULL);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteByte_Post(int iValue) {
+	if (function) (*function)((void *)&iValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteChar_Post(int iValue) {
+	if (function) (*function)((void *)&iValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteShort_Post(int iValue) {
+	if (function) (*function)((void *)&iValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteLong_Post(int iValue) {
+	if (function) (*function)((void *)&iValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteAngle_Post(float flValue) {
+	if (function) (*function)((void *)&flValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteCoord_Post(float flValue) {
+	if (function) (*function)((void *)&flValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteString_Post(const char *sz) {
+	if (function) (*function)((void *)sz);
+	RETURN_META(MRES_IGNORED);
+}
+
+void WriteEntity_Post(int iValue) {
+	if (function) (*function)((void *)&iValue);
+	RETURN_META(MRES_IGNORED);
+}
+
+void StartFrame_Post(){
+	if (g_bombAnnounce){
+		switch (g_bombAnnounce){
+		case BOMB_PLANTING:
+			MF_ExecuteForward( iFBPlanting,g_Planter );
+			break;
+		case BOMB_PLANTED:
+			MF_ExecuteForward( iFBPlanted,g_Planter );
+			break;
+		case BOMB_EXPLODE:
+			MF_ExecuteForward( iFBExplode,g_Planter,g_Defuser );
+			break;
+		case BOMB_DEFUSING:
+			MF_ExecuteForward( iFBDefusing,g_Defuser );
+			break;
+		case BOMB_DEFUSED:
+			MF_ExecuteForward( iFBDefused,g_Defuser );
+			break;
+		}
+		g_bombAnnounce = 0;
+	}
+	RETURN_META(MRES_IGNORED);
+}
+
+void SetModel_Post(edict_t *e, const char *m){
+
+	if ( !isModuleActive() )
+		return;
+
+	if ( e->v.owner && m[7]=='w' && m[8]=='_' ){
+		int w_id = 0;
+		CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
+		switch(m[9]){
+		case 'h':
+			w_id = CSW_HEGRENADE;
+			g_grenades.put(e, 1.75, 4, pPlayer);
+			pPlayer->saveShot(4);
+			break;
+		case 'f':
+			if (m[10]=='l') w_id = CSW_FLASHBANG;
+			break;
+		case 's':
+			if (m[10]=='m') w_id = CSW_SMOKEGRENADE;
+			break;
+		}
+		if ( w_id )	
+			MF_ExecuteForward( iFGrenade, pPlayer->index, ENTINDEX(e) ,w_id );
+	}
+
+	RETURN_META(MRES_IGNORED);
+}
+
+void EmitSound_Post(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch) {
+	if (sample[0]=='w'&&sample[1]=='e'&&sample[8]=='k'&&sample[9]=='n'&&sample[14]!='d'){
+		CPlayer*pPlayer = GET_PLAYER_POINTER(entity);
+		pPlayer->saveShot(pPlayer->current);
+	}
+	RETURN_META(MRES_IGNORED);
+}
+
+void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr) {
+	if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&
+		e&&(e->v.flags& (FL_CLIENT | FL_FAKECLIENT) )&&ptr->iHitgroup)
+		GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup;
+	RETURN_META(MRES_IGNORED);
+}
+
+void OnMetaAttach() {
+
+	CVAR_REGISTER (&init_csstats_maxsize);
+	CVAR_REGISTER (&init_csstats_reset);
+	CVAR_REGISTER (&init_csstats_rank);
+	csstats_maxsize=CVAR_GET_POINTER(init_csstats_maxsize.name);
+	csstats_reset=CVAR_GET_POINTER(init_csstats_reset.name);
+	csstats_rank=CVAR_GET_POINTER(init_csstats_rank.name);
+
+	CVAR_REGISTER (&init_csstats_rankbots);
+	CVAR_REGISTER (&init_csstats_pause);
+	csstats_rankbots = CVAR_GET_POINTER(init_csstats_rankbots.name);
+	csstats_pause = CVAR_GET_POINTER(init_csstats_pause.name);
+}
+
+void OnAmxxAttach(){
+	MF_AddNatives(stats_Natives);
+	const char* path =  get_localinfo("csstats_score");
+	if ( path && *path ) 
+	{
+		char error[128];
+		g_rank.loadCalc( MF_BuildPathname("%s",path) , error  );
+	}
+	
+	if ( !g_rank.begin() )
+	{		
+		g_rank.loadRank( MF_BuildPathname("%s",
+			get_localinfo("csstats") ) );
+	}
+}
+
+void OnAmxxDetach() {
+	g_grenades.clear();
+	g_rank.clear();
+	g_rank.unloadCalc();
+}
+
+void OnPluginsLoaded(){
+	iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
+	iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
+	iFBPlanted = MF_RegisterForward("bomb_planted",ET_IGNORE,FP_CELL,FP_DONE);
+	iFBDefused = MF_RegisterForward("bomb_defused",ET_IGNORE,FP_CELL,FP_DONE);
+	iFBPlanting = MF_RegisterForward("bomb_planting",ET_IGNORE,FP_CELL,FP_DONE);
+	iFBDefusing = MF_RegisterForward("bomb_defusing",ET_IGNORE,FP_CELL,FP_DONE);
+	iFBExplode = MF_RegisterForward("bomb_explode",ET_IGNORE,FP_CELL,FP_CELL,FP_DONE);
+	iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
+}
diff --git a/dlls/csx/source/moduleconfig.h b/dlls/csx/source/moduleconfig.h
new file mode 100755
index 00000000..8c54084a
--- /dev/null
+++ b/dlls/csx/source/moduleconfig.h
@@ -0,0 +1,462 @@
+// Configuration
+
+#ifndef __MODULECONFIG_H__
+#define __MODULECONFIG_H__
+
+// Module info
+#define MODULE_NAME "CSX"
+#define MODULE_VERSION "0.20"
+#define MODULE_AUTHOR "AMXx Dev Team"
+#define MODULE_URL "http://www.amxmodx.org/"
+#define MODULE_LOGTAG "CSX"
+// If you want the module not to be reloaded on mapchange, remove / comment out the next line
+#define MODULE_RELOAD_ON_MAPCHANGE
+
+#ifdef __DATE__
+#define MODULE_DATE __DATE__
+#else // __DATE__
+#define MODULE_DATE "Unknown"
+#endif // __DATE__
+
+// metamod plugin?
+#define USE_METAMOD
+
+// - AMXX Init functions
+// Also consider using FN_META_*
+// AMXX query
+//#define FN_AMXX_QUERY OnAmxxQuery
+// AMXX attach
+//   Do native functions init here (MF_AddNatives)
+#define FN_AMXX_ATTACH OnAmxxAttach
+// AMXX detach
+#define FN_AMXX_DETACH OnAmxxDetach
+// All plugins loaded
+//   Do forward functions init here (MF_RegisterForward)
+#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
+
+/**** METAMOD ****/
+// If your module doesn't use metamod, you may close the file now :)
+#ifdef USE_METAMOD
+// ----
+// Hook Functions
+// Uncomment these to be called
+// You can also change the function name
+
+// - Metamod init functions
+// Also consider using FN_AMXX_*
+// Meta query
+//#define FN_META_QUERY OnMetaQuery
+// Meta attach
+#define FN_META_ATTACH OnMetaAttach
+// Meta detach
+//#define FN_META_DETACH OnMetaDetach
+
+// (wd) are Will Day's notes
+// - GetEntityAPI2 functions
+// #define FN_GameDLLInit				GameDLLInit					/* pfnGameInit() */
+// #define FN_DispatchSpawn				DispatchSpawn				/* pfnSpawn() */
+// #define FN_DispatchThink				DispatchThink				/* pfnThink() */
+// #define FN_DispatchUse				DispatchUse					/* pfnUse() */
+// #define FN_DispatchTouch				DispatchTouch				/* pfnTouch() */
+// #define FN_DispatchBlocked			DispatchBlocked				/* pfnBlocked() */
+// #define FN_DispatchKeyValue			DispatchKeyValue			/* pfnKeyValue() */
+// #define FN_DispatchSave				DispatchSave				/* pfnSave() */
+// #define FN_DispatchRestore			DispatchRestore				/* pfnRestore() */
+// #define FN_DispatchObjectCollsionBox	DispatchObjectCollsionBox	/* pfnSetAbsBox() */
+// #define FN_SaveWriteFields			SaveWriteFields				/* pfnSaveWriteFields() */
+// #define FN_SaveReadFields			SaveReadFields				/* pfnSaveReadFields() */
+// #define FN_SaveGlobalState			SaveGlobalState				/* pfnSaveGlobalState() */
+// #define FN_RestoreGlobalState		RestoreGlobalState			/* pfnRestoreGlobalState() */
+// #define FN_ResetGlobalState			ResetGlobalState			/* pfnResetGlobalState() */
+// #define FN_ClientConnect				ClientConnect				/* pfnClientConnect()			(wd) Client has connected */
+#define FN_ClientDisconnect			ClientDisconnect			/* pfnClientDisconnect()		(wd) Player has left the game */
+// #define FN_ClientKill				ClientKill					/* pfnClientKill()				(wd) Player has typed "kill" */
+// #define FN_ClientPutInServer			ClientPutInServer			/* pfnClientPutInServer()		(wd) Client is entering the game */
+// #define FN_ClientCommand				ClientCommand				/* pfnClientCommand()			(wd) Player has sent a command (typed or from a bind) */
+// #define FN_ClientUserInfoChanged		ClientUserInfoChanged		/* pfnClientUserInfoChanged()	(wd) Client has updated their setinfo structure */
+// #define FN_ServerActivate			ServerActivate				/* pfnServerActivate()			(wd) Server is starting a new map */
+#define FN_ServerDeactivate			ServerDeactivate			/* pfnServerDeactivate()		(wd) Server is leaving the map (shutdown or changelevel); SDK2 */
+// #define FN_PlayerPreThink			PlayerPreThink				/* pfnPlayerPreThink() */
+// #define FN_PlayerPostThink			PlayerPostThink				/* pfnPlayerPostThink() */
+// #define FN_StartFrame				StartFrame					/* pfnStartFrame() */
+// #define FN_ParmsNewLevel				ParmsNewLevel				/* pfnParmsNewLevel() */
+// #define FN_ParmsChangeLevel			ParmsChangeLevel			/* pfnParmsChangeLevel() */
+// #define FN_GetGameDescription		GetGameDescription			/* pfnGetGameDescription()		Returns string describing current .dll.  E.g. "TeamFotrress 2" "Half-Life" */
+// #define FN_PlayerCustomization		PlayerCustomization			/* pfnPlayerCustomization()	Notifies .dll of new customization for player. */
+// #define FN_SpectatorConnect			SpectatorConnect			/* pfnSpectatorConnect()		Called when spectator joins server */
+// #define FN_SpectatorDisconnect		SpectatorDisconnect			/* pfnSpectatorDisconnect()	Called when spectator leaves the server */
+// #define FN_SpectatorThink			SpectatorThink				/* pfnSpectatorThink()			Called when spectator sends a command packet (usercmd_t) */
+// #define FN_Sys_Error					Sys_Error					/* pfnSys_Error()				Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.  SDK2 */
+// #define FN_PM_Move					PM_Move						/* pfnPM_Move()				(wd) SDK2 */
+// #define FN_PM_Init					PM_Init						/* pfnPM_Init()				Server version of player movement initialization; (wd) SDK2 */
+// #define FN_PM_FindTextureType		PM_FindTextureType			/* pfnPM_FindTextureType()		(wd) SDK2 */
+// #define FN_SetupVisibility			SetupVisibility				/* pfnSetupVisibility()		Set up PVS and PAS for networking for this client; (wd) SDK2 */
+// #define FN_UpdateClientData			UpdateClientData			/* pfnUpdateClientData()		Set up data sent only to specific client; (wd) SDK2 */
+// #define FN_AddToFullPack				AddToFullPack				/* pfnAddToFullPack()			(wd) SDK2 */
+// #define FN_CreateBaseline			CreateBaseline				/* pfnCreateBaseline()			Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
+// #define FN_RegisterEncoders			RegisterEncoders			/* pfnRegisterEncoders()		Callbacks for network encoding; (wd) SDK2 */
+// #define FN_GetWeaponData				GetWeaponData				/* pfnGetWeaponData()			(wd) SDK2 */
+// #define FN_CmdStart					CmdStart					/* pfnCmdStart()				(wd) SDK2 */
+// #define FN_CmdEnd					CmdEnd						/* pfnCmdEnd()					(wd) SDK2 */
+// #define FN_ConnectionlessPacket		ConnectionlessPacket		/* pfnConnectionlessPacket()	(wd) SDK2 */
+// #define FN_GetHullBounds				GetHullBounds				/* pfnGetHullBounds()			(wd) SDK2 */
+// #define FN_CreateInstancedBaselines	CreateInstancedBaselines	/* pfnCreateInstancedBaselines()	(wd) SDK2 */
+// #define FN_InconsistentFile			InconsistentFile			/* pfnInconsistentFile()		(wd) SDK2 */
+// #define FN_AllowLagCompensation		AllowLagCompensation		/* pfnAllowLagCompensation()	(wd) SDK2 */
+
+// - GetEntityAPI2_Post functions
+// #define FN_GameDLLInit_Post					GameDLLInit_Post
+// #define FN_DispatchSpawn_Post				DispatchSpawn_Post
+// #define FN_DispatchThink_Post				DispatchThink_Post
+// #define FN_DispatchUse_Post					DispatchUse_Post
+// #define FN_DispatchTouch_Post				DispatchTouch_Post
+// #define FN_DispatchBlocked_Post				DispatchBlocked_Post
+// #define FN_DispatchKeyValue_Post				DispatchKeyValue_Post
+// #define FN_DispatchSave_Post					DispatchSave_Post
+// #define FN_DispatchRestore_Post				DispatchRestore_Post
+// #define FN_DispatchObjectCollsionBox_Post	DispatchObjectCollsionBox_Post
+// #define FN_SaveWriteFields_Post				SaveWriteFields_Post
+// #define FN_SaveReadFields_Post				SaveReadFields_Post
+// #define FN_SaveGlobalState_Post				SaveGlobalState_Post
+// #define FN_RestoreGlobalState_Post			RestoreGlobalState_Post
+// #define FN_ResetGlobalState_Post				ResetGlobalState_Post
+#define FN_ClientConnect_Post				ClientConnect_Post
+// #define FN_ClientDisconnect_Post				ClientDisconnect_Post
+// #define FN_ClientKill_Post					ClientKill_Post
+#define FN_ClientPutInServer_Post			ClientPutInServer_Post
+// #define FN_ClientCommand_Post				ClientCommand_Post
+#define FN_ClientUserInfoChanged_Post		ClientUserInfoChanged_Post
+#define FN_ServerActivate_Post				ServerActivate_Post
+// #define FN_ServerDeactivate_Post				ServerDeactivate_Post
+#define FN_PlayerPreThink_Post				PlayerPreThink_Post
+// #define FN_PlayerPostThink_Post				PlayerPostThink_Post
+#define FN_StartFrame_Post					StartFrame_Post
+// #define FN_ParmsNewLevel_Post				ParmsNewLevel_Post
+// #define FN_ParmsChangeLevel_Post				ParmsChangeLevel_Post
+// #define FN_GetGameDescription_Post			GetGameDescription_Post
+// #define FN_PlayerCustomization_Post			PlayerCustomization_Post
+// #define FN_SpectatorConnect_Post				SpectatorConnect_Post
+// #define FN_SpectatorDisconnect_Post			SpectatorDisconnect_Post
+// #define FN_SpectatorThink_Post				SpectatorThink_Post
+// #define FN_Sys_Error_Post					Sys_Error_Post
+// #define FN_PM_Move_Post						PM_Move_Post
+// #define FN_PM_Init_Post						PM_Init_Post
+// #define FN_PM_FindTextureType_Post			PM_FindTextureType_Post
+// #define FN_SetupVisibility_Post				SetupVisibility_Post
+// #define FN_UpdateClientData_Post				UpdateClientData_Post
+// #define FN_AddToFullPack_Post				AddToFullPack_Post
+// #define FN_CreateBaseline_Post				CreateBaseline_Post
+// #define FN_RegisterEncoders_Post				RegisterEncoders_Post
+// #define FN_GetWeaponData_Post				GetWeaponData_Post
+// #define FN_CmdStart_Post						CmdStart_Post
+// #define FN_CmdEnd_Post						CmdEnd_Post
+// #define FN_ConnectionlessPacket_Post			ConnectionlessPacket_Post
+// #define FN_GetHullBounds_Post				GetHullBounds_Post
+// #define FN_CreateInstancedBaselines_Post		CreateInstancedBaselines_Post
+// #define FN_InconsistentFile_Post				InconsistentFile_Post
+// #define FN_AllowLagCompensation_Post			AllowLagCompensation_Post
+
+// - GetEngineAPI functions
+// #define FN_PrecacheModel						PrecacheModel
+// #define FN_PrecacheSound						PrecacheSound
+// #define FN_SetModel							SetModel
+// #define FN_ModelIndex						ModelIndex
+// #define FN_ModelFrames						ModelFrames
+// #define FN_SetSize							SetSize
+// #define FN_ChangeLevel						ChangeLevel
+// #define FN_GetSpawnParms						GetSpawnParms
+// #define FN_SaveSpawnParms					SaveSpawnParms
+// #define FN_VecToYaw							VecToYaw
+// #define FN_VecToAngles						VecToAngles
+// #define FN_MoveToOrigin						MoveToOrigin
+// #define FN_ChangeYaw							ChangeYaw
+// #define FN_ChangePitch						ChangePitch
+// #define FN_FindEntityByString				FindEntityByString
+// #define FN_GetEntityIllum					GetEntityIllum
+// #define FN_FindEntityInSphere				FindEntityInSphere
+// #define FN_FindClientInPVS					FindClientInPVS
+// #define FN_EntitiesInPVS						EntitiesInPVS
+// #define FN_MakeVectors						MakeVectors
+// #define FN_AngleVectors						AngleVectors
+// #define FN_CreateEntity						CreateEntity
+// #define FN_RemoveEntity						RemoveEntity
+// #define FN_CreateNamedEntity					CreateNamedEntity
+// #define FN_MakeStatic						MakeStatic
+// #define FN_EntIsOnFloor						EntIsOnFloor
+// #define FN_DropToFloor						DropToFloor
+// #define FN_WalkMove							WalkMove
+// #define FN_SetOrigin							SetOrigin
+// #define FN_EmitSound							EmitSound
+// #define FN_EmitAmbientSound					EmitAmbientSound
+// #define FN_TraceLine							TraceLine
+// #define FN_TraceToss							TraceToss
+// #define FN_TraceMonsterHull					TraceMonsterHull
+// #define FN_TraceHull							TraceHull
+// #define FN_TraceModel						TraceModel
+// #define FN_TraceTexture						TraceTexture
+// #define FN_TraceSphere						TraceSphere
+// #define FN_GetAimVector						GetAimVector
+// #define FN_ServerCommand						ServerCommand
+// #define FN_ServerExecute						ServerExecute
+// #define FN_engClientCommand					engClientCommand
+// #define FN_ParticleEffect					ParticleEffect
+// #define FN_LightStyle						LightStyle
+// #define FN_DecalIndex						DecalIndex
+// #define FN_PointContents						PointContents
+// #define FN_MessageBegin						MessageBegin
+// #define FN_MessageEnd						MessageEnd
+// #define FN_WriteByte							WriteByte
+// #define FN_WriteChar							WriteChar
+// #define FN_WriteShort						WriteShort
+// #define FN_WriteLong							WriteLong
+// #define FN_WriteAngle						WriteAngle
+// #define FN_WriteCoord						WriteCoord
+// #define FN_WriteString						WriteString
+// #define FN_WriteEntity						WriteEntity
+// #define FN_CVarRegister						CVarRegister
+// #define FN_CVarGetFloat						CVarGetFloat
+// #define FN_CVarGetString						CVarGetString
+// #define FN_CVarSetFloat						CVarSetFloat
+// #define FN_CVarSetString						CVarSetString
+// #define FN_AlertMessage						AlertMessage
+// #define FN_EngineFprintf						EngineFprintf
+// #define FN_PvAllocEntPrivateData				PvAllocEntPrivateData
+// #define FN_PvEntPrivateData					PvEntPrivateData
+// #define FN_FreeEntPrivateData				FreeEntPrivateData
+// #define FN_SzFromIndex						SzFromIndex
+// #define FN_AllocString						AllocString
+// #define FN_GetVarsOfEnt						GetVarsOfEnt
+// #define FN_PEntityOfEntOffset				PEntityOfEntOffset
+// #define FN_EntOffsetOfPEntity				EntOffsetOfPEntity
+// #define FN_IndexOfEdict						IndexOfEdict
+// #define FN_PEntityOfEntIndex					PEntityOfEntIndex
+// #define FN_FindEntityByVars					FindEntityByVars
+// #define FN_GetModelPtr						GetModelPtr
+// #define FN_RegUserMsg						RegUserMsg
+// #define FN_AnimationAutomove					AnimationAutomove
+// #define FN_GetBonePosition					GetBonePosition
+// #define FN_FunctionFromName					FunctionFromName
+// #define FN_NameForFunction					NameForFunction
+// #define FN_ClientPrintf						ClientPrintf
+// #define FN_ServerPrint						ServerPrint
+// #define FN_Cmd_Args							Cmd_Args
+// #define FN_Cmd_Argv							Cmd_Argv
+// #define FN_Cmd_Argc							Cmd_Argc
+// #define FN_GetAttachment						GetAttachment
+// #define FN_CRC32_Init						CRC32_Init
+// #define FN_CRC32_ProcessBuffer				CRC32_ProcessBuffer
+// #define FN_CRC32_ProcessByte					CRC32_ProcessByte
+// #define FN_CRC32_Final						CRC32_Final
+// #define FN_RandomLong						RandomLong
+// #define FN_RandomFloat						RandomFloat
+// #define FN_SetView							SetView
+// #define FN_Time								Time
+// #define FN_CrosshairAngle					CrosshairAngle
+// #define FN_LoadFileForMe						LoadFileForMe
+// #define FN_FreeFile							FreeFile
+// #define FN_EndSection						EndSection
+// #define FN_CompareFileTime					CompareFileTime
+// #define FN_GetGameDir						GetGameDir
+// #define FN_Cvar_RegisterVariable				Cvar_RegisterVariable
+// #define FN_FadeClientVolume					FadeClientVolume
+// #define FN_SetClientMaxspeed					SetClientMaxspeed
+// #define FN_CreateFakeClient					CreateFakeClient
+// #define FN_RunPlayerMove						RunPlayerMove
+// #define FN_NumberOfEntities					NumberOfEntities
+// #define FN_GetInfoKeyBuffer					GetInfoKeyBuffer
+// #define FN_InfoKeyValue						InfoKeyValue
+// #define FN_SetKeyValue						SetKeyValue
+// #define FN_SetClientKeyValue					SetClientKeyValue
+// #define FN_IsMapValid						IsMapValid
+// #define FN_StaticDecal						StaticDecal
+// #define FN_PrecacheGeneric					PrecacheGeneric
+// #define FN_GetPlayerUserId					GetPlayerUserId
+// #define FN_BuildSoundMsg						BuildSoundMsg
+// #define FN_IsDedicatedServer					IsDedicatedServer
+// #define FN_CVarGetPointer					CVarGetPointer
+// #define FN_GetPlayerWONId					GetPlayerWONId
+// #define FN_Info_RemoveKey					Info_RemoveKey
+// #define FN_GetPhysicsKeyValue				GetPhysicsKeyValue
+// #define FN_SetPhysicsKeyValue				SetPhysicsKeyValue
+// #define FN_GetPhysicsInfoString				GetPhysicsInfoString
+// #define FN_PrecacheEvent						PrecacheEvent
+// #define FN_PlaybackEvent						PlaybackEvent
+// #define FN_SetFatPVS							SetFatPVS
+// #define FN_SetFatPAS							SetFatPAS
+// #define FN_CheckVisibility					CheckVisibility
+// #define FN_DeltaSetField						DeltaSetField
+// #define FN_DeltaUnsetField					DeltaUnsetField
+// #define FN_DeltaAddEncoder					DeltaAddEncoder
+// #define FN_GetCurrentPlayer					GetCurrentPlayer
+// #define FN_CanSkipPlayer						CanSkipPlayer
+// #define FN_DeltaFindField					DeltaFindField
+// #define FN_DeltaSetFieldByIndex				DeltaSetFieldByIndex
+// #define FN_DeltaUnsetFieldByIndex			DeltaUnsetFieldByIndex
+// #define FN_SetGroupMask						SetGroupMask
+// #define FN_engCreateInstancedBaseline		engCreateInstancedBaseline
+// #define FN_Cvar_DirectSet					Cvar_DirectSet
+// #define FN_ForceUnmodified					ForceUnmodified
+// #define FN_GetPlayerStats					GetPlayerStats
+// #define FN_AddServerCommand					AddServerCommand
+// #define FN_Voice_GetClientListening			Voice_GetClientListening
+// #define FN_Voice_SetClientListening			Voice_SetClientListening
+// #define FN_GetPlayerAuthId					GetPlayerAuthId
+
+// - GetEngineAPI_Post functions
+// #define FN_PrecacheModel_Post				PrecacheModel_Post
+// #define FN_PrecacheSound_Post				PrecacheSound_Post
+#define FN_SetModel_Post						SetModel_Post
+// #define FN_ModelIndex_Post					ModelIndex_Post
+// #define FN_ModelFrames_Post					ModelFrames_Post
+// #define FN_SetSize_Post						SetSize_Post
+// #define FN_ChangeLevel_Post					ChangeLevel_Post
+// #define FN_GetSpawnParms_Post				GetSpawnParms_Post
+// #define FN_SaveSpawnParms_Post				SaveSpawnParms_Post
+// #define FN_VecToYaw_Post						VecToYaw_Post
+// #define FN_VecToAngles_Post					VecToAngles_Post
+// #define FN_MoveToOrigin_Post					MoveToOrigin_Post
+// #define FN_ChangeYaw_Post					ChangeYaw_Post
+// #define FN_ChangePitch_Post					ChangePitch_Post
+// #define FN_FindEntityByString_Post			FindEntityByString_Post
+// #define FN_GetEntityIllum_Post				GetEntityIllum_Post
+// #define FN_FindEntityInSphere_Post			FindEntityInSphere_Post
+// #define FN_FindClientInPVS_Post				FindClientInPVS_Post
+// #define FN_EntitiesInPVS_Post				EntitiesInPVS_Post
+// #define FN_MakeVectors_Post					MakeVectors_Post
+// #define FN_AngleVectors_Post					AngleVectors_Post
+// #define FN_CreateEntity_Post					CreateEntity_Post
+// #define FN_RemoveEntity_Post					RemoveEntity_Post
+// #define FN_CreateNamedEntity_Post			CreateNamedEntity_Post
+// #define FN_MakeStatic_Post					MakeStatic_Post
+// #define FN_EntIsOnFloor_Post					EntIsOnFloor_Post
+// #define FN_DropToFloor_Post					DropToFloor_Post
+// #define FN_WalkMove_Post						WalkMove_Post
+// #define FN_SetOrigin_Post					SetOrigin_Post
+// #define FN_EmitSound_Post					EmitSound_Post
+// #define FN_EmitAmbientSound_Post				EmitAmbientSound_Post
+#define FN_TraceLine_Post					TraceLine_Post
+// #define FN_TraceToss_Post					TraceToss_Post
+// #define FN_TraceMonsterHull_Post				TraceMonsterHull_Post
+// #define FN_TraceHull_Post					TraceHull_Post
+// #define FN_TraceModel_Post					TraceModel_Post
+// #define FN_TraceTexture_Post					TraceTexture_Post
+// #define FN_TraceSphere_Post					TraceSphere_Post
+// #define FN_GetAimVector_Post					GetAimVector_Post
+// #define FN_ServerCommand_Post				ServerCommand_Post
+// #define FN_ServerExecute_Post				ServerExecute_Post
+// #define FN_engClientCommand_Post				engClientCommand_Post
+// #define FN_ParticleEffect_Post				ParticleEffect_Post
+// #define FN_LightStyle_Post					LightStyle_Post
+// #define FN_DecalIndex_Post					DecalIndex_Post
+// #define FN_PointContents_Post				PointContents_Post
+#define FN_MessageBegin_Post					MessageBegin_Post
+#define FN_MessageEnd_Post					MessageEnd_Post
+#define FN_WriteByte_Post					WriteByte_Post
+#define FN_WriteChar_Post					WriteChar_Post
+#define FN_WriteShort_Post					WriteShort_Post
+#define FN_WriteLong_Post					WriteLong_Post
+#define FN_WriteAngle_Post					WriteAngle_Post
+#define FN_WriteCoord_Post					WriteCoord_Post
+#define FN_WriteString_Post					WriteString_Post
+#define FN_WriteEntity_Post					WriteEntity_Post
+// #define FN_CVarRegister_Post					CVarRegister_Post
+// #define FN_CVarGetFloat_Post					CVarGetFloat_Post
+// #define FN_CVarGetString_Post				CVarGetString_Post
+// #define FN_CVarSetFloat_Post					CVarSetFloat_Post
+// #define FN_CVarSetString_Post				CVarSetString_Post
+// #define FN_AlertMessage_Post					AlertMessage_Post
+// #define FN_EngineFprintf_Post				EngineFprintf_Post
+// #define FN_PvAllocEntPrivateData_Post		PvAllocEntPrivateData_Post
+// #define FN_PvEntPrivateData_Post				PvEntPrivateData_Post
+// #define FN_FreeEntPrivateData_Post			FreeEntPrivateData_Post
+// #define FN_SzFromIndex_Post					SzFromIndex_Post
+// #define FN_AllocString_Post					AllocString_Post
+// #define FN_GetVarsOfEnt_Post					GetVarsOfEnt_Post
+// #define FN_PEntityOfEntOffset_Post			PEntityOfEntOffset_Post
+// #define FN_EntOffsetOfPEntity_Post			EntOffsetOfPEntity_Post
+// #define FN_IndexOfEdict_Post					IndexOfEdict_Post
+// #define FN_PEntityOfEntIndex_Post			PEntityOfEntIndex_Post
+// #define FN_FindEntityByVars_Post				FindEntityByVars_Post
+// #define FN_GetModelPtr_Post					GetModelPtr_Post
+#define FN_RegUserMsg_Post					RegUserMsg_Post
+// #define FN_AnimationAutomove_Post			AnimationAutomove_Post
+// #define FN_GetBonePosition_Post				GetBonePosition_Post
+// #define FN_FunctionFromName_Post				FunctionFromName_Post
+// #define FN_NameForFunction_Post				NameForFunction_Post
+// #define FN_ClientPrintf_Post					ClientPrintf_Post
+// #define FN_ServerPrint_Post					ServerPrint_Post
+// #define FN_Cmd_Args_Post						Cmd_Args_Post
+// #define FN_Cmd_Argv_Post						Cmd_Argv_Post
+// #define FN_Cmd_Argc_Post						Cmd_Argc_Post
+// #define FN_GetAttachment_Post				GetAttachment_Post
+// #define FN_CRC32_Init_Post					CRC32_Init_Post
+// #define FN_CRC32_ProcessBuffer_Post			CRC32_ProcessBuffer_Post
+// #define FN_CRC32_ProcessByte_Post			CRC32_ProcessByte_Post
+// #define FN_CRC32_Final_Post					CRC32_Final_Post
+// #define FN_RandomLong_Post					RandomLong_Post
+// #define FN_RandomFloat_Post					RandomFloat_Post
+// #define FN_SetView_Post						SetView_Post
+// #define FN_Time_Post							Time_Post
+// #define FN_CrosshairAngle_Post				CrosshairAngle_Post
+// #define FN_LoadFileForMe_Post				LoadFileForMe_Post
+// #define FN_FreeFile_Post						FreeFile_Post
+// #define FN_EndSection_Post					EndSection_Post
+// #define FN_CompareFileTime_Post				CompareFileTime_Post
+// #define FN_GetGameDir_Post					GetGameDir_Post
+// #define FN_Cvar_RegisterVariable_Post		Cvar_RegisterVariable_Post
+// #define FN_FadeClientVolume_Post				FadeClientVolume_Post
+// #define FN_SetClientMaxspeed_Post			SetClientMaxspeed_Post
+// #define FN_CreateFakeClient_Post				CreateFakeClient_Post
+// #define FN_RunPlayerMove_Post				RunPlayerMove_Post
+// #define FN_NumberOfEntities_Post				NumberOfEntities_Post
+// #define FN_GetInfoKeyBuffer_Post				GetInfoKeyBuffer_Post
+// #define FN_InfoKeyValue_Post					InfoKeyValue_Post
+// #define FN_SetKeyValue_Post					SetKeyValue_Post
+// #define FN_SetClientKeyValue_Post			SetClientKeyValue_Post
+// #define FN_IsMapValid_Post					IsMapValid_Post
+// #define FN_StaticDecal_Post					StaticDecal_Post
+// #define FN_PrecacheGeneric_Post				PrecacheGeneric_Post
+// #define FN_GetPlayerUserId_Post				GetPlayerUserId_Post
+// #define FN_BuildSoundMsg_Post				BuildSoundMsg_Post
+// #define FN_IsDedicatedServer_Post			IsDedicatedServer_Post
+// #define FN_CVarGetPointer_Post				CVarGetPointer_Post
+// #define FN_GetPlayerWONId_Post				GetPlayerWONId_Post
+// #define FN_Info_RemoveKey_Post				Info_RemoveKey_Post
+// #define FN_GetPhysicsKeyValue_Post			GetPhysicsKeyValue_Post
+// #define FN_SetPhysicsKeyValue_Post			SetPhysicsKeyValue_Post
+// #define FN_GetPhysicsInfoString_Post			GetPhysicsInfoString_Post
+// #define FN_PrecacheEvent_Post				PrecacheEvent_Post
+// #define FN_PlaybackEvent_Post				PlaybackEvent_Post
+// #define FN_SetFatPVS_Post					SetFatPVS_Post
+// #define FN_SetFatPAS_Post					SetFatPAS_Post
+// #define FN_CheckVisibility_Post				CheckVisibility_Post
+// #define FN_DeltaSetField_Post				DeltaSetField_Post
+// #define FN_DeltaUnsetField_Post				DeltaUnsetField_Post
+// #define FN_DeltaAddEncoder_Post				DeltaAddEncoder_Post
+// #define FN_GetCurrentPlayer_Post				GetCurrentPlayer_Post
+// #define FN_CanSkipPlayer_Post				CanSkipPlayer_Post
+// #define FN_DeltaFindField_Post				DeltaFindField_Post
+// #define FN_DeltaSetFieldByIndex_Post			DeltaSetFieldByIndex_Post
+// #define FN_DeltaUnsetFieldByIndex_Post		DeltaUnsetFieldByIndex_Post
+// #define FN_SetGroupMask_Post					SetGroupMask_Post
+// #define FN_engCreateInstancedBaseline_Post	engCreateInstancedBaseline_Post
+// #define FN_Cvar_DirectSet_Post				Cvar_DirectSet_Post
+// #define FN_ForceUnmodified_Post				ForceUnmodified_Post
+// #define FN_GetPlayerStats_Post				GetPlayerStats_Post
+// #define FN_AddServerCommand_Post				AddServerCommand_Post
+// #define FN_Voice_GetClientListening_Post		Voice_GetClientListening_Post
+// #define FN_Voice_SetClientListening_Post		Voice_SetClientListening_Post
+// #define FN_GetPlayerAuthId_Post				GetPlayerAuthId_Post
+
+// #define FN_OnFreeEntPrivateData				OnFreeEntPrivateData				
+// #define FN_GameShutdown						GameShutdown
+// #define FN_ShouldCollide						ShouldCollide
+
+// #define FN_OnFreeEntPrivateData_Post			OnFreeEntPrivateData_Post
+// #define FN_GameShutdown_Post					GameShutdown_Post
+// #define FN_ShouldCollide_Post				ShouldCollide_Post
+
+
+#endif // USE_METAMOD
+
+#endif // __MODULECONFIG_H__
\ No newline at end of file
diff --git a/dlls/csx/source/msvc/csx.dsp b/dlls/csx/source/msvc/csx.dsp
new file mode 100755
index 00000000..61ae768d
--- /dev/null
+++ b/dlls/csx/source/msvc/csx.dsp
@@ -0,0 +1,149 @@
+# Microsoft Developer Studio Project File - Name="csx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=csx - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "csx.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "csx.mak" CFG="csx - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "csx - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "csx - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "csx - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csx_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /Zp4 /MT /W3 /GX /O2 /I "..\..\metamod" /I "..\..\sdk\common" /I "..\..\sdk\engine" /I "..\..\sdk\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csx_EXPORTS" /D "JIT" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"release/csx_amxx.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF  "$(CFG)" == "csx - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "debug"
+# PROP Intermediate_Dir "debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csx_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\metamod" /I "..\..\sdk\common" /I "..\..\sdk\engine" /I "..\..\sdk\dlls" /I "..\..\hlsdk\sourcecode\pm_shared" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "csx_EXPORTS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"debug/csx_amxx.dll" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF 
+
+# Begin Target
+
+# Name "csx - Win32 Release"
+# Name "csx - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\amxxmodule.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\CMisc.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\CRank.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\meta_api.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\rank.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\usermsg.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\amxxmodule.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\CMisc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\CRank.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\moduleconfig.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\rank.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/dlls/csx/source/msvc/csx.dsw b/dlls/csx/source/msvc/csx.dsw
new file mode 100755
index 00000000..e26c89ab
--- /dev/null
+++ b/dlls/csx/source/msvc/csx.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "csx"=.\csx.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/dlls/csx/source/rank.cpp b/dlls/csx/source/rank.cpp
new file mode 100755
index 00000000..29f08f79
--- /dev/null
+++ b/dlls/csx/source/rank.cpp
@@ -0,0 +1,447 @@
+
+
+#include "amxxmodule.h"
+#include "rank.h"
+
+
+static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	int attacker = params[2];
+	if (attacker<0||attacker>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if (pPlayer->attackers[attacker].hits){
+		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
+		CPlayer::PlayerWeapon* stats = &pPlayer->attackers[attacker];
+		cpStats[0] = stats->kills;
+		cpStats[1] = stats->deaths;
+		cpStats[2] = stats->hs;
+		cpStats[3] = stats->tks;
+		cpStats[4] = stats->shots;
+		cpStats[5] = stats->hits;
+		cpStats[6] = stats->damage;
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = stats->bodyHits[i];
+		if (params[6] && attacker && stats->name )
+			MF_SetAmxString(amx,params[5],stats->name,params[6]);
+		return 1;
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	int victim = params[2];
+	if (victim<0||victim>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if (pPlayer->victims[victim].hits){
+		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
+		CPlayer::PlayerWeapon* stats = &pPlayer->victims[victim];
+		cpStats[0] = stats->kills;
+		cpStats[1] = stats->deaths;
+		cpStats[2] = stats->hs;
+		cpStats[3] = stats->tks;
+		cpStats[4] = stats->shots;
+		cpStats[5] = stats->hits;
+		cpStats[6] = stats->damage;
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = stats->bodyHits[i];
+		if (params[6] && victim && stats->name)
+			MF_SetAmxString(amx,params[5],stats->name,params[6]);
+		return 1;
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	int weapon = params[2];
+	if (weapon<0||weapon>=MAX_WEAPONS){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if (pPlayer->weaponsRnd[weapon].shots){
+		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
+		Stats* stats = &pPlayer->weaponsRnd[weapon];
+		cpStats[0] = stats->kills;
+		cpStats[1] = stats->deaths;
+		cpStats[2] = stats->hs;
+		cpStats[3] = stats->tks;
+		cpStats[4] = stats->shots;
+		cpStats[5] = stats->hits;
+		cpStats[6] = stats->damage;
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = stats->bodyHits[i];
+		return 1;
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	int weapon = params[2];
+	if (weapon<0||weapon>=MAX_WEAPONS){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if (pPlayer->weapons[weapon].shots){
+		cell *cpStats = MF_GetAmxAddr(amx,params[3]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[4]);
+		CPlayer::PlayerWeapon* stats = &pPlayer->weapons[weapon];
+		cpStats[0] = stats->kills;
+		cpStats[1] = stats->deaths;
+		cpStats[2] = stats->hs;
+		cpStats[3] = stats->tks;
+		cpStats[4] = stats->shots;
+		cpStats[5] = stats->hits;
+		cpStats[6] = stats->damage;
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = stats->bodyHits[i];
+		return 1;
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	GET_PLAYER_POINTER_I(index)->restartStats();
+	return 1;
+}
+
+static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if (pPlayer->rank){
+		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
+		cpStats[0] = pPlayer->life.kills;
+		cpStats[1] = pPlayer->life.deaths;
+		cpStats[2] = pPlayer->life.hs;
+		cpStats[3] = pPlayer->life.tks;
+		cpStats[4] = pPlayer->life.shots;
+		cpStats[5] = pPlayer->life.hits;
+		cpStats[6] = pPlayer->life.damage;
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = pPlayer->life.bodyHits[i];
+		return 1;
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if ( pPlayer->rank ){
+		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
+		cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
+		cpStats[0] = pPlayer->rank->kills;
+		cpStats[1] = pPlayer->rank->deaths;
+		cpStats[2] = pPlayer->rank->hs;
+		cpStats[3] = pPlayer->rank->tks;
+		cpStats[4] = pPlayer->rank->shots;
+		cpStats[5] = pPlayer->rank->hits;
+		cpStats[6] = pPlayer->rank->damage;
+
+		cpStats[7] = pPlayer->rank->getPosition();
+
+		for(int i = 1; i < 8; ++i)
+			cpBodyHits[i] = pPlayer->rank->bodyHits[i];
+		return pPlayer->rank->getPosition();
+	}
+	return 0;
+
+}
+
+static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param */
+{
+	int index = params[1];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	if ( pPlayer->rank ){
+		cell *cpStats = MF_GetAmxAddr(amx,params[2]);
+
+		cpStats[0] = pPlayer->rank->bDefusions;
+		cpStats[1] = pPlayer->rank->bDefused;
+		cpStats[2] = pPlayer->rank->bPlants;
+		cpStats[3] = pPlayer->rank->bExplosions;
+
+		return pPlayer->rank->getPosition();
+	}
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */
+{
+	
+	int index = params[1] + 1;
+
+	for(RankSystem::iterator a = g_rank.front(); a ;--a){
+		if ((*a).getPosition() == index)  {
+			cell *cpStats = MF_GetAmxAddr(amx,params[2]);
+			cell *cpBodyHits = MF_GetAmxAddr(amx,params[3]);
+			cpStats[0] = (*a).kills;
+			cpStats[1] = (*a).deaths;
+			cpStats[2] = (*a).hs;
+			cpStats[3] = (*a).tks;
+			cpStats[4] = (*a).shots;
+			cpStats[5] = (*a).hits;
+			cpStats[6] = (*a).damage;
+
+			cpStats[7] = (*a).getPosition();
+
+			MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
+			for(int i = 1; i < 8; ++i)
+				cpBodyHits[i] = (*a).bodyHits[i];
+			return --a ? index : 0;
+		}	
+	}
+	
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */
+{
+	
+	int index = params[1] + 1;
+
+	for(RankSystem::iterator a = g_rank.front(); a ;--a){
+		if ((*a).getPosition() == index)  {
+			cell *cpStats = MF_GetAmxAddr(amx,params[2]);
+
+			cpStats[0] = (*a).bDefusions;
+			cpStats[1] = (*a).bDefused;
+			cpStats[2] = (*a).bPlants;
+			cpStats[3] = (*a).bExplosions;
+
+			return --a ? index : 0;
+		}	
+	}
+	
+	return 0;
+}
+
+static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params)
+{
+	return g_rank.getRankNum();
+}
+
+static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0 
+	int i;
+	bool bFree = false;
+	for ( i=MAX_WEAPONS;i= MAX_WEAPONS+MAX_CWEAPONS ||  !weaponData[weapon].ammoSlot ){ // only for custom weapons
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
+		return 0;
+	}
+
+	int att = params[2];
+	if (att<1||att>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+
+	int vic = params[3];
+	if (vic<1||vic>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	
+	int dmg = params[4];
+	if ( dmg<1 ){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+	
+	int aim = params[5];
+	if ( aim < 0 || aim > 7 ){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+
+	CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
+	CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
+
+	pVic->pEdict->v.dmg_inflictor = NULL;
+	pAtt->saveHit( pVic , weapon , dmg, aim );
+
+	if ( !pAtt ) pAtt = pVic;
+	int TA = 0;
+	if ( (pVic->teamId == pAtt->teamId) && ( pVic != pAtt) )
+		TA = 1;
+	MF_ExecuteForward( iFDamage,pAtt->index, pVic->index, dmg, weapon, aim, TA );
+	
+	if ( pVic->IsAlive() )
+		return 1;
+
+	pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);
+	MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA );
+
+	return 1;
+}
+
+static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid
+	int index = params[2];
+	if (index<1||index>gpGlobals->maxClients){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		return 0;
+	}
+
+	int weapon = params[1];
+	if (  weapon < MAX_WEAPONS  || weapon >= MAX_WEAPONS+MAX_CWEAPONS ||  !weaponData[weapon].ammoSlot ){
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
+		return 0;
+	}
+
+	CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+	pPlayer->saveShot(weapon);
+
+	return 1;
+}
+
+static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){ 
+	int id = params[1];
+	if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ 
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
+		return 0;
+	}
+	return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
+}
+
+static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){ 
+	int id = params[1];
+	if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ 
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
+		return 0;
+	}
+	return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
+}
+
+static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){ 
+	int id = params[1];
+	if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ 
+		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
+		MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
+		return 0;
+	}
+	if ( id == 29 )
+		return 1;
+	return weaponData[id].melee ? 1:0;
+}
+
+static cell AMX_NATIVE_CALL get_maxweapons(AMX *amx, cell *params){
+	return MAX_WEAPONS+MAX_CWEAPONS;
+}
+
+static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){
+	return 8;
+}
+
+AMX_NATIVE_INFO stats_Natives[] = {
+	{ "get_stats",      get_stats},
+	{ "get_stats2",      get_stats2},
+	{ "get_statsnum",   get_statsnum},
+	{ "get_user_astats",  get_user_astats },
+	{ "get_user_rstats",  get_user_rstats },
+	{ "get_user_lstats",  get_user_rstats }, // for backward compatibility
+	{ "get_user_stats",   get_user_stats },
+	{ "get_user_stats2",   get_user_stats2 },
+	{ "get_user_vstats",  get_user_vstats },
+	{ "get_user_wrstats",  get_user_wrstats},             // DEC-Weapon(Round) Stats
+	{ "get_user_wstats",  get_user_wstats},
+	{ "reset_user_wstats",  reset_user_wstats },
+
+	// Custom Weapon Support
+	{ "custom_weapon_add", register_cwpn },
+	{ "custom_weapon_dmg", custom_wpn_dmg },
+	{ "custom_weapon_shot", custom_wpn_shot },
+
+	{ "xmod_get_wpnname", get_wpnname },
+	{ "xmod_get_wpnlogname", get_wpnlogname },
+	{ "xmod_is_melee_wpn", is_melee },
+	{ "xmod_get_maxweapons", get_maxweapons },
+	{ "xmod_get_stats_size", get_stats_size },
+
+	//***************************************
+	{ "get_weaponname", get_wpnname },
+
+	///*******************
+	{ NULL, NULL }
+};
+
diff --git a/dlls/csx/source/rank.h b/dlls/csx/source/rank.h
new file mode 100755
index 00000000..2c822a92
--- /dev/null
+++ b/dlls/csx/source/rank.h
@@ -0,0 +1,104 @@
+
+
+
+#ifndef RANK_H
+#define RANK_H
+
+#include "amxxmodule.h"
+#include "CMisc.h"
+#include "CRank.h"
+
+#define GET_PLAYER_POINTER(e)   (&players[ENTINDEX(e)])
+#define GET_PLAYER_POINTER_I(i) (&players[i])
+
+extern AMX_NATIVE_INFO stats_Natives[];
+
+struct weaponsVault {
+  char* name;
+  char* logname;
+  short int ammoSlot;
+  bool melee;
+};
+
+extern bool rankBots;
+extern cvar_t* csstats_rankbots;
+extern cvar_t* csstats_pause;
+
+extern int iFGrenade;
+extern int iFDeath;
+extern int iFDamage;
+
+extern int iFBPlanted;
+extern int iFBDefused;
+extern int iFBPlanting;
+extern int iFBDefusing;
+extern int iFBExplode;
+
+extern int g_bombAnnounce;
+extern int g_Planter;
+extern int g_Defuser;
+
+#define BOMB_PLANTING	1
+#define BOMB_PLANTED	2
+#define BOMB_EXPLODE	3
+#define BOMB_DEFUSING	4
+#define BOMB_DEFUSED	5
+
+extern weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS];
+
+typedef void (*funEventCall)(void*);
+extern funEventCall modMsgsEnd[MAX_REG_MSGS];
+extern funEventCall modMsgs[MAX_REG_MSGS];
+
+extern void (*function)(void*);
+extern void (*endfunction)(void*);
+
+extern cvar_t *csstats_maxsize;
+extern cvar_t* csstats_rank;
+extern cvar_t* csstats_reset;
+
+extern Grenades g_grenades;
+
+extern RankSystem g_rank;
+
+extern CPlayer players[33];
+
+extern CPlayer* mPlayer;
+
+extern int mPlayerIndex;
+
+extern int mState;
+
+extern int gmsgCurWeapon;
+extern int gmsgDamageEnd;
+extern int gmsgDamage;
+extern int gmsgWeaponList;
+extern int gmsgResetHUD;
+extern int gmsgAmmoX;
+extern int gmsgScoreInfo;
+extern int gmsgAmmoPickup;
+
+extern int gmsgSendAudio;
+extern int gmsgTextMsg;
+extern int gmsgBarTime;
+
+void Client_AmmoX(void*);
+void Client_CurWeapon(void*);
+void Client_Damage(void*);
+void Client_WeaponList(void*);
+void Client_AmmoPickup(void*);
+void Client_Damage_End(void*);
+void Client_ScoreInfo(void*);
+void Client_ResetHUD(void*);
+
+void Client_SendAudio(void*);
+void Client_TextMsg(void*);
+void Client_BarTime(void*);
+
+bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
+bool isModuleActive();
+
+#endif // RANK_H
+
+
+
diff --git a/dlls/csx/source/usermsg.cpp b/dlls/csx/source/usermsg.cpp
new file mode 100755
index 00000000..436db283
--- /dev/null
+++ b/dlls/csx/source/usermsg.cpp
@@ -0,0 +1,203 @@
+#include "amxxmodule.h"
+#include "rank.h"
+
+weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS];
+
+int damage;
+int TA;
+int weapon;
+int aim;
+CPlayer *pAttacker;
+
+void Client_ResetHUD(void* mValue){
+	if ( mPlayer && mPlayer->IsAlive() ) 
+		mPlayer->clearStats = gpGlobals->time + 0.25f;
+}
+
+void Client_WeaponList(void* mValue){
+  static int wpnList;
+  static int iSlot;
+  static const char* wpnName;
+
+  switch (mState++) {
+  case 0:
+    wpnName = (const char*)mValue;
+    break;
+  case 1:
+    iSlot = *(int*)mValue;
+    break;
+  case 7:
+    int iId = *(int*)mValue;
+    if ( (iId < 0 || iId >= MAX_WEAPONS ) || ( wpnList & (1<pEdict->v.dmg_inflictor;
+    
+	if ( FNullEnt( enemy ) )
+		break;
+	aim = 0;
+	weapon = 0;
+	pAttacker = NULL;
+    
+	if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) {
+		pAttacker = GET_PLAYER_POINTER(enemy);
+		aim = pAttacker->aiming;
+		weapon = pAttacker->current;
+		pAttacker->saveHit( mPlayer , weapon , damage, aim);
+		break;
+	}
+    if( g_grenades.find(enemy , &pAttacker , &weapon ) )
+        pAttacker->saveHit( mPlayer , weapon , damage, aim );
+  }
+}
+
+void Client_Damage_End(void* mValue){
+	if ( !mPlayer || !damage )
+		return;
+
+	if ( !pAttacker ) pAttacker = mPlayer;
+		TA = 0;
+	if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) )
+		TA = 1;
+
+	MF_ExecuteForward( iFDamage,pAttacker->index , mPlayer->index , damage, weapon, aim, TA );
+	 
+	if ( !mPlayer->IsAlive() ){
+		pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
+		MF_ExecuteForward( iFDeath,pAttacker->index, mPlayer->index, weapon, aim, TA );
+	}
+}
+
+void Client_CurWeapon(void* mValue){
+  static int iState;
+  static int iId;
+  switch (mState++){
+  case 0: 
+    iState = *(int*)mValue;
+    break;
+  case 1:
+    if (!iState) break; 
+    iId = *(int*)mValue;
+    break;
+  case 2:
+	if (!mPlayer || !iState ) break;
+    int iClip = *(int*)mValue;
+    if ((iClip > -1) && (iClip < mPlayer->weapons[iId].clip)) 
+      mPlayer->saveShot(iId);
+    mPlayer->weapons[iId].clip = iClip;
+	mPlayer->current = iId;
+  }
+}
+
+void Client_AmmoX(void* mValue){
+  static int iAmmo;
+  switch (mState++){
+  case 0:
+    iAmmo = *(int*)mValue;
+    break;
+  case 1:
+	if (!mPlayer ) break;
+    for(int i = 1; i < MAX_WEAPONS ; ++i) 
+      if (iAmmo == weaponData[i].ammoSlot)
+        mPlayer->weapons[i].ammo = *(int*)mValue;
+  }
+}
+
+void Client_AmmoPickup(void* mValue){
+  static int iSlot;
+  switch (mState++){
+  case 0:
+    iSlot = *(int*)mValue;
+    break;
+  case 1:
+	if (!mPlayer ) break;
+    for(int i = 1; i < MAX_WEAPONS ; ++i)
+      if (weaponData[i].ammoSlot == iSlot)
+        mPlayer->weapons[i].ammo += *(int*)mValue;
+  }
+}
+
+void Client_ScoreInfo(void* mValue){
+  static int index;
+  switch (mState++){
+  case 0:
+    index = *(int*)mValue;
+    break;
+  case 4:
+	if ( index > 0 && index <= gpGlobals->maxClients )
+		GET_PLAYER_POINTER_I( index )->teamId = *(int*)mValue;
+  }
+}
+
+void Client_SendAudio(void* mValue){
+	static const char* szText;
+	if ( mState == 1 ){
+		szText = (const char*)mValue;
+		if ( !mPlayer && szText[7]=='B' ) {
+			if ( szText[11]=='P' && g_Planter ){
+				GET_PLAYER_POINTER_I(g_Planter)->saveBPlant();
+				g_bombAnnounce = BOMB_PLANTED;
+			}
+			else if ( szText[11]=='D' && g_Defuser ){
+				GET_PLAYER_POINTER_I(g_Defuser)->saveBDefused();
+				g_bombAnnounce = BOMB_DEFUSED;
+			}
+
+		}
+	}
+	mState++;
+}
+
+void Client_TextMsg(void* mValue){
+	static const char* szText;
+	if ( !mPlayer && mState==1 ){
+		szText = (const char*)mValue;
+		if ( szText[1]=='T' && szText[8]=='B' && g_Planter ){
+			GET_PLAYER_POINTER_I(g_Planter)->saveBExplode();
+			g_bombAnnounce = BOMB_EXPLODE;
+		}
+	}
+	mState++;
+}
+
+void Client_BarTime(void* mValue){
+	int iTime = *(int*)mValue;
+	if ( !iTime || !mPlayer->IsAlive() ) return;
+	if ( iTime == 3 ){
+		g_Planter = mPlayerIndex;
+		g_bombAnnounce = BOMB_PLANTING;
+		g_Defuser = 0;
+	}
+	else {
+		mPlayer->saveBDefusing();
+		g_Defuser = mPlayerIndex;
+		g_bombAnnounce = BOMB_DEFUSING;
+	}
+}
\ No newline at end of file