public static void DropClient(ServerClient client, string reason) { client.SendReliableCommand(string.Format("disconnect \"{0}\"", reason), true); SendSnapshot(client); Log.Write(LogLevel.Info, "Client {0} disconnected (name {1}, reason {2})", client.ClientNum, client.Name, reason); SendReliableCommand(null, "print \"{0} disconnected ({1})\"", client.Name, reason); SendSnapshot(client); client.DestroyEntity(); client.ZombifiedAt = _serverTime; client.State = ServerClientState.Zombie; }
public static void SendReliableCommand(ServerClient client, string command, params string[] args) { command = string.Format(command, args); if (client != null) { client.SendReliableCommand(command); } else { foreach (ServerClient thisClient in _clients) { if (thisClient != null) { thisClient.SendReliableCommand(command); } } } }