diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index acf1e58fb..3a94f91de 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -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); } diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index c709a1f36..28f06e41b 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -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; diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index 0968d7b0b..f6caf00e6 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -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