mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
fixed null weapon problems in get_user_astats
This commit is contained in:
parent
1a2ef38588
commit
8589f0bcf5
@ -130,7 +130,7 @@ void RankSystem::clear(){
|
|||||||
|
|
||||||
bool RankSystem::loadCalc(const char* filename, char* error)
|
bool RankSystem::loadCalc(const char* filename, char* error)
|
||||||
{
|
{
|
||||||
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
|
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.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
|
||||||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=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_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
|
||||||
@ -305,5 +305,4 @@ void RankSystem::saveRank( const char* filename )
|
|||||||
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
|
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
|
||||||
|
|
||||||
fclose(bfp);
|
fclose(bfp);
|
||||||
}
|
}
|
||||||
|
|
@ -119,5 +119,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -26,7 +26,6 @@ bool rankBots;
|
|||||||
int gmsgCurWeapon;
|
int gmsgCurWeapon;
|
||||||
int gmsgDeathMsg;
|
int gmsgDeathMsg;
|
||||||
int gmsgDamage;
|
int gmsgDamage;
|
||||||
int gmsgDamageEnd;
|
|
||||||
int gmsgWeaponList;
|
int gmsgWeaponList;
|
||||||
int gmsgResetHUD;
|
int gmsgResetHUD;
|
||||||
int gmsgAmmoX;
|
int gmsgAmmoX;
|
||||||
@ -57,7 +56,6 @@ struct sUserMsg {
|
|||||||
} g_user_msg[] = {
|
} g_user_msg[] = {
|
||||||
{ "CurWeapon" , &gmsgCurWeapon , Client_CurWeapon, false },
|
{ "CurWeapon" , &gmsgCurWeapon , Client_CurWeapon, false },
|
||||||
{ "Damage" , &gmsgDamage,Client_Damage, false },
|
{ "Damage" , &gmsgDamage,Client_Damage, false },
|
||||||
{ "Damage" , &gmsgDamageEnd, Client_Damage_End, true },
|
|
||||||
{ "WeaponList" , &gmsgWeaponList, Client_WeaponList, false },
|
{ "WeaponList" , &gmsgWeaponList, Client_WeaponList, false },
|
||||||
{ "ResetHUD" , &gmsgResetHUD,Client_ResetHUD, true },
|
{ "ResetHUD" , &gmsgResetHUD,Client_ResetHUD, true },
|
||||||
{ "AmmoX" , &gmsgAmmoX, Client_AmmoX , false },
|
{ "AmmoX" , &gmsgAmmoX, Client_AmmoX , false },
|
||||||
@ -289,7 +287,7 @@ void OnMetaAttach() {
|
|||||||
|
|
||||||
void OnAmxxAttach(){
|
void OnAmxxAttach(){
|
||||||
MF_AddNatives(stats_Natives);
|
MF_AddNatives(stats_Natives);
|
||||||
const char* path = get_localinfo("csstats_score","addons/amxmodx/data/csstats.amxx");
|
const char* path = get_localinfo("csstats_score");
|
||||||
if ( path && *path )
|
if ( path && *path )
|
||||||
{
|
{
|
||||||
char error[128];
|
char error[128];
|
||||||
@ -299,7 +297,7 @@ void OnAmxxAttach(){
|
|||||||
if ( !g_rank.begin() )
|
if ( !g_rank.begin() )
|
||||||
{
|
{
|
||||||
g_rank.loadRank( MF_BuildPathname("%s",
|
g_rank.loadRank( MF_BuildPathname("%s",
|
||||||
get_localinfo("csstats","addons/amxmodx/data/csstats.dat") ) );
|
get_localinfo("csstats") ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ extern int mPlayerIndex;
|
|||||||
extern int mState;
|
extern int mState;
|
||||||
|
|
||||||
extern int gmsgCurWeapon;
|
extern int gmsgCurWeapon;
|
||||||
extern int gmsgDamageEnd;
|
|
||||||
extern int gmsgDamage;
|
extern int gmsgDamage;
|
||||||
extern int gmsgWeaponList;
|
extern int gmsgWeaponList;
|
||||||
extern int gmsgResetHUD;
|
extern int gmsgResetHUD;
|
||||||
@ -69,7 +68,6 @@ void Client_CurWeapon(void*);
|
|||||||
void Client_Damage(void*);
|
void Client_Damage(void*);
|
||||||
void Client_WeaponList(void*);
|
void Client_WeaponList(void*);
|
||||||
void Client_AmmoPickup(void*);
|
void Client_AmmoPickup(void*);
|
||||||
void Client_Damage_End(void*);
|
|
||||||
void Client_ScoreInfo(void*);
|
void Client_ScoreInfo(void*);
|
||||||
void Client_ResetHUD(void*);
|
void Client_ResetHUD(void*);
|
||||||
|
|
||||||
|
@ -5,12 +5,6 @@
|
|||||||
|
|
||||||
weaponsVault weaponData[MAX_WEAPONS];
|
weaponsVault weaponData[MAX_WEAPONS];
|
||||||
|
|
||||||
int damage;
|
|
||||||
int TK;
|
|
||||||
int weapon;
|
|
||||||
int aim;
|
|
||||||
CPlayer *pAttacker;
|
|
||||||
|
|
||||||
int g_Planter;
|
int g_Planter;
|
||||||
int g_Defuser;
|
int g_Defuser;
|
||||||
|
|
||||||
@ -52,6 +46,12 @@ void Client_WeaponList(void* mValue){
|
|||||||
|
|
||||||
void Client_Damage(void* mValue){
|
void Client_Damage(void* mValue){
|
||||||
static int bits;
|
static int bits;
|
||||||
|
static int damage;
|
||||||
|
static int TK;
|
||||||
|
static int weapon;
|
||||||
|
static int aim;
|
||||||
|
static CPlayer *pAttacker;
|
||||||
|
|
||||||
switch (mState++) {
|
switch (mState++) {
|
||||||
case 1:
|
case 1:
|
||||||
damage = *(int*)mValue;
|
damage = *(int*)mValue;
|
||||||
@ -79,19 +79,16 @@ void Client_Damage(void* mValue){
|
|||||||
}
|
}
|
||||||
if( g_grenades.find(enemy , &pAttacker , &weapon ) )
|
if( g_grenades.find(enemy , &pAttacker , &weapon ) )
|
||||||
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
||||||
}
|
break;
|
||||||
}
|
case 4:
|
||||||
|
|
||||||
void Client_Damage_End(void* mValue){
|
|
||||||
if ( !mPlayer || !damage || mPlayer->IsAlive() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( !pAttacker )
|
if ( !pAttacker )
|
||||||
pAttacker = mPlayer;
|
pAttacker = mPlayer;
|
||||||
TK = 0;
|
TK = 0;
|
||||||
if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) )
|
if ( (mPlayer->teamId == pAttacker->teamId) && (mPlayer != pAttacker) )
|
||||||
TK = 1;
|
TK = 1;
|
||||||
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TK);
|
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client_CurWeapon(void* mValue){
|
void Client_CurWeapon(void* mValue){
|
||||||
|
Loading…
Reference in New Issue
Block a user