diff --git a/dlls/csstats2/amxx_package/csstats.inc b/dlls/csstats2/amxx_package/csstats.inc index 499adb31..1a9b9bfd 100755 --- a/dlls/csstats2/amxx_package/csstats.inc +++ b/dlls/csstats2/amxx_package/csstats.inc @@ -60,58 +60,3 @@ native get_statsnum(); */ native get_user_stats2(index,stats[4]); native get_stats2(index,stats[4]); - -/* -* Forwards -*/ - -forward grenade_throw( index,greindex,wId ); - -enum { - CSF_DAMAGE = 0, - CSF_DEATH, -} - -/************* Shared Natives Start ********************************/ - -/* Forward types */ -enum { - XMF_DAMAGE = 0, - XMF_DEATH, -} - -/* Use this function to register forwards */ -native register_statsfwd( ftype ); - -/* Function is called after player to player attacks , -* if players were damaged by teammate TA is set to 1 */ -forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA); - -/* Function is called after player death , -* if player was killed by teammate TK is set to 1 */ -forward client_death(killer,victim,wpnindex,hitplace,TK); - -/* Custom Weapon Support */ -/* function will return index of new weapon */ -native custom_weapon_add( wpnname[],melee = 0,logname[]="" ); -/* Function will pass damage done by this custom weapon to stats module and other plugins */ -native custom_weapon_dmg( weapon, att, vic, damage, hitplace=0 ); -/* Function will pass info about custom weapon shot to stats module */ -native custom_weapon_shot( weapon,index ); // weapon id , player id - -/* function will return 1 if true */ -native xmod_is_melee_wpn(wpnindex); - -/* Returns weapon name. */ -native xmod_get_wpnname(wpnindex,name[],len); - -/* Returns weapon logname. */ -native xmod_get_wpnlogname(wpnindex,name[],len); - -/* Returns weapons array size */ -native xmod_get_maxweapons(); - -/* Returns stats array size */ -native xmod_get_stats_size(); - -/************* Shared Natives End ********************************/ diff --git a/dlls/csstats2/amxx_package/stats_test.sma b/dlls/csstats2/amxx_package/stats_test.sma deleted file mode 100755 index 32e6f3e2..00000000 --- a/dlls/csstats2/amxx_package/stats_test.sma +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -public plugin_init() { - register_plugin("Stats Test","0.1","SidLuke") - register_statsfwd( CSF_DAMAGE ) - register_statsfwd( CSF_DEATH ) -} - -public client_damage( attacker,victim,damage,wpnindex,hitplace,TA ){ - client_print(0 /*attacker*/,print_console,"DAMAGE: att:%d vic:%d dmg:%d wpn:%d aim:%d TA:%d", - attacker,victim,damage,wpnindex,hitplace,TA) - return PLUGIN_CONTINUE -} - -public client_death( killer,victim,wpnindex,hitplace,TK ){ - client_print(0 /*killer*/,print_console,"DEATH: att:%d vic:%d wpn:%d aim:%d TK:%d", - killer,victim,wpnindex,hitplace,TK) - return PLUGIN_CONTINUE -} \ No newline at end of file diff --git a/dlls/csstats2/csstats/CMisc.cpp b/dlls/csstats2/csstats/CMisc.cpp index a9569a77..8350b326 100755 --- a/dlls/csstats2/csstats/CMisc.cpp +++ b/dlls/csstats2/csstats/CMisc.cpp @@ -242,48 +242,6 @@ void CPlayer::saveBDefused(){ life.bDefused++; } - -// ***************************************************** -// class Forward -// ***************************************************** - -void Forward::put( AMX *a , int i ){ - head = new AmxCall( a, i , head ); -} - - -void Forward::clear(){ - while ( head ) { - AmxCall* a = head->next; - delete head; - head = a; - } -} - -void Forward::exec(int p1,int p2,int p3,int p4,int p5,int p6){ - AmxCall* a = head; - while ( a ){ - MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 6,p1, p2, p3, p4, p5, p6); - a = a->next; - } -} - -void Forward::exec(int p1,int p2,int p3,int p4,int p5){ - AmxCall* a = head; - while ( a ){ - MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 5,p1, p2, p3, p4, p5); - a = a->next; - } -} - -void Forward::exec(int p1,int p2){ - AmxCall* a = head; - while ( a ){ - MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 2,p1, p2); - a = a->next; - } -} - // ***************************************************** bool ignoreBots (edict_t *pEnt, edict_t *pOther){ diff --git a/dlls/csstats2/csstats/CMisc.h b/dlls/csstats2/csstats/CMisc.h index d13122f5..1aff4c81 100755 --- a/dlls/csstats2/csstats/CMisc.h +++ b/dlls/csstats2/csstats/CMisc.h @@ -6,7 +6,6 @@ #include "amxxmodule.h" #include "CRank.h" -#define MAX_CWEAPONS 6 #define CSW_HEGRENADE 4 #define CSW_SMOKEGRENADE 9 @@ -32,10 +31,10 @@ struct CPlayer { int clip; }; - PlayerWeapon weapons[MAX_WEAPONS+MAX_CWEAPONS]; + PlayerWeapon weapons[MAX_WEAPONS]; PlayerWeapon attackers[33]; PlayerWeapon victims[33]; - Stats weaponsRnd[MAX_WEAPONS+MAX_CWEAPONS]; // DEC-Weapon (Round) stats + Stats weaponsRnd[MAX_WEAPONS]; // DEC-Weapon (Round) stats Stats life; int teamId; @@ -87,28 +86,6 @@ public: void clear(); }; -// ***************************************************** -// class Forward -// ***************************************************** - -class Forward -{ - struct AmxCall { - AMX *amx; - int iFunctionIdx; - AmxCall* next; - AmxCall( AMX *a , int i, AmxCall* n ): amx(a), iFunctionIdx(i), next(n) {} - } *head; -public: - Forward() { head = 0; } - ~Forward() { clear(); } - void clear(); - void put( AMX *a , int i ); - void exec(int p1,int p2,int p3,int p4,int p5,int p6); - void exec(int p1,int p2,int p3,int p4,int p5); - void exec(int p1,int p2); -}; - #endif // CMISC_H diff --git a/dlls/csstats2/csstats/meta_api.cpp b/dlls/csstats2/csstats/meta_api.cpp index db7386e1..a34ee0b1 100755 --- a/dlls/csstats2/csstats/meta_api.cpp +++ b/dlls/csstats2/csstats/meta_api.cpp @@ -21,11 +21,6 @@ RankSystem g_rank; Grenades g_grenades; -Forward g_death_info; -Forward g_damage_info; - -int iFGrenade; - bool rankBots; int gmsgCurWeapon; @@ -143,13 +138,6 @@ void ServerDeactivate() { } g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) ); - g_damage_info.clear(); - g_death_info.clear(); - - // clear custom weapons info - for ( i=MAX_WEAPONS;iv.owner); switch(m[9]){ case 'h': - w_id = CSW_HEGRENADE; - g_grenades.put(e, 1.75, 4, pPlayer); - pPlayer->saveShot(4); - break; - case 'f': - if (m[10]=='l') w_id = CSW_FLASHBANG; - break; - case 's': - if (m[10]=='m') w_id = CSW_SMOKEGRENADE; + g_grenades.put(e, 1.75, CSW_HEGRENADE, pPlayer); + pPlayer->saveShot(CSW_HEGRENADE); break; } - if ( w_id ) - MF_ExecuteForward( iFGrenade, pPlayer->index, ENTINDEX(e) ,w_id ); } - RETURN_META(MRES_IGNORED); } @@ -331,7 +308,3 @@ void OnAmxxDetach() { g_rank.clear(); g_rank.unloadCalc(); } - -void OnPluginsLoaded(){ - iFGrenade = MF_RegisterForward("grenade_throw",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE); -} \ No newline at end of file diff --git a/dlls/csstats2/csstats/moduleconfig.h b/dlls/csstats2/csstats/moduleconfig.h index cb84b383..1502ecf0 100755 --- a/dlls/csstats2/csstats/moduleconfig.h +++ b/dlls/csstats2/csstats/moduleconfig.h @@ -32,7 +32,7 @@ #define FN_AMXX_DETACH OnAmxxDetach // All plugins loaded // Do forward functions init here (MF_RegisterForward) -#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) @@ -456,7 +456,6 @@ // #define FN_GameShutdown_Post GameShutdown_Post // #define FN_ShouldCollide_Post ShouldCollide_Post - #endif // USE_METAMOD #endif // __MODULECONFIG_H__ \ No newline at end of file diff --git a/dlls/csstats2/csstats/rank.cpp b/dlls/csstats2/csstats/rank.cpp index 2a87a214..462a5db2 100755 --- a/dlls/csstats2/csstats/rank.cpp +++ b/dlls/csstats2/csstats/rank.cpp @@ -273,170 +273,6 @@ static cell AMX_NATIVE_CALL get_statsnum(AMX *amx, cell *params) return g_rank.getRankNum(); } -static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0 - int i; - bool bFree = false; - for ( i=MAX_WEAPONS;i= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){ // only for custom weapons - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); - return 0; - } - - int att = params[2]; - if (att<1||att>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int vic = params[3]; - if (vic<1||vic>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int dmg = params[4]; - if ( dmg<1 ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int aim = params[5]; - if ( aim < 0 || aim > 7 ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - CPlayer* pAtt = GET_PLAYER_POINTER_I(att); - CPlayer* pVic = GET_PLAYER_POINTER_I(vic); - - pVic->pEdict->v.dmg_inflictor = NULL; - pAtt->saveHit( pVic , weapon , dmg, aim ); - - if ( !pAtt ) pAtt = pVic; - int TA = 0; - if ( (pVic->teamId == pAtt->teamId) && ( pVic != pAtt) ) - TA = 1; - g_damage_info.exec( pAtt->index, pVic->index, dmg, weapon, aim, TA ); - - if ( pVic->IsAlive() ) - return 1; - - pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA); - g_death_info.exec( pAtt->index, pVic->index, weapon, aim, TA ); - - return 1; -} - -static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[2]; - if (index<1||index>gpGlobals->maxClients){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - - int weapon = params[1]; - if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); - return 0; - } - - CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - pPlayer->saveShot(weapon); - - return 1; -} - -static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){ - int id = params[1]; - if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); - return 0; - } - return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]); -} - -static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){ - int id = params[1]; - if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); - return 0; - } - return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]); -} - -static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){ - int id = params[1]; - if (id<0 || id>=MAX_WEAPONS+MAX_CWEAPONS ){ - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); - return 0; - } - if ( id = 29 ) - return 1; - return weaponData[id].melee ? 1:0; -} - -static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward - int iFunctionIndex; - switch( params[1] ){ - case 0: - if( MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex) == AMX_ERR_NONE ) - g_damage_info.put( amx , iFunctionIndex ); - else - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - break; - case 1: - if( MF_AmxFindPublic(amx, "client_death", &iFunctionIndex) == AMX_ERR_NONE ) - g_death_info.put( amx , iFunctionIndex ); - else - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - break; - default: - MF_RaiseAmxError(amx,AMX_ERR_NATIVE); - return 0; - } - return 1; -} - -static cell AMX_NATIVE_CALL get_maxweapons(AMX *amx, cell *params){ - return MAX_WEAPONS+MAX_CWEAPONS; -} - -static cell AMX_NATIVE_CALL get_stats_size(AMX *amx, cell *params){ - return 8; -} - AMX_NATIVE_INFO stats_Natives[] = { { "get_stats", get_stats}, { "get_stats2", get_stats2}, @@ -451,19 +287,6 @@ AMX_NATIVE_INFO stats_Natives[] = { { "get_user_wstats", get_user_wstats}, { "reset_user_wstats", reset_user_wstats }, - // Custom Weapon Support - { "custom_weapon_add", register_cwpn }, - { "custom_weapon_dmg", custom_wpn_dmg }, - { "custom_weapon_shot", custom_wpn_shot }, - - { "xmod_get_wpnname", get_wpnname }, - { "xmod_get_wpnlogname", get_wpnlogname }, - { "xmod_is_melee_wpn", is_melee }, - { "xmod_get_maxweapons", get_maxweapons }, - { "xmod_get_stats_size", get_stats_size }, - - { "register_statsfwd",register_forward }, - ///******************* { NULL, NULL } }; diff --git a/dlls/csstats2/csstats/rank.h b/dlls/csstats2/csstats/rank.h index 5d3391c7..60894885 100755 --- a/dlls/csstats2/csstats/rank.h +++ b/dlls/csstats2/csstats/rank.h @@ -19,21 +19,14 @@ extern AMX_NATIVE_INFO stats_Natives[]; struct weaponsVault { char* name; - char* logname; short int ammoSlot; - bool melee; }; extern bool rankBots; extern cvar_t* csstats_rankbots; extern cvar_t* csstats_pause; -extern Forward g_death_info; -extern Forward g_damage_info; - -extern int iFGrenade; - -extern weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS]; +extern weaponsVault weaponData[MAX_WEAPONS]; typedef void (*funEventCall)(void*); extern funEventCall modMsgsEnd[MAX_REG_MSGS]; diff --git a/dlls/csstats2/csstats/usermsg.cpp b/dlls/csstats2/csstats/usermsg.cpp index 5edbbe5f..cc528d95 100755 --- a/dlls/csstats2/csstats/usermsg.cpp +++ b/dlls/csstats2/csstats/usermsg.cpp @@ -3,7 +3,7 @@ #include "amxxmodule.h" #include "rank.h" -weaponsVault weaponData[MAX_WEAPONS+MAX_CWEAPONS]; +weaponsVault weaponData[MAX_WEAPONS]; int damage; int TA; @@ -46,7 +46,6 @@ void Client_WeaponList(void* mValue){ weaponData[iId].name = wpnPrefix + 7; if ( strcmp( weaponData[iId].name, "hegrenade" ) == 0 ) weaponData[iId].name += 2; - weaponData[iId].logname = weaponData[iId].name; } } } @@ -91,12 +90,9 @@ void Client_Damage_End(void* mValue){ TA = 0; if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) ) TA = 1; - - g_damage_info.exec( pAttacker->index , mPlayer->index , damage, weapon, aim, TA ); if ( !mPlayer->IsAlive() ){ pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA); - g_death_info.exec( pAttacker->index, mPlayer->index, weapon, aim, TA ); } } @@ -135,7 +131,6 @@ void Client_AmmoX(void* mValue){ } } - void Client_AmmoPickup(void* mValue){ static int iSlot; switch (mState++){