mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 07:05:38 +03:00
Don't respawn if m_flRespawnPending isn't set
Minor refactoring
This commit is contained in:
parent
e199b16463
commit
0b517e036f
@ -533,3 +533,23 @@ void CCSPlayer::Reset()
|
|||||||
m_iWeaponInfiniteAmmo = 0;
|
m_iWeaponInfiniteAmmo = 0;
|
||||||
m_iWeaponInfiniteIds = 0;
|
m_iWeaponInfiniteIds = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCSPlayer::OnSpawn()
|
||||||
|
{
|
||||||
|
m_flRespawnPending = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCSPlayer::OnKilled()
|
||||||
|
{
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (forcerespawn.value > 0)
|
||||||
|
{
|
||||||
|
m_flRespawnPending = gpGlobals->time + forcerespawn.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetProtectionState() == ProtectionSt_Active)
|
||||||
|
{
|
||||||
|
BasePlayer()->RemoveSpawnProtection();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -2168,13 +2168,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
|
|||||||
BuyZoneIcon_Clear(this);
|
BuyZoneIcon_Clear(this);
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
if (forcerespawn.value > 0) {
|
CSPlayer()->OnKilled();
|
||||||
CSPlayer()->m_flRespawnPending = gpGlobals->time + forcerespawn.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active) {
|
|
||||||
RemoveSpawnProtection();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SetThink(&CBasePlayer::PlayerDeathThink);
|
SetThink(&CBasePlayer::PlayerDeathThink);
|
||||||
@ -5294,6 +5288,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)()
|
|||||||
m_idrowndmg = 0;
|
m_idrowndmg = 0;
|
||||||
m_idrownrestored = 0;
|
m_idrownrestored = 0;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
CSPlayer()->OnSpawn();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_iObserverC4State)
|
if (m_iObserverC4State)
|
||||||
{
|
{
|
||||||
m_iObserverC4State = 0;
|
m_iObserverC4State = 0;
|
||||||
@ -9800,7 +9798,9 @@ void CBasePlayer::PlayerRespawnThink()
|
|||||||
if (pev->deadflag < DEAD_DYING)
|
if (pev->deadflag < DEAD_DYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (forcerespawn.value > 0 && gpGlobals->time > CSPlayer()->m_flRespawnPending)
|
if (forcerespawn.value > 0 &&
|
||||||
|
CSPlayer()->m_flRespawnPending > 0 &&
|
||||||
|
CSPlayer()->m_flRespawnPending <= gpGlobals->time)
|
||||||
{
|
{
|
||||||
Spawn();
|
Spawn();
|
||||||
pev->button = 0;
|
pev->button = 0;
|
||||||
|
@ -96,6 +96,10 @@ public:
|
|||||||
virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
|
virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
void OnSpawn();
|
||||||
|
void OnKilled();
|
||||||
|
|
||||||
CBasePlayer *BasePlayer() const;
|
CBasePlayer *BasePlayer() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user