mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-14 15:48:01 +03:00
CCSPlayer::RemoveShield: Enhanced
CCSPlayer::GiveNamedItemEx: Drop weapon_elite when get weapon_shield
This commit is contained in:
parent
b83d221ec4
commit
8c3cd4fc54
@ -203,40 +203,7 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemov
|
|||||||
|
|
||||||
else if (FStrEq(pszItemName, "weapon_shield"))
|
else if (FStrEq(pszItemName, "weapon_shield"))
|
||||||
{
|
{
|
||||||
if (!pPlayer->HasShield())
|
return RemoveShield();
|
||||||
return false;
|
|
||||||
|
|
||||||
bool bIsProtectedShield = pPlayer->IsProtectedByShield();
|
|
||||||
pPlayer->RemoveShield();
|
|
||||||
|
|
||||||
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(pPlayer->m_pActiveItem);
|
|
||||||
if (pWeapon)
|
|
||||||
{
|
|
||||||
if (!pWeapon->CanHolster())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (pWeapon->m_iId == WEAPON_HEGRENADE || pWeapon->m_iId == WEAPON_FLASHBANG || pWeapon->m_iId == WEAPON_SMOKEGRENADE)
|
|
||||||
{
|
|
||||||
if (pPlayer->m_rgAmmo[pWeapon->m_iPrimaryAmmoType] <= 0)
|
|
||||||
g_pGameRules->GetNextBestWeapon(pPlayer, pWeapon);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pWeapon->m_flStartThrow != 0.0f)
|
|
||||||
pWeapon->Holster();
|
|
||||||
|
|
||||||
if (pPlayer->IsReloading())
|
|
||||||
{
|
|
||||||
pWeapon->m_fInReload = FALSE;
|
|
||||||
pPlayer->m_flNextAttack = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bIsProtectedShield)
|
|
||||||
pWeapon->SecondaryAttack();
|
|
||||||
|
|
||||||
pWeapon->Deploy();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pItem = GetItemByName(pszItemName);
|
auto pItem = GetItemByName(pszItemName);
|
||||||
@ -293,6 +260,7 @@ EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItemEx(const char *pszName)
|
|||||||
}
|
}
|
||||||
} else if (FStrEq(pszName, "weapon_shield")) {
|
} else if (FStrEq(pszName, "weapon_shield")) {
|
||||||
pPlayer->DropPrimary();
|
pPlayer->DropPrimary();
|
||||||
|
pPlayer->DropPlayerItem("weapon_elite");
|
||||||
pPlayer->GiveShield();
|
pPlayer->GiveShield();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -340,9 +308,45 @@ EXT_FUNC void CCSPlayer::DropPlayerItem(const char *pszItemName)
|
|||||||
BasePlayer()->DropPlayerItem(pszItemName);
|
BasePlayer()->DropPlayerItem(pszItemName);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXT_FUNC void CCSPlayer::RemoveShield()
|
EXT_FUNC bool CCSPlayer::RemoveShield()
|
||||||
{
|
{
|
||||||
BasePlayer()->RemoveShield();
|
CBasePlayer *pPlayer = BasePlayer();
|
||||||
|
|
||||||
|
if (!pPlayer->HasShield())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool bIsProtectedShield = pPlayer->IsProtectedByShield();
|
||||||
|
pPlayer->RemoveShield();
|
||||||
|
|
||||||
|
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(pPlayer->m_pActiveItem);
|
||||||
|
if (pWeapon && pWeapon->IsWeapon())
|
||||||
|
{
|
||||||
|
if (!pWeapon->CanHolster())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (pWeapon->m_iId == WEAPON_HEGRENADE || pWeapon->m_iId == WEAPON_FLASHBANG || pWeapon->m_iId == WEAPON_SMOKEGRENADE)
|
||||||
|
{
|
||||||
|
if (pPlayer->m_rgAmmo[pWeapon->m_iPrimaryAmmoType] <= 0)
|
||||||
|
g_pGameRules->GetNextBestWeapon(pPlayer, pWeapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pWeapon->m_flStartThrow != 0.0f)
|
||||||
|
pWeapon->Holster();
|
||||||
|
|
||||||
|
if (pPlayer->IsReloading())
|
||||||
|
{
|
||||||
|
pWeapon->m_fInReload = FALSE;
|
||||||
|
pPlayer->m_flNextAttack = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bIsProtectedShield)
|
||||||
|
pWeapon->SecondaryAttack();
|
||||||
|
|
||||||
|
if (!pWeapon->Deploy())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXT_FUNC void CCSPlayer::RemoveAllItems(bool bRemoveSuit)
|
EXT_FUNC void CCSPlayer::RemoveAllItems(bool bRemoveSuit)
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
virtual void GiveShield(bool bDeploy = true);
|
virtual void GiveShield(bool bDeploy = true);
|
||||||
virtual void DropShield(bool bDeploy = true);
|
virtual void DropShield(bool bDeploy = true);
|
||||||
virtual void DropPlayerItem(const char *pszItemName);
|
virtual void DropPlayerItem(const char *pszItemName);
|
||||||
virtual void RemoveShield();
|
virtual bool RemoveShield();
|
||||||
virtual void RemoveAllItems(bool bRemoveSuit);
|
virtual void RemoveAllItems(bool bRemoveSuit);
|
||||||
virtual bool RemovePlayerItem(const char* pszItemName);
|
virtual bool RemovePlayerItem(const char* pszItemName);
|
||||||
virtual void SetPlayerModel(bool bHasC4);
|
virtual void SetPlayerModel(bool bHasC4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user