Skip to content

Commit

Permalink
Prevent /swap with paused players
Browse files Browse the repository at this point in the history
Prevent swapping if either of the players is paused (i.e. their character is not in the gameworld), as this can cause them to be stuck in midair after swapping, which can be exploited to skip parts.
  • Loading branch information
Robyt3 committed Jul 1, 2023
1 parent 3d60334 commit c6b4302
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/game/server/ddracechat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", "Need to have started the map to swap with a player.");
return;
}
if(pSelf->m_World.m_Core.m_apCharacters[pResult->m_ClientID] == nullptr || pSelf->m_World.m_Core.m_apCharacters[TargetClientId] == nullptr)
{
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", "You and the other player must not be paused.");
return;
}

bool SwapPending = pSwapPlayer->m_SwapTargetsClientID != pResult->m_ClientID;
if(SwapPending)
Expand Down

0 comments on commit c6b4302

Please sign in to comment.