do not release the hooks if you swap

This commit is contained in:
c0d3d3v 2022-04-30 10:21:38 +02:00
parent 2e12082938
commit 0ea811f70e
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
3 changed files with 6 additions and 8 deletions

View file

@ -2367,3 +2367,8 @@ int64_t CCharacter::TeamMask()
{
return Teams()->TeamMask(Team(), -1, GetPlayer()->GetCID());
}
void CCharacter::SwapClients(int Client1, int Client2)
{
m_Core.m_HookedPlayer = m_Core.m_HookedPlayer == Client1 ? Client2 : m_Core.m_HookedPlayer == Client2 ? Client1 : m_Core.m_HookedPlayer;
}

View file

@ -40,6 +40,7 @@ public:
virtual void TickDefered();
virtual void TickPaused();
virtual void Snap(int SnappingClient);
virtual void SwapClients(int Client1, int Client2) override;
bool CanSnapCharacter(int SnappingClient);

View file

@ -872,14 +872,6 @@ void CGameTeams::SwapTeamCharacters(CPlayer *pPlayer, CPlayer *pTargetPlayer, in
return;
}
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_Core.Team(i) == Team && GameServer()->m_apPlayers[i])
{
GameServer()->m_apPlayers[i]->GetCharacter()->ResetHook();
GameServer()->m_World.ReleaseHooked(i);
}
}
CSaveTee PrimarySavedTee;
PrimarySavedTee.Save(pPlayer->GetCharacter());