Fix a crash caused by warp on hit
This commit is contained in:
parent
d0165650e2
commit
9c2c096a1c
@ -511,8 +511,9 @@ class WarpHurtListener : public IGameEventListener2
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void FireGameEvent(IGameEvent *event)
|
virtual void FireGameEvent(IGameEvent *event)
|
||||||
{ // Not enabled
|
{
|
||||||
if (!enabled || !warp_on_damage)
|
// Not enabled
|
||||||
|
if (!isHackActive() || !enabled || !warp_on_damage)
|
||||||
return;
|
return;
|
||||||
// We have no warp
|
// We have no warp
|
||||||
if (!warp_amount)
|
if (!warp_amount)
|
||||||
@ -529,9 +530,19 @@ public:
|
|||||||
// Check if victim is local player
|
// Check if victim is local player
|
||||||
if (g_IEngine->GetPlayerForUserID(victim) != g_pLocalPlayer->entity_idx)
|
if (g_IEngine->GetPlayerForUserID(victim) != g_pLocalPlayer->entity_idx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Check if the entities are alive and valid
|
||||||
|
CachedEntity *att = ENTITY(attacker);
|
||||||
|
|
||||||
|
// Don't run if we (the victim) are invalid
|
||||||
|
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
||||||
|
return;
|
||||||
|
// Don't check weapon mode if the attacker is invalid
|
||||||
|
if (!CE_INVALID(att) && att->m_bAlivePlayer())
|
||||||
// Ignore projectiles for now
|
// Ignore projectiles for now
|
||||||
if (CE_VALID(ENTITY(attacker)) && GetWeaponMode(ENTITY(attacker)) == weapon_projectile)
|
if (CE_VALID(ENTITY(attacker)) && GetWeaponMode(ENTITY(attacker)) == weapon_projectile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We got hurt
|
// We got hurt
|
||||||
was_hurt = true;
|
was_hurt = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user