fix: Reset immunity effects always (#788)

* Reset immunity effects always

* add new member m_bSpawnProtectionEffects
This commit is contained in:
Vaqtincha 2022-12-15 18:04:34 +05:00 committed by GitHub
parent cf8deb9cac
commit 980162774a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -541,6 +541,7 @@ void CCSPlayer::Reset()
m_bGameForcingRespawn = false; m_bGameForcingRespawn = false;
m_bAutoBunnyHopping = false; m_bAutoBunnyHopping = false;
m_bMegaBunnyJumping = false; m_bMegaBunnyJumping = false;
m_bSpawnProtectionEffects = false;
} }
void CCSPlayer::OnSpawn() void CCSPlayer::OnSpawn()

View File

@ -10247,6 +10247,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0) if (respawn_immunity_effects.value > 0)
{ {
CSPlayer()->m_bSpawnProtectionEffects = true;
pev->rendermode = kRenderTransAdd; pev->rendermode = kRenderTransAdd;
pev->renderamt = 100.0f; pev->renderamt = 100.0f;
@ -10268,12 +10269,11 @@ LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RemoveSpawnProtection)
void CBasePlayer::__API_HOOK(RemoveSpawnProtection)() void CBasePlayer::__API_HOOK(RemoveSpawnProtection)()
{ {
#ifdef REGAMEDLL_ADD #ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0) if (CSPlayer()->m_bSpawnProtectionEffects)
{ {
if (pev->rendermode == kRenderTransAdd && if (pev->rendermode == kRenderTransAdd && pev->renderamt == 100.0f)
pev->renderamt == 100.0f)
{ {
pev->renderamt = 255.0f; pev->renderamt = 255.0f;
pev->rendermode = kRenderNormal; pev->rendermode = kRenderNormal;
} }
@ -10281,6 +10281,8 @@ void CBasePlayer::__API_HOOK(RemoveSpawnProtection)()
WRITE_BYTE(STATUSICON_HIDE); WRITE_BYTE(STATUSICON_HIDE);
WRITE_STRING("suithelmet_full"); WRITE_STRING("suithelmet_full");
MESSAGE_END(); MESSAGE_END();
CSPlayer()->m_bSpawnProtectionEffects = false;
} }
CSPlayer()->m_flSpawnProtectionEndTime = 0.0f; CSPlayer()->m_flSpawnProtectionEndTime = 0.0f;

View File

@ -49,7 +49,8 @@ public:
m_bGameForcingRespawn(false), m_bGameForcingRespawn(false),
m_bAutoBunnyHopping(false), m_bAutoBunnyHopping(false),
m_bMegaBunnyJumping(false), m_bMegaBunnyJumping(false),
m_bPlantC4Anywhere(false) m_bPlantC4Anywhere(false),
m_bSpawnProtectionEffects(false)
{ {
m_szModel[0] = '\0'; m_szModel[0] = '\0';
} }
@ -131,6 +132,7 @@ public:
bool m_bAutoBunnyHopping; bool m_bAutoBunnyHopping;
bool m_bMegaBunnyJumping; bool m_bMegaBunnyJumping;
bool m_bPlantC4Anywhere; bool m_bPlantC4Anywhere;
bool m_bSpawnProtectionEffects;
}; };
// Inlines // Inlines