API: CSPlayer methods enhancement (#862)

* Adding return type to DropShield and DropPlayerItem
* JoinTeam: force C4 drop when changing to SPEC
This commit is contained in:
Francisco Muñoz 2023-09-28 06:06:35 -03:00 committed by GitHub
parent d7b44099e7
commit 8a52b7e38d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -43,8 +43,10 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
pPlayer->pev->deadflag = DEAD_DEAD; pPlayer->pev->deadflag = DEAD_DEAD;
pPlayer->pev->health = 0; pPlayer->pev->health = 0;
if (pPlayer->m_bHasC4)
pPlayer->DropPlayerItem("weapon_c4");
pPlayer->RemoveAllItems(TRUE); pPlayer->RemoveAllItems(TRUE);
pPlayer->m_bHasC4 = false;
pPlayer->m_iTeam = SPECTATOR; pPlayer->m_iTeam = SPECTATOR;
pPlayer->m_iJoiningState = JOINED; pPlayer->m_iJoiningState = JOINED;
@ -292,14 +294,14 @@ EXT_FUNC void CCSPlayer::GiveShield(bool bDeploy)
BasePlayer()->GiveShield(bDeploy); BasePlayer()->GiveShield(bDeploy);
} }
EXT_FUNC void CCSPlayer::DropShield(bool bDeploy) EXT_FUNC CBaseEntity *CCSPlayer::DropShield(bool bDeploy)
{ {
BasePlayer()->DropShield(bDeploy); return BasePlayer()->DropShield(bDeploy);
} }
EXT_FUNC void CCSPlayer::DropPlayerItem(const char *pszItemName) EXT_FUNC CBaseEntity *CCSPlayer::DropPlayerItem(const char *pszItemName)
{ {
BasePlayer()->DropPlayerItem(pszItemName); return BasePlayer()->DropPlayerItem(pszItemName);
} }
EXT_FUNC bool CCSPlayer::RemoveShield() EXT_FUNC bool CCSPlayer::RemoveShield()

View File

@ -66,8 +66,8 @@ public:
virtual CBaseEntity *GiveNamedItemEx(const char *pszName); virtual CBaseEntity *GiveNamedItemEx(const char *pszName);
virtual void GiveDefaultItems(); virtual void GiveDefaultItems();
virtual void GiveShield(bool bDeploy = true); virtual void GiveShield(bool bDeploy = true);
virtual void DropShield(bool bDeploy = true); virtual CBaseEntity *DropShield(bool bDeploy = true);
virtual void DropPlayerItem(const char *pszItemName); virtual CBaseEntity* DropPlayerItem(const char *pszItemName);
virtual bool 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);