Fix the bots behavior when death bot_kill and mp_freeforall 1

This commit is contained in:
s1lentq 2016-07-18 03:31:56 +07:00
parent 183a9f674c
commit 8914b84129
4 changed files with 8 additions and 5 deletions

View File

@ -408,7 +408,6 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
continue; continue;
const char *name = STRING(pPlayer->pev->netname); const char *name = STRING(pPlayer->pev->netname);
if (FStrEq(name, "")) if (FStrEq(name, ""))
continue; continue;
@ -416,7 +415,11 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
{ {
if (killThemAll || FStrEq(name, msg)) if (killThemAll || FStrEq(name, msg))
{ {
#ifdef REGAMEDLL_FIXES
ClientKill(pPlayer->edict());
#else
pPlayer->TakeDamage(pPlayer->pev, pPlayer->pev, 9999.9f, DMG_CRUSH); pPlayer->TakeDamage(pPlayer->pev, pPlayer->pev, 9999.9f, DMG_CRUSH);
#endif
} }
} }
} }

View File

@ -1973,7 +1973,8 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney)
return false; return false;
WeaponInfoStruct *info = GetWeaponInfo(weapon->m_iId); WeaponInfoStruct *info = GetWeaponInfo(weapon->m_iId);
if (info == nullptr) { if (!info)
{
ALERT(at_console, "Tried to buy ammo for an unrecognized gun\n"); ALERT(at_console, "Tried to buy ammo for an unrecognized gun\n");
return false; return false;
} }

View File

@ -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 // if a player dies in a deathmatch game and the killer is a client, award the killer some points
CBasePlayer *killer = GetClassPtr<CCSPlayer>((CBasePlayer *)pKiller); CBasePlayer *killer = GetClassPtr<CCSPlayer>((CBasePlayer *)pKiller);
bool killedByFFA = CSGameRules()->IsFreeForAll(); bool killedByFFA = IsFreeForAll();
if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA) if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA)
{ {

View File

@ -1106,7 +1106,6 @@ BOOL CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe
continue; continue;
bool killedByHumanPlayer = (!pPlayer->IsBot() && pPlayer->pev == pevAttacker && pPlayer->m_iTeam != m_iTeam); bool killedByHumanPlayer = (!pPlayer->IsBot() && pPlayer->pev == pevAttacker && pPlayer->m_iTeam != m_iTeam);
if (killedByHumanPlayer) if (killedByHumanPlayer)
{ {
if (TheCareerTasks != NULL) 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->Use(this, this, USE_OFF, 0);
m_pTank = NULL; m_pTank = NULL;