Weaponbox ammopack hardcode (#533)

This commit is contained in:
Vaqtincha 2023-03-31 23:09:41 +05:00 committed by GitHub
parent c756bf89d1
commit 2f88574a94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1292,8 +1292,11 @@ CWeaponBox *EXT_FUNC __API_HOOK(CreateWeaponBox)(CBasePlayerItem *pItem, CBasePl
bool exhaustibleAmmo = (pItem->iFlags() & ITEM_FLAG_EXHAUSTIBLE) == ITEM_FLAG_EXHAUSTIBLE; bool exhaustibleAmmo = (pItem->iFlags() & ITEM_FLAG_EXHAUSTIBLE) == ITEM_FLAG_EXHAUSTIBLE;
if (exhaustibleAmmo || packAmmo) if (exhaustibleAmmo || packAmmo)
{ {
#ifndef REGAMEDLL_ADD
pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()]); pWeaponBox->PackAmmo(MAKE_STRING(pItem->pszAmmo1()), pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()]);
#else
pWeaponBox->GiveAmmo(pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()], (char *)pItem->pszAmmo1(), pItem->iMaxAmmo1());
#endif
if (exhaustibleAmmo) if (exhaustibleAmmo)
{ {
pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0; pPlayerOwner->m_rgAmmo[pItem->PrimaryAmmoIndex()] = 0;

View File

@ -2032,7 +2032,11 @@ void CWeaponBox::Touch(CBaseEntity *pOther)
if (!FStringNull(m_rgiszAmmo[n])) if (!FStringNull(m_rgiszAmmo[n]))
{ {
// there's some ammo of this type. // there's some ammo of this type.
#ifndef REGAMEDLL_ADD
pPlayer->GiveAmmo(m_rgAmmo[n], (char *)STRING(m_rgiszAmmo[n]), MaxAmmoCarry(m_rgiszAmmo[n])); pPlayer->GiveAmmo(m_rgAmmo[n], (char *)STRING(m_rgiszAmmo[n]), MaxAmmoCarry(m_rgiszAmmo[n]));
#else
pPlayer->GiveAmmo(m_rgAmmo[n], STRING(m_rgiszAmmo[n]), m_rgAmmo[n]);
#endif
// now empty the ammo from the weaponbox since we just gave it to the player // now empty the ammo from the weaponbox since we just gave it to the player
m_rgiszAmmo[n] = iStringNull; m_rgiszAmmo[n] = iStringNull;