CSInterface Update: Add RemovePlayerItemEx

This commit is contained in:
s1lent 2018-02-16 17:55:29 +07:00
parent 5fa0c4220e
commit cbbda5ef21
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
4 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=5
minorVersion=6
maintenanceVersion=0

View File

@ -132,7 +132,7 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
return true;
}
EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
EXT_FUNC bool CCSPlayer::RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo)
{
if (!pszItemName)
return false;
@ -249,8 +249,15 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
pPlayer->SetProgressBarTime(0);
}
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
if (pItem->IsWeapon())
{
if (pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
if (bRemoveAmmo) {
pPlayer->m_rgAmmo[ pItem->PrimaryAmmoIndex() ] = 0;
}
}
if (pPlayer->RemovePlayerItem(pItem)) {
@ -268,6 +275,11 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
return false;
}
EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
{
return RemovePlayerItemEx(pszItemName, false);
}
EXT_FUNC CBaseEntity *CCSPlayer::GiveNamedItemEx(const char *pszName)
{
CBasePlayer *pPlayer = BasePlayer();

View File

@ -79,6 +79,7 @@ public:
virtual bool MakeBomber();
virtual void ResetSequenceInfo();
virtual void StartDeathCam();
virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo);
CBasePlayer *BasePlayer() const;

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 5
#define REGAMEDLL_API_VERSION_MINOR 6
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;