From: js6pak Date: Fri, 23 Aug 2024 18:28:56 +0000 (+0200) Subject: Send DisconnectReason.Hacking to other players when disconnecting for cheating X-Git-Tag: v1.10.0~3 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=a0f0a65cbfe563804a4508336a25622d124c65ca;p=rhonda%2Fimpostor.git Send DisconnectReason.Hacking to other players when disconnecting for cheating Base game doesn't have a specific message for it so it results in a generic "left the game due to error" but it's still better than the default "left the game". This also allows client side mods to fix the message. --- diff --git a/src/Impostor.Server/Net/Client.cs b/src/Impostor.Server/Net/Client.cs index dfbc990..c5c4d16 100644 --- a/src/Impostor.Server/Net/Client.cs +++ b/src/Impostor.Server/Net/Client.cs @@ -86,9 +86,14 @@ namespace Impostor.Server.Net _logger.LogWarning("Client {Name} ({Id}) was caught cheating: [{SupportCode}] [{Context}-{Category}] {Message}", Name, Id, supportCode, context.Name, category, message); - if (_antiCheatConfig.BanIpFromGame) + if (Player is { } player) { - Player?.Game.BanIp(Connection.EndPoint.Address); + if (_antiCheatConfig.BanIpFromGame) + { + player.Game.BanIp(Connection.EndPoint.Address); + } + + await player.Game.HandleRemovePlayer(Id, DisconnectReason.Hacking); } var disconnectMessage =