Don't call HasRestrictItem with type touch when that item is buying

This commit is contained in:
s1lentq 2020-06-25 19:30:12 +07:00
parent c56f00f7ed
commit 0cd233dc06
3 changed files with 11 additions and 2 deletions

View File

@ -134,6 +134,7 @@ static entity_field_alias_t custom_entity_field_alias[] =
};
bool g_bServerActive = false;
bool g_bItemCreatedByBuying = false;
PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS];
unsigned short m_usResetDecals;
unsigned short g_iShadowSprite;
@ -1493,7 +1494,10 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pszItem)
{
g_bItemCreatedByBuying = true;
pPlayer->GiveNamedItem(pszItem);
g_bItemCreatedByBuying = false;
pPlayer->AddAccount(-iItemPrice, RT_PLAYER_BOUGHT_SOMETHING);
}

View File

@ -102,6 +102,7 @@ C_DLLEXPORT int CountTeams();
C_DLLEXPORT int CountTeamPlayers(int iTeam);
extern bool g_bServerActive;
extern bool g_bItemCreatedByBuying;
extern bool g_skipCareerInitialSpawn;
extern unsigned short m_usResetDecals;

View File

@ -371,8 +371,10 @@ void CItemKevlar::Precache()
BOOL CItemKevlar::MyTouch(CBasePlayer *pPlayer)
{
#ifdef REGAMEDLL_ADD
if (pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_TOUCHED))
if (!g_bItemCreatedByBuying && pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_TOUCHED))
return FALSE;
g_bItemCreatedByBuying = false;
#endif
#ifdef REGAMEDLL_FIXES
@ -423,8 +425,10 @@ void CItemAssaultSuit::Precache()
BOOL CItemAssaultSuit::MyTouch(CBasePlayer *pPlayer)
{
#ifdef REGAMEDLL_ADD
if (pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_TOUCHED))
if (!g_bItemCreatedByBuying && pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_TOUCHED))
return FALSE;
g_bItemCreatedByBuying = false;
#endif
#ifdef REGAMEDLL_FIXES