From 0fa5e3220857b16b856f941f1a144a7ae5c9e82c Mon Sep 17 00:00:00 2001 From: s1lent Date: Sat, 4 Nov 2017 05:32:28 +0700 Subject: [PATCH] Fixed ammo (missing sound) --- regamedll/dlls/ammo.cpp | 3 +++ regamedll/dlls/client.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/regamedll/dlls/ammo.cpp b/regamedll/dlls/ammo.cpp index 19b9e089..eca048ab 100644 --- a/regamedll/dlls/ammo.cpp +++ b/regamedll/dlls/ammo.cpp @@ -76,6 +76,9 @@ void CBasePlayerAmmo::DefaultTouch(CBaseEntity *pOther) SetTouch(nullptr); SetThink(&CBaseEntity::SUB_Remove); pev->nextthink = gpGlobals->time + 0.1f; +#ifdef REGAMEDLL_FIXES + pev->owner = ENT(pOther->pev); +#endif } } else if (gEvilImpulse101) diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index bef9cbe0..135dc6a0 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -2201,10 +2201,14 @@ bool EXT_FUNC __API_HOOK(BuyGunAmmo)(CBasePlayer *pPlayer, CBasePlayerItem *weap if (pPlayer->m_iAccount >= info->clipCost) { #ifdef REGAMEDLL_FIXES - if (pPlayer->GiveAmmo(info->buyClipSize, info->ammoName2, info->maxRounds) == -1) + if (pPlayer->GiveAmmo(info->buyClipSize, info->ammoName2, weapon->iMaxAmmo1()) == -1) return false; + + EMIT_SOUND(ENT(weapon->pev), CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM); #else - pPlayer->GiveNamedItem(info->ammoName1); + if (!pPlayer->GiveNamedItemEx(info->ammoName1)) { + return false; + } #endif pPlayer->AddAccount(-info->clipCost, RT_PLAYER_BOUGHT_SOMETHING);