diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 771538571..9460d0b49 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1440,28 +1440,13 @@ void EXT_FUNC __API_HOOK(BuyItem)(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= DEFUSEKIT_PRICE) { bEnoughMoney = true; - pPlayer->m_bHasDefuser = true; - - MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev); - WRITE_BYTE(STATUSICON_SHOW); - WRITE_STRING("defuser"); - WRITE_BYTE(0); - WRITE_BYTE(160); - WRITE_BYTE(0); - MESSAGE_END(); - - pPlayer->pev->body = 1; + pPlayer->GiveDefuser(); pPlayer->AddAccount(-DEFUSEKIT_PRICE, RT_PLAYER_BOUGHT_SOMETHING); #ifdef REGAMEDLL_FIXES EMIT_SOUND(ENT(pPlayer->pev), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM); #else EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/kevlar.wav", VOL_NORM, ATTN_NORM); -#endif - pPlayer->SendItemStatus(); - -#ifdef BUILD_LATEST - pPlayer->SetScoreboardAttributes(); #endif } break; @@ -1479,7 +1464,6 @@ void EXT_FUNC __API_HOOK(BuyItem)(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= SHIELDGUN_PRICE) { bEnoughMoney = true; - pPlayer->DropPrimary(); pPlayer->GiveShield(); pPlayer->AddAccount(-SHIELDGUN_PRICE, RT_PLAYER_BOUGHT_SOMETHING); diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index fc67bc57f..03620e362 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -481,22 +481,9 @@ BOOL CItemThighPack::MyTouch(CBasePlayer *pPlayer) return FALSE; #endif - pPlayer->m_bHasDefuser = true; - pPlayer->pev->body = 1; - + pPlayer->GiveDefuser(); ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Got_defuser"); - MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev); - WRITE_BYTE(STATUSICON_SHOW); - WRITE_STRING("defuser"); - WRITE_BYTE(0); - WRITE_BYTE(160); - WRITE_BYTE(0); - MESSAGE_END(); - - pPlayer->SendItemStatus(); - pPlayer->SetScoreboardAttributes(); - EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM); if (TheTutor) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 13b226d5a..9861c35f7 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -10137,6 +10137,26 @@ void CBasePlayer::RemoveBomb() } } +void CBasePlayer::GiveDefuser() +{ + m_bHasDefuser = true; + pev->body = 1; + + MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev); + WRITE_BYTE(STATUSICON_SHOW); + WRITE_STRING("defuser"); + WRITE_BYTE(0); + WRITE_BYTE(160); + WRITE_BYTE(0); + MESSAGE_END(); + + SendItemStatus(); + +#if defined(REGAMEDLL_FIXES) || defined(BUILD_LATEST) + SetScoreboardAttributes(); +#endif +} + void CBasePlayer::RemoveDefuser() { m_bHasDefuser = false; diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 625e60fd6..b0e5c42b4 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -631,6 +631,7 @@ class CBasePlayer: public CBaseMonster { void DropPrimary(); void OnSpawnEquip(bool addDefault = true, bool equipGame = true); void RemoveBomb(); + void GiveDefuser(); void RemoveDefuser(); void HideTimer(); bool MakeBomber();