コード例 #1
0
    public void DoDisconnect(INetChannel channel, string reason)
    {
        Timer.Spawn(TimeSpan.FromMilliseconds(100), () =>
        {
            if (!channel.IsConnected)
            {
                return;
            }

            // We do this so the client can set net.fakeloss 1 before getting ghosted.
            // This avoids it spamming messages at the server that cause warnings due to unconnected client.
            channel.SendMessage(new MsgGhostKick());

            Timer.Spawn(TimeSpan.FromMilliseconds(100), () =>
            {
                if (!channel.IsConnected)
                {
                    return;
                }

                // Actually just remove the client entirely.
                channel.Disconnect(reason, false);
            });
        });
    }
コード例 #2
0
 /// <inheritdoc />
 public void DisconnectChannel(INetChannel channel, string reason)
 {
     channel.Disconnect(reason);
 }