Add newest feature of _cl_autowepswitch (#568)

This commit is contained in:
Alejo 2020-12-05 10:14:53 -03:00 committed by GitHub
parent c56982af18
commit 9b10456590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3212,9 +3212,14 @@ BOOL EXT_FUNC CHalfLifeMultiplay::__API_HOOK(FShouldSwitchWeapon)(CBasePlayer *p
return TRUE;
}
if (!pPlayer->m_iAutoWepSwitch)
if (pPlayer->m_iAutoWepSwitch == 0)
return FALSE;
#ifdef REGAMEDLL_ADD
if (pPlayer->m_iAutoWepSwitch == 2 && (pPlayer->m_afButtonLast & (IN_ATTACK | IN_ATTACK2)))
return FALSE;
#endif
if (!pPlayer->m_pActiveItem->CanHolster())
{
// can't put away the active item.
@ -3742,10 +3747,19 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerSpawn)(CBasePlayer *pPlayer)
if (pPlayer->m_bJustConnected)
return;
#ifdef REGAMEDLL_ADD
int iAutoWepSwitch = pPlayer->m_iAutoWepSwitch;
pPlayer->m_iAutoWepSwitch = 1;
#endif
pPlayer->pev->weapons |= (1 << WEAPON_SUIT);
pPlayer->OnSpawnEquip();
pPlayer->SetPlayerModel(false);
#ifdef REGAMEDLL_ADD
pPlayer->m_iAutoWepSwitch = iAutoWepSwitch;
#endif
#ifdef REGAMEDLL_ADD
if (respawn_immunitytime.value > 0)
pPlayer->SetSpawnProtection(respawn_immunitytime.value);