Skip to content

Commit

Permalink
Disconnect remote player
Browse files Browse the repository at this point in the history
  • Loading branch information
sebimih13 committed Jan 29, 2025
1 parent a9b22fe commit cb3b7c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions DeadZone/source/Client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,12 @@ void Client::sendCloseRangeDamage(const double damage, const double shortRangeAt

void Client::sendDisconnect()
{
nlohmann::json jsonData;
jsonData["disconnect"] = true;

bool failure = true;
while (failure)
if (succesfullyConnected)
{
this->sendMessage(jsonData.dump(), failure, this->lastTimeSentPing);
}
nlohmann::json jsonData;
jsonData["disconnect"] = true;

enet_host_flush(this->client);
this->sendMessageUnsafe(jsonData.dump(), this->lastTimeSentPing);
enet_host_flush(this->client);
}
}
2 changes: 1 addition & 1 deletion DeadZone/source/Server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void Server::sendNumFinishedWaves(int number)

void Server::disconnectPlayer(const std::string& clientKey)
{
enet_peer_disconnect(connectedClients[clientKey].peer, 0);
// enet_peer_disconnect(connectedClients[clientKey].peer, 0);
connectedClients.erase(clientKey);

// Broadcast
Expand Down

0 comments on commit cb3b7c7

Please sign in to comment.