Skip to content

Commit

Permalink
fix: bots can't buy sec ammo if preferred pistol (ex. "WeaponPreferen…
Browse files Browse the repository at this point in the history
…ce = deagle" in BotProfile.db)
  • Loading branch information
Vaqtincha committed Dec 15, 2024
1 parent f63ad67 commit 26c1a61
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions regamedll/dlls/bot/states/cs_bot_buy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,26 @@ void BuyState::OnUpdate(CCSBot *me)
me->ClientCommand("vesthelm");
me->ClientCommand("vest");

// pistols - if we have no preferred pistol, buy at random
if (TheCSBots()->AllowPistols() && !me->GetProfile()->HasPistolPreference())
if (TheCSBots()->AllowPistols()
#ifndef REGAMEDLL_FIXES
&& !me->GetProfile()->HasPistolPreference()
#endif
)
{
if (m_buyPistol)
{
int which = RANDOM_LONG(0, MAX_BUY_WEAPON_SECONDARY - 1);
#ifdef REGAMEDLL_FIXES
// pistols - if we have no preferred pistol, buy at random
if (!me->GetProfile()->HasPistolPreference())
#endif
{
int which = RANDOM_LONG(0, MAX_BUY_WEAPON_SECONDARY - 1);

if (me->m_iTeam == TERRORIST)
me->ClientCommand(secondaryWeaponBuyInfoT[which].buyAlias);
else
me->ClientCommand(secondaryWeaponBuyInfoCT[which].buyAlias);
if (me->m_iTeam == TERRORIST)
me->ClientCommand(secondaryWeaponBuyInfoT[which].buyAlias);
else
me->ClientCommand(secondaryWeaponBuyInfoCT[which].buyAlias);
}

// only buy one pistol
m_buyPistol = false;
Expand Down

0 comments on commit 26c1a61

Please sign in to comment.