Skip to content

Commit 0cd233d

Browse files
committed
Don't call HasRestrictItem with type touch when that item is buying
1 parent c56f00f commit 0cd233d

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

regamedll/dlls/client.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static entity_field_alias_t custom_entity_field_alias[] =
134134
};
135135

136136
bool g_bServerActive = false;
137+
bool g_bItemCreatedByBuying = false;
137138
PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS];
138139
unsigned short m_usResetDecals;
139140
unsigned short g_iShadowSprite;
@@ -1493,7 +1494,10 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
14931494

14941495
if (pszItem)
14951496
{
1497+
g_bItemCreatedByBuying = true;
14961498
pPlayer->GiveNamedItem(pszItem);
1499+
g_bItemCreatedByBuying = false;
1500+
14971501
pPlayer->AddAccount(-iItemPrice, RT_PLAYER_BOUGHT_SOMETHING);
14981502
}
14991503

regamedll/dlls/client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ C_DLLEXPORT int CountTeams();
102102
C_DLLEXPORT int CountTeamPlayers(int iTeam);
103103

104104
extern bool g_bServerActive;
105+
extern bool g_bItemCreatedByBuying;
105106
extern bool g_skipCareerInitialSpawn;
106107

107108
extern unsigned short m_usResetDecals;

regamedll/dlls/items.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,10 @@ void CItemKevlar::Precache()
371371
BOOL CItemKevlar::MyTouch(CBasePlayer *pPlayer)
372372
{
373373
#ifdef REGAMEDLL_ADD
374-
if (pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_TOUCHED))
374+
if (!g_bItemCreatedByBuying && pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_TOUCHED))
375375
return FALSE;
376+
377+
g_bItemCreatedByBuying = false;
376378
#endif
377379

378380
#ifdef REGAMEDLL_FIXES
@@ -423,8 +425,10 @@ void CItemAssaultSuit::Precache()
423425
BOOL CItemAssaultSuit::MyTouch(CBasePlayer *pPlayer)
424426
{
425427
#ifdef REGAMEDLL_ADD
426-
if (pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_TOUCHED))
428+
if (!g_bItemCreatedByBuying && pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_TOUCHED))
427429
return FALSE;
430+
431+
g_bItemCreatedByBuying = false;
428432
#endif
429433

430434
#ifdef REGAMEDLL_FIXES

0 commit comments

Comments
 (0)