/// <summary> /// Host_Status_f /// </summary> private static void Status_f() { bool flag = true; if (Cmd.Source == cmd_source_t.src_command) { if (!Server.sv.active) { Cmd.ForwardToServer(); return; } } else { flag = false; } StringBuilder sb = new StringBuilder(256); sb.Append(String.Format("host: {0}\n", Cvar.GetString("hostname"))); sb.Append(String.Format("version: {0:F2}\n", QDef.VERSION)); if (Net.TcpIpAvailable) { sb.Append("tcp/ip: "); sb.Append(Net.MyTcpIpAddress); sb.Append('\n'); } sb.Append("map: "); sb.Append(Server.sv.name); sb.Append('\n'); sb.Append(String.Format("players: {0} active ({1} max)\n\n", Net.ActiveConnections, Server.svs.maxclients)); for (int j = 0; j < Server.svs.maxclients; j++) { client_t client = Server.svs.clients[j]; if (!client.active) { continue; } int seconds = (int)(Net.Time - client.netconnection.connecttime); int hours, minutes = seconds / 60; if (minutes > 0) { seconds -= (minutes * 60); hours = minutes / 60; if (hours > 0) { minutes -= (hours * 60); } } else { hours = 0; } sb.Append(String.Format("#{0,-2} {1,-16} {2} {2}:{4,2}:{5,2}", j + 1, client.name, (int)client.edict.v.frags, hours, minutes, seconds)); sb.Append(" "); sb.Append(client.netconnection.address); sb.Append('\n'); } if (flag) { Con.Print(sb.ToString()); } else { Server.ClientPrint(sb.ToString()); } }