- Fix in need of testing in regards to the TK / TA bug detected
- Created a temp pointer as the first thing to do in the CurWpn function. This way if another message gets thrown while still in the middle of this function the global pointer to messaged player is not affected.
This commit is contained in:
parent
68f1ce7a52
commit
d1c42751cd
@ -60,13 +60,13 @@ extern int mState;
|
|||||||
extern int mPlayerIndex;
|
extern int mPlayerIndex;
|
||||||
|
|
||||||
void Client_CurWeapon(void*);
|
void Client_CurWeapon(void*);
|
||||||
void Client_Health_End(void*);
|
|
||||||
void Client_ResetHUD_End(void*);
|
void Client_ResetHUD_End(void*);
|
||||||
void Client_ObjScore(void*);
|
void Client_ObjScore(void*);
|
||||||
void Client_TeamScore(void*);
|
void Client_TeamScore(void*);
|
||||||
void Client_RoundState(void*);
|
void Client_RoundState(void*);
|
||||||
void Client_AmmoX(void*);
|
void Client_AmmoX(void*);
|
||||||
void Client_AmmoShort(void*);
|
void Client_AmmoShort(void*);
|
||||||
|
void Client_Health_End(void*);
|
||||||
|
|
||||||
// Zors
|
// Zors
|
||||||
//void WeaponList(void*);
|
//void WeaponList(void*);
|
||||||
@ -78,7 +78,6 @@ extern int AlliesScore;
|
|||||||
extern int AxisScore;
|
extern int AxisScore;
|
||||||
|
|
||||||
extern int gmsgCurWeapon;
|
extern int gmsgCurWeapon;
|
||||||
extern int gmsgHealth;
|
|
||||||
extern int gmsgResetHUD;
|
extern int gmsgResetHUD;
|
||||||
extern int gmsgObjScore;
|
extern int gmsgObjScore;
|
||||||
extern int gmsgRoundState;
|
extern int gmsgRoundState;
|
||||||
@ -87,12 +86,11 @@ extern int gmsgScoreShort;
|
|||||||
extern int gmsgPTeam;
|
extern int gmsgPTeam;
|
||||||
extern int gmsgAmmoX;
|
extern int gmsgAmmoX;
|
||||||
extern int gmsgAmmoShort;
|
extern int gmsgAmmoShort;
|
||||||
|
extern int gmsgHealth_End;
|
||||||
|
|
||||||
extern int iFDamage;
|
extern int iFDamage;
|
||||||
extern int iFDeath;
|
extern int iFDeath;
|
||||||
extern int iFScore;
|
extern int iFScore;
|
||||||
|
|
||||||
// Zors
|
|
||||||
extern int iFSpawnForward;
|
extern int iFSpawnForward;
|
||||||
extern int iFTeamForward;
|
extern int iFTeamForward;
|
||||||
extern int iFClassForward;
|
extern int iFClassForward;
|
||||||
|
@ -57,7 +57,6 @@ int iFTeamForward = -1;
|
|||||||
int iFClassForward = -1;
|
int iFClassForward = -1;
|
||||||
|
|
||||||
int gmsgCurWeapon;
|
int gmsgCurWeapon;
|
||||||
int gmsgHealth;
|
|
||||||
int gmsgResetHUD;
|
int gmsgResetHUD;
|
||||||
int gmsgObjScore;
|
int gmsgObjScore;
|
||||||
int gmsgRoundState;
|
int gmsgRoundState;
|
||||||
@ -66,6 +65,7 @@ int gmsgScoreShort;
|
|||||||
int gmsgPTeam;
|
int gmsgPTeam;
|
||||||
int gmsgAmmoX;
|
int gmsgAmmoX;
|
||||||
int gmsgAmmoShort;
|
int gmsgAmmoShort;
|
||||||
|
int gmsgHealth_End;
|
||||||
|
|
||||||
// Zors
|
// Zors
|
||||||
//int gmsgWeaponList;
|
//int gmsgWeaponList;
|
||||||
@ -90,22 +90,23 @@ struct sUserMsg {
|
|||||||
int* id;
|
int* id;
|
||||||
funEventCall func;
|
funEventCall func;
|
||||||
bool endmsg;
|
bool endmsg;
|
||||||
} g_user_msg[] = {
|
} g_user_msg[] =
|
||||||
{ "CurWeapon",&gmsgCurWeapon,Client_CurWeapon,false },
|
{
|
||||||
{ "ObjScore",&gmsgObjScore,Client_ObjScore,false },
|
{ "CurWeapon", &gmsgCurWeapon, Client_CurWeapon, false },
|
||||||
{ "RoundState",&gmsgRoundState,Client_RoundState,false },
|
{ "ObjScore", &gmsgObjScore, Client_ObjScore, false },
|
||||||
{ "Health",&gmsgHealth,Client_Health_End,true },
|
{ "RoundState", &gmsgRoundState, Client_RoundState, false },
|
||||||
{ "ResetHUD",&gmsgResetHUD,Client_ResetHUD_End,true },
|
{ "ResetHUD", &gmsgResetHUD, Client_ResetHUD_End, true },
|
||||||
{ "TeamScore",&gmsgTeamScore,Client_TeamScore,false },
|
{ "TeamScore", &gmsgTeamScore, Client_TeamScore, false },
|
||||||
{ "ScoreShort",&gmsgScoreShort,NULL,false },
|
{ "AmmoX", &gmsgAmmoX, Client_AmmoX, false },
|
||||||
{ "PTeam",&gmsgPTeam,NULL,false },
|
{ "AmmoShort", &gmsgAmmoShort, Client_AmmoShort, false },
|
||||||
{ "AmmoX",&gmsgAmmoX,Client_AmmoX,false},
|
{ "Health", &gmsgHealth_End, Client_Health_End, true },
|
||||||
{ "AmmoShort",&gmsgAmmoShort,Client_AmmoShort,false},
|
|
||||||
{ "ScoreShort",&gmsgScoreShort,NULL,false },
|
|
||||||
|
|
||||||
//Zors
|
//Zors
|
||||||
//{ "WeaponList",&gmsgWeaponList,WeaponList,true },
|
//{ "WeaponList", &gmsgWeaponList, WeaponList, true },
|
||||||
//{ "WeaponList",&gmsgWeaponList_End,WeaponList_End,true },
|
//{ "WeaponList", &gmsgWeaponList_End, WeaponList_End, true },
|
||||||
|
|
||||||
|
{ "PTeam", &gmsgPTeam, NULL, false },
|
||||||
|
{ "ScoreShort", &gmsgScoreShort, NULL, false },
|
||||||
|
|
||||||
{ 0,0,0,false }
|
{ 0,0,0,false }
|
||||||
};
|
};
|
||||||
@ -440,8 +441,6 @@ void OnPluginsLoaded()
|
|||||||
iFDeath = MF_RegisterForward("client_death",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
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);
|
iFDamage = MF_RegisterForward("client_damage",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
iFScore = MF_RegisterForward("client_score",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
iFScore = MF_RegisterForward("client_score",ET_IGNORE,FP_CELL,FP_CELL,FP_CELL,FP_DONE);
|
||||||
|
|
||||||
// Zors
|
|
||||||
iFTeamForward = MF_RegisterForward("dod_client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*team*/,FP_CELL/*oldteam*/,FP_DONE);
|
iFTeamForward = MF_RegisterForward("dod_client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*team*/,FP_CELL/*oldteam*/,FP_DONE);
|
||||||
iFSpawnForward = MF_RegisterForward("dod_client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
iFSpawnForward = MF_RegisterForward("dod_client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
||||||
iFClassForward = MF_RegisterForward("dod_client_changeclass",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*class*/,FP_CELL/*oldclass*/,FP_DONE);
|
iFClassForward = MF_RegisterForward("dod_client_changeclass",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*class*/,FP_CELL/*oldclass*/,FP_DONE);
|
||||||
|
@ -141,67 +141,6 @@ void Client_CurWeapon(void* mValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Nie ma damage event ...
|
|
||||||
*/
|
|
||||||
void Client_Health_End(void* mValue){
|
|
||||||
|
|
||||||
if ( !isModuleActive() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
edict_t *enemy = mPlayer->pEdict->v.dmg_inflictor;
|
|
||||||
int damage = (int)mPlayer->pEdict->v.dmg_take;
|
|
||||||
|
|
||||||
if ( !mPlayer || !damage || !enemy )
|
|
||||||
return;
|
|
||||||
|
|
||||||
int weapon = 0;
|
|
||||||
int aim = 0;
|
|
||||||
|
|
||||||
mPlayer->pEdict->v.dmg_take = 0.0;
|
|
||||||
|
|
||||||
CPlayer* pAttacker = NULL;
|
|
||||||
|
|
||||||
if ( enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) )
|
|
||||||
{
|
|
||||||
pAttacker = GET_PLAYER_POINTER(enemy);
|
|
||||||
weapon = pAttacker->current;
|
|
||||||
|
|
||||||
if ( weaponData[weapon].needcheck )
|
|
||||||
weapon = get_weaponid(pAttacker);
|
|
||||||
|
|
||||||
aim = pAttacker->aiming;
|
|
||||||
|
|
||||||
if ( weaponData[weapon].melee )
|
|
||||||
pAttacker->saveShot(weapon);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_grenades.find( enemy , &pAttacker , weapon );
|
|
||||||
|
|
||||||
int TA = 0;
|
|
||||||
|
|
||||||
if ( !pAttacker )
|
|
||||||
{
|
|
||||||
pAttacker = mPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( pAttacker->index != mPlayer->index )
|
|
||||||
{
|
|
||||||
pAttacker->saveHit( mPlayer , weapon , damage, aim );
|
|
||||||
|
|
||||||
if ( mPlayer->pEdict->v.team == pAttacker->pEdict->v.team )
|
|
||||||
TA = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
MF_ExecuteForward( iFDamage, pAttacker->index, mPlayer->index, damage, weapon, aim, TA );
|
|
||||||
|
|
||||||
if ( !mPlayer->IsAlive() )
|
|
||||||
{
|
|
||||||
pAttacker->saveKill(mPlayer,weapon,( aim == 1 ) ? 1:0 ,TA);
|
|
||||||
MF_ExecuteForward( iFDeath, pAttacker->index, mPlayer->index, weapon, aim, TA );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client_AmmoX(void* mValue)
|
void Client_AmmoX(void* mValue)
|
||||||
{
|
{
|
||||||
static int iAmmo;
|
static int iAmmo;
|
||||||
@ -241,6 +180,67 @@ void Client_AmmoShort(void* mValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client_Health_End(void* mValue)
|
||||||
|
{
|
||||||
|
if ( !isModuleActive() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
CPlayer* pVictim = mPlayer;
|
||||||
|
|
||||||
|
edict_t *enemy = pVictim->pEdict->v.dmg_inflictor;
|
||||||
|
int damage = (int)pVictim->pEdict->v.dmg_take;
|
||||||
|
|
||||||
|
if(!pVictim || !damage || !enemy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int weapon = 0;
|
||||||
|
int aim = 0;
|
||||||
|
|
||||||
|
pVictim->pEdict->v.dmg_take = 0.0;
|
||||||
|
|
||||||
|
CPlayer* pAttacker = NULL;
|
||||||
|
|
||||||
|
if(enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT))
|
||||||
|
{
|
||||||
|
pAttacker = GET_PLAYER_POINTER(enemy);
|
||||||
|
weapon = pAttacker->current;
|
||||||
|
|
||||||
|
if(weaponData[weapon].needcheck)
|
||||||
|
weapon = get_weaponid(pAttacker);
|
||||||
|
|
||||||
|
aim = pAttacker->aiming;
|
||||||
|
|
||||||
|
if(weaponData[weapon].melee)
|
||||||
|
pAttacker->saveShot(weapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
g_grenades.find(enemy , &pAttacker , weapon);
|
||||||
|
|
||||||
|
int TA = 0;
|
||||||
|
|
||||||
|
if(!pAttacker)
|
||||||
|
{
|
||||||
|
pAttacker = pVictim;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pAttacker->index != pVictim->index)
|
||||||
|
{
|
||||||
|
pAttacker->saveHit(pVictim , weapon , damage, aim);
|
||||||
|
|
||||||
|
if(pVictim->pEdict->v.team == pAttacker->pEdict->v.team)
|
||||||
|
TA = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
MF_ExecuteForward(iFDamage, pAttacker->index, pVictim->index, damage, weapon, aim, TA);
|
||||||
|
|
||||||
|
if(!pVictim->IsAlive())
|
||||||
|
{
|
||||||
|
pAttacker->saveKill(pVictim, weapon, (aim == 1) ? 1:0 , TA);
|
||||||
|
MF_ExecuteForward(iFDeath, pAttacker->index, pVictim->index, weapon, aim, TA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Working on being able to modify and switch weapons as they are sent to the client
|
Working on being able to modify and switch weapons as they are sent to the client
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user