diff --git a/regamedll/dlls/gamerules.h b/regamedll/dlls/gamerules.h index c9ec2ceb..b1b46ff5 100644 --- a/regamedll/dlls/gamerules.h +++ b/regamedll/dlls/gamerules.h @@ -667,6 +667,7 @@ public: // has a style of gameplay when aren't any teams bool IsFreeForAll() const; + bool CanPlayerBuy(CBasePlayer *pPlayer) const; VFUNC bool HasRoundTimeExpired(); VFUNC bool IsBombPlanted(); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 2a7099e0..f8afe166 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4928,3 +4928,21 @@ void CHalfLifeMultiplay::ChangePlayerTeam(CBasePlayer *pPlayer, const char *pTea CSGameRules()->CheckWinConditions(); } } + +bool CHalfLifeMultiplay::CanPlayerBuy(CBasePlayer *pPlayer) const +{ + if (pPlayer->m_iTeam == CT && m_bCTCantBuy) + { + return false; + } + else if (pPlayer->m_iTeam == TERRORIST && m_bTCantBuy) + { + return false; + } + else if (m_bCTCantBuy && m_bTCantBuy) + { + return false; + } + + return true; +} diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index edcb42b7..82eeff37 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6154,11 +6154,21 @@ void OLD_CheckBuyZone(CBasePlayer *player) { const char *pszSpawnClass = nullptr; - if (player->m_iTeam == TERRORIST) - pszSpawnClass = "info_player_deathmatch"; +#ifdef REGAMEDLL_FIXES + if (!CSGameRules()->CanPlayerBuy(player)) + { + return; + } +#endif + if (player->m_iTeam == TERRORIST) + { + pszSpawnClass = "info_player_deathmatch"; + } else if (player->m_iTeam == CT) + { pszSpawnClass = "info_player_start"; + } if (pszSpawnClass) { diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index 151a4480..6c9360a5 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -1812,6 +1812,11 @@ void CBuyZone::BuyTouch(CBaseEntity *pOther) if (pev->team == UNASSIGNED || pev->team == p->m_iTeam) { +#ifdef REGAMEDLL_FIXES + if (!CSGameRules()->CanPlayerBuy(p)) + return; +#endif + p->m_signals.Signal(SIGNAL_BUY); } }