From 411a02843ead65fdafb7f88ed6643eff1946763b Mon Sep 17 00:00:00 2001 From: justgo97 Date: Tue, 13 Aug 2019 23:25:38 +0200 Subject: [PATCH] Fix c4 defuse glitch (#383) * [WIP] Fix c4 defuse glitch While you are defusing you can unpress E and a friend can continue to defuse for you --- regamedll/dlls/ggrenade.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index d6516113..188c1a5c 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -1021,9 +1021,9 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused) // if the defuse process has ended, kill the c4 if (m_pBombDefuser->pev->deadflag == DEAD_NO) { - #ifdef REGAMEDLL_ADD +#ifdef REGAMEDLL_ADD if (!old_bomb_defused_sound.value) - #endif +#endif { Broadcast("BOMBDEF"); } @@ -1091,9 +1091,9 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused) m_bStartDefuse = false; m_pBombDefuser = nullptr; - #ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES pPlayer->SetProgressBarTime(0); - #endif +#endif // tell the bots someone has aborted defusing if (TheBots) @@ -1143,7 +1143,7 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy } #ifdef REGAMEDLL_FIXES - if((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground + if ((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground { ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground"); return; @@ -1152,7 +1152,12 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy if (m_bStartDefuse) { - m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME; +#ifdef REGAMEDLL_FIXES + if (m_pBombDefuser == pPlayer) +#endif + { + m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME; + } return; }