added tfc support
This commit is contained in:
parent
8cff99c7f4
commit
07ecc9f6fe
278
dlls/tfc/tfcx/CMisc.cpp
Executable file
278
dlls/tfc/tfcx/CMisc.cpp
Executable file
|
@ -0,0 +1,278 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "CMisc.h"
|
||||||
|
#include "tfcx.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 ) {
|
||||||
|
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(){
|
||||||
|
|
||||||
|
ingame = false;
|
||||||
|
|
||||||
|
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(){
|
||||||
|
|
||||||
|
ingame = true;
|
||||||
|
|
||||||
|
if ( ignoreBots(pEdict) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
restartStats();
|
||||||
|
|
||||||
|
const char* name = STRING(pEdict->v.netname);
|
||||||
|
const char* unique = name;
|
||||||
|
switch((int)tfcstats_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;
|
||||||
|
|
||||||
|
//PRINT_CONSOLE("Death! Killer:%d Victim:%d weapon:%d hs:%d tk:%d\n",index,pVictim->index,wweapon,hhs,ttk);
|
||||||
|
|
||||||
|
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 ( ignoreDamage )
|
||||||
|
return;
|
||||||
|
|
||||||
|
//PRINT_CONSOLE("Hit! Attacker:%d Victim:%d weapon:%d damage:%d body:%d\n",index,pVictim->index,wweapon,ddamage,bbody);
|
||||||
|
|
||||||
|
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){
|
||||||
|
|
||||||
|
//PRINT_CONSOLE("Shot! Weapon:%d\n",weapon);
|
||||||
|
|
||||||
|
if ( ignoreBots(pEdict) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( ignoreDamage )
|
||||||
|
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::killPlayer(){
|
||||||
|
pEdict->v.dmg_inflictor = NULL;
|
||||||
|
pEdict->v.health = 0;
|
||||||
|
pEdict->v.deadflag = DEAD_RESPAWNABLE;
|
||||||
|
pEdict->v.weaponmodel = 0;
|
||||||
|
pEdict->v.weapons = 0;
|
||||||
|
}
|
||||||
|
|
186
dlls/tfc/tfcx/CMisc.h
Executable file
186
dlls/tfc/tfcx/CMisc.h
Executable file
|
@ -0,0 +1,186 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CMISC_H
|
||||||
|
#define CMISC_H
|
||||||
|
|
||||||
|
#include "amxxmodule.h"
|
||||||
|
#include "CRank.h"
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
#define LINUXOFFSET 0
|
||||||
|
#else
|
||||||
|
#define LINUXOFFSET 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TFCMAX_CUSTOMWPNS 5
|
||||||
|
#define TFCMAX_WEAPONS MAX_WEAPONS + TFCMAX_CUSTOMWPNS
|
||||||
|
|
||||||
|
#define PD_SENTRY_OWNER 83 + LINUXOFFSET
|
||||||
|
#define PD_TIMER_OWNER 932 + LINUXOFFSET
|
||||||
|
|
||||||
|
#define MAX_TRACE 14 // +1 // timer
|
||||||
|
//#define NADE_OFFSET 24
|
||||||
|
|
||||||
|
|
||||||
|
#define ACT_NADE_NONE 0
|
||||||
|
#define ACT_NADE_SHOT 1<<0
|
||||||
|
#define ACT_NADE_PUT 1<<1
|
||||||
|
#define ACT_NADE_THROW 1<<2
|
||||||
|
|
||||||
|
#define PD_AMMO_SHELLS 53 + LINUXOFFSET
|
||||||
|
#define PD_AMMO_BULLETS 55 + LINUXOFFSET
|
||||||
|
#define PD_AMMO_CELLS 57 + LINUXOFFSET
|
||||||
|
#define PD_AMMO_ROCKETS 59 + LINUXOFFSET
|
||||||
|
#define PD_AMMO_NADE1 14 + LINUXOFFSET
|
||||||
|
#define PD_AMMO_NADE2 15 + LINUXOFFSET
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TFC_AMMO_SHELLS = 0,
|
||||||
|
TFC_AMMO_BULLETS,
|
||||||
|
TFC_AMMO_CELLS,
|
||||||
|
TFC_AMMO_ROCKETS,
|
||||||
|
TFC_AMMO_NADE1,
|
||||||
|
TFC_AMMO_NADE2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TFC_WPN_NONE = 0,
|
||||||
|
TFC_WPN_TIMER, // TFC_UNK_1,
|
||||||
|
TFC_WPN_SENTRYGUN, //TFC_WPN_UNK2,
|
||||||
|
TFC_WPN_MEDIKIT,
|
||||||
|
TFC_WPN_SPANNER,
|
||||||
|
TFC_WPN_AXE,
|
||||||
|
TFC_WPN_SNIPERRIFLE,
|
||||||
|
TFC_WPN_AUTORIFLE,
|
||||||
|
TFC_WPN_SHOTGUN,
|
||||||
|
TFC_WPN_SUPERSHOTGUN,
|
||||||
|
TFC_WPN_NG,
|
||||||
|
TFC_WPN_SUPERNG,
|
||||||
|
TFC_WPN_GL,
|
||||||
|
TFC_WPN_FLAMETHROWER,
|
||||||
|
TFC_WPN_RPG,
|
||||||
|
TFC_WPN_IC,
|
||||||
|
TFC_WPN_FLAMES,//TFC_WPN_UNK16,
|
||||||
|
TFC_WPN_AC,
|
||||||
|
TFC_WPN_UNK18,
|
||||||
|
TFC_WPN_UNK19,
|
||||||
|
TFC_WPN_TRANQ,
|
||||||
|
TFC_WPN_RAILGUN,
|
||||||
|
TFC_WPN_PL,
|
||||||
|
TFC_WPN_KNIFE,
|
||||||
|
TFC_WPN_CALTROP, // 24
|
||||||
|
TFC_WPN_CONCUSSIONGRENADE,
|
||||||
|
TFC_WPN_NORMALGRENADE,
|
||||||
|
TFC_WPN_NAILGRENADE,
|
||||||
|
TFC_WPN_MIRVGRENADE,
|
||||||
|
TFC_WPN_NAPALMGRENADE,
|
||||||
|
TFC_WPN_GASGRENADE,
|
||||||
|
TFC_WPN_EMPGRENADE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TFC_PC_SCOUT = 1,
|
||||||
|
TFC_PC_SNIPER,
|
||||||
|
TFC_PC_SOLDIER,
|
||||||
|
TFC_PC_DEMOMAN,
|
||||||
|
TFC_PC_MEDIC,
|
||||||
|
TFC_PC_HWGUY,
|
||||||
|
TFC_PC_PYRO,
|
||||||
|
TFC_PC_SPY,
|
||||||
|
TFC_PC_ENGENEER,
|
||||||
|
TFC_PC_CIVILIAN,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct weaponsVault {
|
||||||
|
char* name;
|
||||||
|
char fullName[32];
|
||||||
|
short int ammoSlot;
|
||||||
|
bool melee;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct traceVault {
|
||||||
|
char * szName;
|
||||||
|
int iId;
|
||||||
|
int iAction;
|
||||||
|
float fDel;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// *****************************************************
|
||||||
|
// class CPlayer
|
||||||
|
// *****************************************************
|
||||||
|
|
||||||
|
struct CPlayer {
|
||||||
|
|
||||||
|
edict_t* pEdict;
|
||||||
|
char ip[32];
|
||||||
|
int index;
|
||||||
|
int aiming;
|
||||||
|
int current;
|
||||||
|
|
||||||
|
bool ingame;
|
||||||
|
bool bot;
|
||||||
|
float clearStats;
|
||||||
|
RankSystem::RankStats* rank;
|
||||||
|
|
||||||
|
struct PlayerWeapon : Stats {
|
||||||
|
const char* name;
|
||||||
|
int ammo;
|
||||||
|
int clip;
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayerWeapon weapons[MAX_WEAPONS];
|
||||||
|
PlayerWeapon attackers[33];
|
||||||
|
PlayerWeapon victims[33];
|
||||||
|
Stats weaponsRnd[MAX_WEAPONS]; // DEC-Weapon (Round) stats
|
||||||
|
Stats life;
|
||||||
|
|
||||||
|
int teamId;
|
||||||
|
int classId;
|
||||||
|
|
||||||
|
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 restartStats(bool all = true);
|
||||||
|
void killPlayer();
|
||||||
|
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();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMISC_H
|
||||||
|
|
305
dlls/tfc/tfcx/CRank.cpp
Executable file
305
dlls/tfc/tfcx/CRank.cpp
Executable file
|
@ -0,0 +1,305 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "CRank.h"
|
||||||
|
#include "tfcx.h"
|
||||||
|
|
||||||
|
// *****************************************************
|
||||||
|
// class Stats
|
||||||
|
// *****************************************************
|
||||||
|
Stats::Stats(){
|
||||||
|
hits = shots = damage = hs = tks = kills = deaths = 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;
|
||||||
|
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)!=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)){
|
||||||
|
MF_PrintSrvConsole("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;
|
||||||
|
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.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).bodyHits, 1, sizeof((*a).bodyHits), bfp);
|
||||||
|
}
|
||||||
|
|
||||||
|
--a;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
|
||||||
|
|
||||||
|
fclose(bfp);
|
||||||
|
}
|
113
dlls/tfc/tfcx/CRank.h
Executable file
113
dlls/tfc/tfcx/CRank.h
Executable file
|
@ -0,0 +1,113 @@
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CRANK_H
|
||||||
|
#define CRANK_H
|
||||||
|
|
||||||
|
#define RANK_VERSION 5
|
||||||
|
|
||||||
|
|
||||||
|
// *****************************************************
|
||||||
|
// class Stats
|
||||||
|
// *****************************************************
|
||||||
|
|
||||||
|
struct Stats {
|
||||||
|
int hits;
|
||||||
|
int shots;
|
||||||
|
int damage;
|
||||||
|
int hs;
|
||||||
|
int tks;
|
||||||
|
int kills;
|
||||||
|
int deaths;
|
||||||
|
int bodyHits[8];
|
||||||
|
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
|
101
dlls/tfc/tfcx/Makefile
Executable file
101
dlls/tfc/tfcx/Makefile
Executable file
|
@ -0,0 +1,101 @@
|
||||||
|
MODNAME = tfcx_amxx
|
||||||
|
SRCFILES = amxxmodule.cpp CMisc.cpp CRank.cpp Utils.cpp moduleconfig.cpp NBase.cpp NRank.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
|
||||||
|
|
||||||
|
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
|
||||||
|
|
||||||
|
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$(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)
|
||||||
|
|
||||||
|
|
501
dlls/tfc/tfcx/NBase.cpp
Executable file
501
dlls/tfc/tfcx/NBase.cpp
Executable file
|
@ -0,0 +1,501 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "tfcx.h"
|
||||||
|
|
||||||
|
// Vexd start
|
||||||
|
|
||||||
|
// Set A TFC Player's model. This works differently then CS.
|
||||||
|
static cell AMX_NATIVE_CALL TFC_SetModel(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
// Make sure its a player.
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iLen;
|
||||||
|
|
||||||
|
char *szSkin = MF_GetAmxString(amx, params[3],0, &iLen);
|
||||||
|
char *szModel = MF_GetAmxString(amx, params[2],0, &iLen);
|
||||||
|
|
||||||
|
// Get Player's edict pointer
|
||||||
|
edict_t* pPlayer = INDEXENT(iIndex);
|
||||||
|
|
||||||
|
// Set key on client, replacement_model is for the model we want.
|
||||||
|
KeyValueData pkvd;
|
||||||
|
pkvd.szClassName = "player";
|
||||||
|
pkvd.szKeyName = "replacement_model";
|
||||||
|
pkvd.szValue = szModel;
|
||||||
|
pkvd.fHandled = FALSE;
|
||||||
|
(gpGamedllFuncs->dllapi_table->pfnKeyValue)(pPlayer, &pkvd);
|
||||||
|
|
||||||
|
// Set key on client, replacement_model_skin is for what skin we want.
|
||||||
|
KeyValueData pkvd2;
|
||||||
|
pkvd2.szClassName = "player";
|
||||||
|
pkvd2.szKeyName = "replacement_model_skin";
|
||||||
|
pkvd2.szValue = szSkin;
|
||||||
|
pkvd2.fHandled = FALSE;
|
||||||
|
(gpGamedllFuncs->dllapi_table->pfnKeyValue)(pPlayer, &pkvd2);
|
||||||
|
|
||||||
|
// and, like CS, set model in the infobuffer.
|
||||||
|
(g_engfuncs.pfnSetClientKeyValue)(iIndex, (g_engfuncs.pfnGetInfoKeyBuffer)(pPlayer), "model", szModel);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear's a TFC player's model... Almost the same as setting the model.
|
||||||
|
// HACKHACK: Is there a better way of doing this? what if the player is random?
|
||||||
|
static cell AMX_NATIVE_CALL TFC_ClearModel(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t* pPlayer = INDEXENT(iIndex);
|
||||||
|
|
||||||
|
char szModel[32];
|
||||||
|
memset(szModel, 0x0, strlen(szModel));
|
||||||
|
|
||||||
|
switch(pPlayer->v.playerclass) {
|
||||||
|
case 1: //Scout
|
||||||
|
memcpy(szModel, "Scout", strlen("Scout"));
|
||||||
|
break;
|
||||||
|
case 2: //Sniper
|
||||||
|
memcpy(szModel, "Sniper", strlen("Sniper"));
|
||||||
|
break;
|
||||||
|
case 3: //Soldier
|
||||||
|
memcpy(szModel, "Soldier", strlen("Soldier"));
|
||||||
|
break;
|
||||||
|
case 4: //demoman
|
||||||
|
memcpy(szModel, "Demo", strlen("Demo"));
|
||||||
|
//(char *)szModel = "Demo";
|
||||||
|
break;
|
||||||
|
case 5: //Medic
|
||||||
|
memcpy(szModel, "Medic", strlen("Medic"));
|
||||||
|
break;
|
||||||
|
case 6: //HWGuy
|
||||||
|
memcpy(szModel, "HvyWeapon", strlen("HvyWeapon"));
|
||||||
|
break;
|
||||||
|
case 7: //Pyro
|
||||||
|
memcpy(szModel, "Pyro", strlen("Pyro"));
|
||||||
|
break;
|
||||||
|
case 8: //Spy
|
||||||
|
memcpy(szModel, "Spy", strlen("Spy"));
|
||||||
|
break;
|
||||||
|
case 9: //Engineer
|
||||||
|
memcpy(szModel, "Engineer", strlen("Engineer"));
|
||||||
|
break;
|
||||||
|
case 11: //Hunted
|
||||||
|
memcpy(szModel, "Civilian", strlen("Civilian"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyValueData pkvd;
|
||||||
|
pkvd.szClassName = "player";
|
||||||
|
pkvd.szKeyName = "replacement_model";
|
||||||
|
pkvd.szValue = szModel;
|
||||||
|
pkvd.fHandled = FALSE;
|
||||||
|
(gpGamedllFuncs->dllapi_table->pfnKeyValue)(pPlayer, &pkvd);
|
||||||
|
|
||||||
|
KeyValueData pkvd2;
|
||||||
|
pkvd2.szClassName = "player";
|
||||||
|
pkvd2.szKeyName = "replacement_model_skin";
|
||||||
|
pkvd2.szValue = "0";
|
||||||
|
pkvd2.fHandled = FALSE;
|
||||||
|
(gpGamedllFuncs->dllapi_table->pfnKeyValue)(pPlayer, &pkvd2);
|
||||||
|
|
||||||
|
(g_engfuncs.pfnSetClientKeyValue)(iIndex, (g_engfuncs.pfnGetInfoKeyBuffer)(pPlayer), "model", szModel);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// Vexd end :)
|
||||||
|
|
||||||
|
// AssKicR start
|
||||||
|
static cell AMX_NATIVE_CALL TFC_SetBAmmo(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int iValue = params[3];
|
||||||
|
|
||||||
|
if (iValue < 0 ) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(iIndex);
|
||||||
|
|
||||||
|
switch(params[2]){ // ammo
|
||||||
|
case TFC_AMMO_SHELLS:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_SHELLS]) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_BULLETS:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_BULLETS]) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_CELLS:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_CELLS]) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_ROCKETS:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_ROCKETS]) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_NADE1:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_NADE1]) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_NADE2:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_NADE2]) = iValue;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_GetBAmmo(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(iIndex);
|
||||||
|
|
||||||
|
switch(params[2]){ // ammo
|
||||||
|
case TFC_AMMO_SHELLS:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_SHELLS]);
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_BULLETS:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_BULLETS]);
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_CELLS:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_CELLS]);
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_ROCKETS:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_ROCKETS]);
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_NADE1:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_NADE1]);
|
||||||
|
break;
|
||||||
|
case TFC_AMMO_NADE2:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + pdAmmo[TFC_AMMO_NADE2]);
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_GetWeaponBAmmo(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(iIndex);
|
||||||
|
|
||||||
|
switch(params[2]){ // weapon
|
||||||
|
case TFC_WPN_SNIPERRIFLE:
|
||||||
|
case TFC_WPN_AUTORIFLE:
|
||||||
|
case TFC_WPN_SHOTGUN:
|
||||||
|
case TFC_WPN_SUPERSHOTGUN:
|
||||||
|
case TFC_WPN_TRANQ:
|
||||||
|
case TFC_WPN_AC:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_SHELLS);
|
||||||
|
break;
|
||||||
|
case TFC_WPN_NG:
|
||||||
|
case TFC_WPN_SUPERNG:
|
||||||
|
case TFC_WPN_RAILGUN:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_BULLETS);
|
||||||
|
break;
|
||||||
|
case TFC_WPN_FLAMETHROWER:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_CELLS);
|
||||||
|
break;
|
||||||
|
case TFC_WPN_GL:
|
||||||
|
case TFC_WPN_RPG:
|
||||||
|
case TFC_WPN_IC:
|
||||||
|
case TFC_WPN_PL:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_ROCKETS);
|
||||||
|
break;
|
||||||
|
case TFC_WPN_CALTROP:
|
||||||
|
case TFC_WPN_NORMALGRENADE:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_NADE1);
|
||||||
|
break;
|
||||||
|
case TFC_WPN_CONCUSSIONGRENADE:
|
||||||
|
case TFC_WPN_NAILGRENADE:
|
||||||
|
case TFC_WPN_MIRVGRENADE:
|
||||||
|
case TFC_WPN_NAPALMGRENADE:
|
||||||
|
case TFC_WPN_GASGRENADE:
|
||||||
|
case TFC_WPN_EMPGRENADE:
|
||||||
|
return *( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_NADE2);
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_SetWeaponBAmmo(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
|
||||||
|
if (iIndex < 1 || iIndex > gpGlobals->maxClients) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iValue = params[3];
|
||||||
|
|
||||||
|
if (iValue < 0 ) {
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(iIndex);
|
||||||
|
|
||||||
|
switch(params[2]){ // weapon
|
||||||
|
case TFC_WPN_SNIPERRIFLE:
|
||||||
|
case TFC_WPN_AUTORIFLE:
|
||||||
|
case TFC_WPN_SHOTGUN:
|
||||||
|
case TFC_WPN_SUPERSHOTGUN:
|
||||||
|
case TFC_WPN_TRANQ:
|
||||||
|
case TFC_WPN_AC:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_SHELLS) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_WPN_NG:
|
||||||
|
case TFC_WPN_SUPERNG:
|
||||||
|
case TFC_WPN_RAILGUN:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_BULLETS) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_WPN_FLAMETHROWER:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_CELLS) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_WPN_GL:
|
||||||
|
case TFC_WPN_RPG:
|
||||||
|
case TFC_WPN_IC:
|
||||||
|
case TFC_WPN_PL:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_ROCKETS) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_WPN_CALTROP:
|
||||||
|
case TFC_WPN_NORMALGRENADE:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_NADE1) = iValue;
|
||||||
|
break;
|
||||||
|
case TFC_WPN_CONCUSSIONGRENADE:
|
||||||
|
case TFC_WPN_NAILGRENADE:
|
||||||
|
case TFC_WPN_MIRVGRENADE:
|
||||||
|
case TFC_WPN_NAPALMGRENADE:
|
||||||
|
case TFC_WPN_GASGRENADE:
|
||||||
|
case TFC_WPN_EMPGRENADE:
|
||||||
|
*( (int*)pPlayer->pEdict->pvPrivateData + PD_AMMO_NADE2) = iValue;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// AssKicR end :)
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_GetWpnName(AMX *amx, cell *params) {
|
||||||
|
int iIndex = params[1];
|
||||||
|
if ( iIndex < 1 || iIndex > TFCMAX_WEAPONS ){
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return MF_SetAmxString(amx,params[2],weaponData[iIndex].name,params[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_SetPDdata(AMX *amx, cell *params) {
|
||||||
|
|
||||||
|
pdTimerOwner = params[1];
|
||||||
|
pdSentryGunOwner = params[2];
|
||||||
|
|
||||||
|
pdAmmo[TFC_AMMO_SHELLS] = params[3];
|
||||||
|
pdAmmo[TFC_AMMO_BULLETS] = params[4];
|
||||||
|
pdAmmo[TFC_AMMO_CELLS] = params[5];
|
||||||
|
pdAmmo[TFC_AMMO_ROCKETS] = params[6];
|
||||||
|
pdAmmo[TFC_AMMO_NADE1] = params[7];
|
||||||
|
pdAmmo[TFC_AMMO_NADE2] = params[8];
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0
|
||||||
|
int i;
|
||||||
|
bool bFree = false;
|
||||||
|
for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;i<TFCMAX_WEAPONS;i++){
|
||||||
|
if ( !weaponData[i].ammoSlot ){
|
||||||
|
bFree = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !bFree )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int iLen;
|
||||||
|
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
|
||||||
|
|
||||||
|
strcpy(weaponData[i].name,szName);
|
||||||
|
weaponData[i].ammoSlot = true;
|
||||||
|
weaponData[i].melee = params[2] ? true:false;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
||||||
|
int weapon = params[1];
|
||||||
|
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ // only for custom weapons
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
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->pEdict->v.team == pAtt->pEdict->v.team ) && ( 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 TFC_cwpn_shot(AMX *amx, cell *params){ // player,wid
|
||||||
|
int index = params[1];
|
||||||
|
if (index<1||index>gpGlobals->maxClients){
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int weapon = params[2];
|
||||||
|
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
pPlayer->saveShot(weapon);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_IsMelee(AMX *amx, cell *params){ // player,wid
|
||||||
|
int weapon = params[1];
|
||||||
|
if ( weapon < 1 || weapon >= TFCMAX_WEAPONS ){
|
||||||
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return weaponData[weapon].melee;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL TFC_UserKill(AMX *amx, cell *params){ // player,wid
|
||||||
|
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);
|
||||||
|
pPlayer->killPlayer();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Native list.
|
||||||
|
AMX_NATIVE_INFO base_Natives[] = {
|
||||||
|
{"TFC_SetModel", TFC_SetModel},
|
||||||
|
{"TFC_ClearModel", TFC_ClearModel},
|
||||||
|
{"TFC_SetBAmmo", TFC_SetBAmmo},
|
||||||
|
{"TFC_GetBAmmo", TFC_GetBAmmo},
|
||||||
|
{"TFC_GetWeaponBAmmo", TFC_GetWeaponBAmmo},
|
||||||
|
{"TFC_SetWeaponBAmmo", TFC_SetWeaponBAmmo},
|
||||||
|
{"TFC_GetWpnName", TFC_GetWpnName},
|
||||||
|
|
||||||
|
{"TFC_IsMelee", TFC_IsMelee},
|
||||||
|
{"TFC_UserKill" , TFC_UserKill},
|
||||||
|
|
||||||
|
// Custom Weapon Support
|
||||||
|
{ "TFC_reg_custom_wpn", TFC_register_cwpn },
|
||||||
|
{ "TFC_custom_wpn_dmg", TFC_cwpn_dmg },
|
||||||
|
{ "TFC_custom_wpn_shot", TFC_cwpn_shot },
|
||||||
|
|
||||||
|
{"TFC_SetPDdata", TFC_SetPDdata },
|
||||||
|
//******************* 19 :)
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
272
dlls/tfc/tfcx/NRank.cpp
Executable file
272
dlls/tfc/tfcx/NRank.cpp
Executable file
|
@ -0,0 +1,272 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "tfcx.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>=TFCMAX_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>=TFCMAX_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_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_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_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_statsnum(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
return g_rank.getRankNum();
|
||||||
|
}
|
||||||
|
|
||||||
|
AMX_NATIVE_INFO stats_Natives[] = {
|
||||||
|
{ "get_stats", get_stats},
|
||||||
|
{ "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_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 },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
118
dlls/tfc/tfcx/Utils.cpp
Executable file
118
dlls/tfc/tfcx/Utils.cpp
Executable file
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "tfcx.h"
|
||||||
|
|
||||||
|
traceVault traceData[] = {
|
||||||
|
{ "tf_gl_grenade", TFC_WPN_GL, ACT_NADE_PUT, 2.0 },
|
||||||
|
{ "tf_gl_pipebomb", TFC_WPN_PL, ACT_NADE_PUT, 2.0 },
|
||||||
|
{ "tf_weapon_normalgrenade", TFC_WPN_NORMALGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
|
||||||
|
{ "tf_weapon_nailgrenade", TFC_WPN_NAILGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
|
||||||
|
{ "tf_weapon_mirvgrenade", TFC_WPN_MIRVGRENADE, ACT_NADE_SHOT|ACT_NADE_PUT|ACT_NADE_THROW, 2.0 },
|
||||||
|
{ "tf_weapon_napalmgrenade", TFC_WPN_NAPALMGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
|
||||||
|
{ "tf_weapon_gasgrenade", TFC_WPN_GASGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
|
||||||
|
{ "tf_weapon_empgrenade", TFC_WPN_EMPGRENADE, ACT_NADE_SHOT|ACT_NADE_THROW, 0.0 },
|
||||||
|
{ "tf_weapon_mirvbomblet", TFC_WPN_MIRVGRENADE,ACT_NADE_PUT, 2.0 },
|
||||||
|
{ "tf_rpg_rocket", TFC_WPN_RPG,ACT_NADE_PUT, 2.0 },
|
||||||
|
{ "caltrop", TFC_WPN_CALTROP, ACT_NADE_SHOT|ACT_NADE_THROW,0.0 },
|
||||||
|
{ "tf_weapon_concussiongrenade", TFC_WPN_CONCUSSIONGRENADE, ACT_NADE_THROW, 0.0 },
|
||||||
|
|
||||||
|
// { "timer", TFC_WPN_TIMER,ACT_NADE_NONE, 2.0 },
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
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("tfcstats_pause") )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
medikit,iSlot:-1,iId:3
|
||||||
|
spanner,iSlot:2,iId:4
|
||||||
|
axe,iSlot:-1,iId:5
|
||||||
|
sniperrifle,iSlot:1,iId:6
|
||||||
|
autorifle,iSlot:1,iId:7
|
||||||
|
shotgun,iSlot:1,iId:8
|
||||||
|
supershotgun,iSlot:1,iId:9
|
||||||
|
ng,iSlot:3,iId:10
|
||||||
|
superng,iSlot:3,iId:11
|
||||||
|
gl,iSlot:4,iId:12
|
||||||
|
flamethrower,iSlot:2,iId:13
|
||||||
|
rpg,iSlot:4,iId:14
|
||||||
|
ic,iSlot:4,iId:15
|
||||||
|
ac,iSlot:1,iId:17
|
||||||
|
tranq,iSlot:1,iId:20
|
||||||
|
railgun,iSlot:3,iId:21
|
||||||
|
pl,iSlot:4,iId:22
|
||||||
|
knife,iSlot:-1,iId:23
|
||||||
|
*/
|
||||||
|
weaponsVault weaponData[] = {
|
||||||
|
{ "", "", -1 }, // 0
|
||||||
|
{ "timer", "", -1 }, // 1
|
||||||
|
{ "sentrygun", "", -1 }, // 2
|
||||||
|
{ "medikit", "", -1 , true},
|
||||||
|
{ "spanner", "", 2 , true },
|
||||||
|
{ "axe", "", -1 , true },
|
||||||
|
{ "sniperrifle", "", 1 },
|
||||||
|
{ "autorifle", "", 1 },
|
||||||
|
{ "shotgun", "", 1 },
|
||||||
|
{ "supershotgun", "", 1 },
|
||||||
|
{ "ng", "", 3 },
|
||||||
|
{ "superng", "", 3 },
|
||||||
|
{ "gl", "", 4 },
|
||||||
|
{ "flamethrower", "", 2 },
|
||||||
|
{ "rpg", "", 4 },
|
||||||
|
{ "ic", "", 4 },
|
||||||
|
{ "flames", "", -1 }, // 16
|
||||||
|
{ "ac", "", 1 },
|
||||||
|
{ "", "", -1 }, // 18
|
||||||
|
{ "", "", -1 }, // 19
|
||||||
|
{ "tranq", "", 1 },
|
||||||
|
{ "railgun", "", 3 },
|
||||||
|
{ "pl", "", 4 },
|
||||||
|
{ "knife", "", -1 , true },
|
||||||
|
{ "caltrop", "", -1 }, // 24
|
||||||
|
{ "concussion", "", -1 },
|
||||||
|
{ "grenade", "", -1 },
|
||||||
|
{ "nailgrenade", "", -1 },
|
||||||
|
{ "mirvgrenade", "", -1 },
|
||||||
|
{ "napalm", "", -1 },
|
||||||
|
{ "gas", "", -1 },
|
||||||
|
{ "emp", "", -1 },
|
||||||
|
};
|
2990
dlls/tfc/tfcx/amxxmodule.cpp
Executable file
2990
dlls/tfc/tfcx/amxxmodule.cpp
Executable file
File diff suppressed because it is too large
Load Diff
2152
dlls/tfc/tfcx/amxxmodule.h
Executable file
2152
dlls/tfc/tfcx/amxxmodule.h
Executable file
File diff suppressed because it is too large
Load Diff
6
dlls/tfc/tfcx/compile.bat
Executable file
6
dlls/tfc/tfcx/compile.bat
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
@echo off
|
||||||
|
PATH=C:\gcc\bin;%PATH%
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
pause
|
363
dlls/tfc/tfcx/moduleconfig.cpp
Executable file
363
dlls/tfc/tfcx/moduleconfig.cpp
Executable file
|
@ -0,0 +1,363 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "tfcx.h"
|
||||||
|
|
||||||
|
funEventCall modMsgsEnd[MAX_REG_MSGS];
|
||||||
|
funEventCall modMsgs[MAX_REG_MSGS];
|
||||||
|
void (*function)(void*);
|
||||||
|
void (*endfunction)(void*);
|
||||||
|
CPlayer* mPlayer;
|
||||||
|
CPlayer players[33];
|
||||||
|
|
||||||
|
bool rankBots;
|
||||||
|
int pdTimerOwner;
|
||||||
|
int pdSentryGunOwner;
|
||||||
|
int pdAmmo[6];
|
||||||
|
|
||||||
|
int gmsgCurWeapon;
|
||||||
|
int gmsgDamage;
|
||||||
|
int gmsgDamage2;
|
||||||
|
int gmsgWeaponList;
|
||||||
|
int gmsgResetHUD;
|
||||||
|
int gmsgAmmoX;
|
||||||
|
int gmsgScoreInfo;
|
||||||
|
int gmsgAmmoPickup;
|
||||||
|
|
||||||
|
int mState;
|
||||||
|
int mPlayerIndex;
|
||||||
|
|
||||||
|
int iFDamage;
|
||||||
|
int iFDeath;
|
||||||
|
int iFGrenade;
|
||||||
|
|
||||||
|
RankSystem g_rank;
|
||||||
|
Grenades g_grenades;
|
||||||
|
|
||||||
|
cvar_t init_tfcstats_maxsize ={"tfcstats_maxsize","3500", 0 , 3500.0 };
|
||||||
|
cvar_t init_tfcstats_reset ={"tfcstats_reset","0"};
|
||||||
|
cvar_t init_tfcstats_rank ={"tfcstats_rank","0"};
|
||||||
|
cvar_t *tfcstats_rankbots;
|
||||||
|
cvar_t *tfcstats_pause;
|
||||||
|
|
||||||
|
cvar_t init_tfcstats_rankbots ={"tfcstats_rankbots","1"};
|
||||||
|
cvar_t init_tfcstats_pause = {"tfcstats_pause","0"};
|
||||||
|
cvar_t *tfcstats_maxsize;
|
||||||
|
cvar_t *tfcstats_reset;
|
||||||
|
cvar_t *tfcstats_rank;
|
||||||
|
|
||||||
|
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" , &gmsgDamage2,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 },
|
||||||
|
{ 0 , 0,0,false }
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||||
|
|
||||||
|
rankBots = (int)tfcstats_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 ) {
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||||
|
if ( !isModuleActive() ) // stats only
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time && pPlayer->ingame){
|
||||||
|
|
||||||
|
if ( !ignoreBots(pEntity) ){
|
||||||
|
pPlayer->clearStats = 0.0f;
|
||||||
|
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)tfcstats_maxsize->value) || ((int)tfcstats_reset->value == 1) ) {
|
||||||
|
CVAR_SET_FLOAT("tfcstats_reset",0.0);
|
||||||
|
g_rank.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("tfcstats") ) );
|
||||||
|
|
||||||
|
// clear custom weapons info
|
||||||
|
for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;i<TFCMAX_WEAPONS;i++)
|
||||||
|
weaponData[i].ammoSlot = false;
|
||||||
|
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
|
||||||
|
GET_PLAYER_POINTER(pEntity)->Connect(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)tfcstats_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 = NULL;
|
||||||
|
}
|
||||||
|
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 SetModel_Post(edict_t *e, const char *m){
|
||||||
|
if(e->v.owner && e->v.owner->v.flags&(FL_CLIENT | FL_FAKECLIENT)){
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
|
||||||
|
if ( !STRING(e->v.classname)[0] ){ // current weapon shot
|
||||||
|
if ( pPlayer->classId != TFC_PC_SOLDIER )
|
||||||
|
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) )){
|
||||||
|
GET_PLAYER_POINTER(e)->aiming = ptr->iHitgroup;
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( e->v.owner && e->v.owner->v.flags& (FL_CLIENT | FL_FAKECLIENT) ){
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER(e->v.owner);
|
||||||
|
for ( int i=0;i<MAX_TRACE;i++){
|
||||||
|
if ( strcmp( traceData[i].szName,STRING(e->v.classname)) == 0 ){
|
||||||
|
if ( traceData[i].iAction & ACT_NADE_SHOT ){
|
||||||
|
pPlayer->saveShot(traceData[i].iId);
|
||||||
|
}
|
||||||
|
if ( traceData[i].iAction & ACT_NADE_PUT ){
|
||||||
|
g_grenades.put(e,traceData[i].fDel,traceData[i].iId,GET_PLAYER_POINTER(e->v.owner));
|
||||||
|
}
|
||||||
|
if ( traceData[i].iAction & ACT_NADE_THROW ){
|
||||||
|
MF_ExecuteForward ( iFGrenade, pPlayer->index,ENTINDEX(e),traceData[i].iId );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FN_META_ATTACH() {
|
||||||
|
|
||||||
|
CVAR_REGISTER (&init_tfcstats_maxsize);
|
||||||
|
CVAR_REGISTER (&init_tfcstats_reset);
|
||||||
|
CVAR_REGISTER (&init_tfcstats_rank);
|
||||||
|
tfcstats_maxsize=CVAR_GET_POINTER(init_tfcstats_maxsize.name);
|
||||||
|
tfcstats_reset=CVAR_GET_POINTER(init_tfcstats_reset.name);
|
||||||
|
tfcstats_rank=CVAR_GET_POINTER(init_tfcstats_rank.name);
|
||||||
|
|
||||||
|
CVAR_REGISTER (&init_tfcstats_rankbots);
|
||||||
|
CVAR_REGISTER (&init_tfcstats_pause);
|
||||||
|
tfcstats_rankbots = CVAR_GET_POINTER(init_tfcstats_rankbots.name);
|
||||||
|
tfcstats_pause = CVAR_GET_POINTER(init_tfcstats_pause.name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FN_AMXX_ATTACH() {
|
||||||
|
|
||||||
|
MF_AddNatives( stats_Natives );
|
||||||
|
MF_AddNatives( base_Natives );
|
||||||
|
|
||||||
|
const char* path = get_localinfo("tfcstats_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("tfcstats") ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// set default PrivateData offsets
|
||||||
|
pdTimerOwner = PD_TIMER_OWNER;
|
||||||
|
pdSentryGunOwner = PD_SENTRY_OWNER;
|
||||||
|
pdAmmo[TFC_AMMO_SHELLS] = PD_AMMO_SHELLS;
|
||||||
|
pdAmmo[TFC_AMMO_BULLETS] = PD_AMMO_BULLETS;
|
||||||
|
pdAmmo[TFC_AMMO_CELLS] = PD_AMMO_CELLS;
|
||||||
|
pdAmmo[TFC_AMMO_ROCKETS] = PD_AMMO_ROCKETS;
|
||||||
|
pdAmmo[TFC_AMMO_NADE1] = PD_AMMO_NADE1;
|
||||||
|
pdAmmo[TFC_AMMO_NADE2] = PD_AMMO_NADE2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FN_AMXX_Detach() {
|
||||||
|
g_grenades.clear();
|
||||||
|
g_rank.clear();
|
||||||
|
g_rank.unloadCalc();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FN_AMXX_PLUGINSLOADED(){
|
||||||
|
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);
|
||||||
|
iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
|
}
|
462
dlls/tfc/tfcx/moduleconfig.h
Executable file
462
dlls/tfc/tfcx/moduleconfig.h
Executable file
|
@ -0,0 +1,462 @@
|
||||||
|
// Configuration
|
||||||
|
|
||||||
|
#ifndef __MODULECONFIG_H__
|
||||||
|
#define __MODULECONFIG_H__
|
||||||
|
|
||||||
|
// Module info
|
||||||
|
#define MODULE_NAME "TFCX"
|
||||||
|
#define MODULE_VERSION "0.1"
|
||||||
|
#define MODULE_AUTHOR "SidLuke"
|
||||||
|
#define MODULE_URL "www.amxmodx.org"
|
||||||
|
#define MODULE_LOGTAG "TFCX"
|
||||||
|
// 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 dettach
|
||||||
|
#define FN_AMXX_DETTACH OnAmxxDettach
|
||||||
|
// 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 dettach
|
||||||
|
#define FN_META_DETTACH OnMetaDettach
|
||||||
|
|
||||||
|
// (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__
|
157
dlls/tfc/tfcx/msvc/tfcx.dsp
Executable file
157
dlls/tfc/tfcx/msvc/tfcx.dsp
Executable file
|
@ -0,0 +1,157 @@
|
||||||
|
# Microsoft Developer Studio Project File - Name="tfcx" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||||
|
|
||||||
|
CFG=tfcx - 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 "tfcx.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 "tfcx.mak" CFG="tfcx - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "tfcx - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
|
!MESSAGE "tfcx - 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)" == "tfcx - 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 "tfcx_EXPORTS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /Zp4 /MT /W3 /GX /O2 /I "..\..\amxmodx" /I "..\..\metamod" /I "..\..\sdk\common" /I "..\..\sdk\engine" /I "..\..\sdk\dlls" /D "tfcx_EXPORTS" /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 /def:".\tfcx.def" /out:"release/tfcx_amx.dll"
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "tfcx - 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 "tfcx_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" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tfcx_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/tfcx_amxx.dll" /pdbtype:sept
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "tfcx - Win32 Release"
|
||||||
|
# Name "tfcx - 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=..\moduleconfig.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\NBase.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\NRank.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\usermsg.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\Utils.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=..\tfcx.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
|
30
dlls/tfc/tfcx/msvc/tfcx.dsw
Executable file
30
dlls/tfc/tfcx/msvc/tfcx.dsw
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "tfcx"=.\tfcx.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
109
dlls/tfc/tfcx/tfcx.h
Executable file
109
dlls/tfc/tfcx/tfcx.h
Executable file
|
@ -0,0 +1,109 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RANK_H
|
||||||
|
#define RANK_H
|
||||||
|
|
||||||
|
#include "amxxmodule.h"
|
||||||
|
#include "CMisc.h"
|
||||||
|
#include "CRank.h"
|
||||||
|
|
||||||
|
#define RANK_SVERSION "0.1"
|
||||||
|
|
||||||
|
#define GET_PLAYER_POINTER(e) (&players[ENTINDEX(e)])
|
||||||
|
#define GET_PLAYER_POINTER_I(i) (&players[i])
|
||||||
|
|
||||||
|
#ifndef GETPLAYERAUTHID
|
||||||
|
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
extern AMX_NATIVE_INFO stats_Natives[];
|
||||||
|
extern AMX_NATIVE_INFO base_Natives[];
|
||||||
|
|
||||||
|
extern weaponsVault weaponData[MAX_WEAPONS];
|
||||||
|
extern traceVault traceData[MAX_TRACE];
|
||||||
|
|
||||||
|
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 bool rankBots;
|
||||||
|
|
||||||
|
extern bool ignoreDamage;
|
||||||
|
|
||||||
|
extern int pdTimerOwner;
|
||||||
|
extern int pdSentryGunOwner;
|
||||||
|
extern int pdAmmo[6];
|
||||||
|
|
||||||
|
extern cvar_t *tfcstats_maxsize;
|
||||||
|
extern cvar_t* tfcstats_rank;
|
||||||
|
extern cvar_t* tfcstats_reset;
|
||||||
|
|
||||||
|
extern cvar_t* tfcstats_rankbots;
|
||||||
|
extern cvar_t* tfcstats_pause;
|
||||||
|
|
||||||
|
extern Grenades g_grenades;
|
||||||
|
|
||||||
|
extern RankSystem g_rank;
|
||||||
|
extern CPlayer players[33];
|
||||||
|
extern CPlayer* mPlayer;
|
||||||
|
extern int mPlayerIndex;
|
||||||
|
extern int mState;
|
||||||
|
|
||||||
|
extern int iFDamage;
|
||||||
|
extern int iFDeath;
|
||||||
|
extern int iFGrenade;
|
||||||
|
|
||||||
|
//extern int gmsgCurWeapon;
|
||||||
|
//extern int gmsgDamage;
|
||||||
|
//extern int gmsgWeaponList;
|
||||||
|
//extern int gmsgResetHUD;
|
||||||
|
//extern int gmsgAmmoX;
|
||||||
|
//extern int gmsgScoreInfo;
|
||||||
|
//extern int gmsgAmmoPickup;
|
||||||
|
|
||||||
|
void Client_AmmoX(void*);
|
||||||
|
void Client_CurWeapon(void*);
|
||||||
|
void Client_Damage(void*);
|
||||||
|
void Client_Damage_End(void*);
|
||||||
|
//void Client_WeaponList(void*);
|
||||||
|
void Client_AmmoPickup(void*);
|
||||||
|
void Client_ScoreInfo(void*);
|
||||||
|
void Client_ResetHUD(void*);
|
||||||
|
|
||||||
|
bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
|
||||||
|
bool isModuleActive();
|
||||||
|
|
||||||
|
#endif // TFCX_H
|
||||||
|
|
324
dlls/tfc/tfcx/usermsg.cpp
Executable file
324
dlls/tfc/tfcx/usermsg.cpp
Executable file
|
@ -0,0 +1,324 @@
|
||||||
|
/*
|
||||||
|
* TFCX
|
||||||
|
* Copyright (c) 2004 Lukasz Wlasinski
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 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 "amxxmodule.h"
|
||||||
|
#include "tfcx.h"
|
||||||
|
|
||||||
|
|
||||||
|
int damage;
|
||||||
|
int TA;
|
||||||
|
int weapon;
|
||||||
|
int aim;
|
||||||
|
CPlayer *pAttacker;
|
||||||
|
edict_t* tempEnt;
|
||||||
|
int tempInt;
|
||||||
|
bool ignoreDamage = false;
|
||||||
|
|
||||||
|
void Client_ResetHUD(void* mValue){
|
||||||
|
if ( mPlayer ){
|
||||||
|
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<<iId) ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
wpnList |= (1<<iId);
|
||||||
|
weaponData[iId].ammoSlot = iSlot;
|
||||||
|
strcpy(weaponData[iId].fullName, wpnName );
|
||||||
|
weaponData[iId].name = weaponData[iId].fullName;
|
||||||
|
|
||||||
|
char* wpnPrefix = strstr( weaponData[iId].fullName ,"tf_weapon_");
|
||||||
|
|
||||||
|
if ( wpnPrefix )
|
||||||
|
weaponData[iId].name = wpnPrefix + 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Client_Damage(void* mValue){
|
||||||
|
switch (mState++) {
|
||||||
|
case 1:
|
||||||
|
damage = *(int*)mValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
edict_t* enemy;
|
||||||
|
enemy = mPlayer->pEdict->v.dmg_inflictor;
|
||||||
|
if ( !mPlayer || !damage || FNullEnt( enemy ) ) break;
|
||||||
|
|
||||||
|
if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) { // attacker is player and his active weapon
|
||||||
|
|
||||||
|
pAttacker = GET_PLAYER_POINTER(enemy);
|
||||||
|
|
||||||
|
aim = pAttacker->aiming;
|
||||||
|
weapon = pAttacker->current;
|
||||||
|
|
||||||
|
switch(weapon){
|
||||||
|
case TFC_WPN_SPANNER:
|
||||||
|
case TFC_WPN_AXE:
|
||||||
|
case TFC_WPN_KNIFE:
|
||||||
|
pAttacker->saveShot(weapon); // melee , save shot too
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TFC_WPN_MEDIKIT:
|
||||||
|
if ( pAttacker->teamId == mPlayer->teamId ) // ???
|
||||||
|
ignoreDamage = true;
|
||||||
|
pAttacker->saveShot(weapon); // melee , save shot too
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pAttacker->saveHit( mPlayer , weapon , damage, aim);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( !FNullEnt( enemy->v.owner ) ){
|
||||||
|
if ( enemy->v.owner->v.flags & (FL_CLIENT | FL_FAKECLIENT) ){ // caltrop, empgrenade, gasgrenade, napalmgrenade
|
||||||
|
|
||||||
|
pAttacker = GET_PLAYER_POINTER(enemy->v.owner);
|
||||||
|
|
||||||
|
const char *szClass = STRING(enemy->v.classname);
|
||||||
|
|
||||||
|
switch(szClass[10]){
|
||||||
|
case 'c':
|
||||||
|
weapon = TFC_WPN_CALTROP;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
weapon = TFC_WPN_EMPGRENADE;
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
weapon = TFC_WPN_GASGRENADE;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
weapon = TFC_WPN_MEDIKIT;
|
||||||
|
if ( pAttacker->teamId == mPlayer->teamId ) // ???
|
||||||
|
ignoreDamage = true;
|
||||||
|
pAttacker->saveShot(weapon);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
weapon = TFC_WPN_NAPALMGRENADE;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
case 's':
|
||||||
|
case '_': // hmm...nailgun_nail, fastswitch and this one may not be true...
|
||||||
|
//PRINT_CONSOLE("Nail! Class:%d wpn:%d\n",pAttacker->classId,pAttacker->current);
|
||||||
|
weapon = pAttacker->current;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
weapon = TFC_WPN_FLAMETHROWER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( !weapon ) {
|
||||||
|
switch(szClass[3]){
|
||||||
|
case 'e':
|
||||||
|
weapon = TFC_WPN_TIMER; // TFC_WPN_MEDKIT ??
|
||||||
|
|
||||||
|
tempInt = *( (int*)mPlayer->pEdict->pvPrivateData + pdTimerOwner );
|
||||||
|
if (!tempInt)
|
||||||
|
break;
|
||||||
|
tempEnt = (edict_t*)tempInt;
|
||||||
|
pAttacker = GET_PLAYER_POINTER(tempEnt);
|
||||||
|
|
||||||
|
if ( pAttacker->teamId == mPlayer->teamId ) // ???
|
||||||
|
ignoreDamage = true;
|
||||||
|
|
||||||
|
pAttacker->saveShot(weapon); // ??? save shot too
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
weapon = TFC_WPN_FLAMES; // tf_fire
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( weapon )
|
||||||
|
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||||
|
//else
|
||||||
|
// PRINT_CONSOLE("*** DMG! Att:%d Vic:%d unknown weapon %s\n",pAttacker->index,mPlayer->index,STRING(enemy->v.classname));
|
||||||
|
}
|
||||||
|
// nailgrenadenail->nailgrenade->player :))) I'm the best !
|
||||||
|
else if ( !FNullEnt(enemy->v.owner->v.owner) && enemy->v.owner->v.owner->v.flags & (FL_CLIENT | FL_FAKECLIENT ) ){
|
||||||
|
pAttacker = GET_PLAYER_POINTER(enemy->v.owner->v.owner);
|
||||||
|
weapon = TFC_WPN_NAILGRENADE;
|
||||||
|
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // nailgrenade , mirvgrenade , normalgrenade , rockets
|
||||||
|
if ( strstr("sentrygun",STRING(enemy->v.classname)) ){
|
||||||
|
tempInt = *( (int*)enemy->pvPrivateData + pdSentryGunOwner );
|
||||||
|
if ( !tempInt )
|
||||||
|
break;
|
||||||
|
tempEnt = (edict_t*)tempInt;
|
||||||
|
pAttacker = GET_PLAYER_POINTER(tempEnt);
|
||||||
|
weapon = TFC_WPN_SENTRYGUN;
|
||||||
|
pAttacker->saveShot(weapon); // save shot too
|
||||||
|
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||||
|
}
|
||||||
|
else if( g_grenades.find(enemy , &pAttacker , &weapon ) ){
|
||||||
|
if ( weapon == TFC_WPN_RPG && pAttacker->classId == TFC_PC_PYRO ){
|
||||||
|
weapon = TFC_WPN_IC;
|
||||||
|
pAttacker->saveShot(weapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client_Damage_End(void* mValue){
|
||||||
|
if ( !damage )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !pAttacker )
|
||||||
|
pAttacker = mPlayer;
|
||||||
|
|
||||||
|
if ( !ignoreDamage ){
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
damage = 0;
|
||||||
|
aim = 0;
|
||||||
|
weapon = 0;
|
||||||
|
pAttacker = NULL;
|
||||||
|
ignoreDamage = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// SniperRifle, AC and AutoRifle ...
|
||||||
|
if ( mPlayer->classId == TFC_PC_HWGUY ){
|
||||||
|
if ( mPlayer->current == TFC_WPN_AC && mPlayer->weapons[mPlayer->current].ammo > *(int*)mValue && iAmmo == weaponData[mPlayer->current].ammoSlot )
|
||||||
|
mPlayer->saveShot(mPlayer->current);
|
||||||
|
}
|
||||||
|
else if ( mPlayer->classId == TFC_PC_SNIPER ){
|
||||||
|
if ( (mPlayer->current == TFC_WPN_SNIPERRIFLE || mPlayer->current == TFC_WPN_AUTORIFLE) && mPlayer->weapons[mPlayer->current].ammo > *(int*)mValue && iAmmo == weaponData[mPlayer->current].ammoSlot )
|
||||||
|
mPlayer->saveShot(mPlayer->current);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
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 iIndex;
|
||||||
|
static int iClass;
|
||||||
|
switch (mState++){
|
||||||
|
case 0:
|
||||||
|
iIndex = *(int*)mValue;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
iClass = *(int*)mValue;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if ( iIndex > 0 && iIndex <= gpGlobals->maxClients ){
|
||||||
|
GET_PLAYER_POINTER_I( iIndex )->teamId = *(int*)mValue;
|
||||||
|
GET_PLAYER_POINTER_I( iIndex )->classId = iClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user