From 8914b84129d76317cabb71b8829b2636a1424cd4 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 18 Jul 2016 03:31:56 +0700 Subject: [PATCH] Fix the bots behavior when death bot_kill and mp_freeforall 1 --- regamedll/dlls/bot/cs_bot_manager.cpp | 5 ++++- regamedll/dlls/client.cpp | 3 ++- regamedll/dlls/multiplay_gamerules.cpp | 2 +- regamedll/dlls/player.cpp | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index 9a253759..cf5ed92d 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -408,7 +408,6 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) continue; const char *name = STRING(pPlayer->pev->netname); - if (FStrEq(name, "")) continue; @@ -416,7 +415,11 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) { if (killThemAll || FStrEq(name, msg)) { +#ifdef REGAMEDLL_FIXES + ClientKill(pPlayer->edict()); +#else pPlayer->TakeDamage(pPlayer->pev, pPlayer->pev, 9999.9f, DMG_CRUSH); +#endif } } } diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index c57500a1..0a202030 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1973,7 +1973,8 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) return false; WeaponInfoStruct *info = GetWeaponInfo(weapon->m_iId); - if (info == nullptr) { + if (!info) + { ALERT(at_console, "Tried to buy ammo for an unrecognized gun\n"); return false; } diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c3062707..c424a82f 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3569,7 +3569,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars { // if a player dies in a deathmatch game and the killer is a client, award the killer some points CBasePlayer *killer = GetClassPtr((CBasePlayer *)pKiller); - bool killedByFFA = CSGameRules()->IsFreeForAll(); + bool killedByFFA = IsFreeForAll(); if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA) { diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 52d9725b..98e8205c 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -1106,7 +1106,6 @@ BOOL CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe continue; bool killedByHumanPlayer = (!pPlayer->IsBot() && pPlayer->pev == pevAttacker && pPlayer->m_iTeam != m_iTeam); - if (killedByHumanPlayer) { if (TheCareerTasks != NULL) @@ -2080,7 +2079,7 @@ void CBasePlayer::__API_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) } } - if (m_pTank != NULL) + if (m_pTank) { m_pTank->Use(this, this, USE_OFF, 0); m_pTank = NULL;