diff options
| -rw-r--r-- | src/crsm.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp index 87bcbfe..b638bd9 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -2938,14 +2938,32 @@ CMD_FUNCTION_IMPL(noadmin) } CMD_FUNCTION_IMPL(clientlist) - QString response = "Verbundene Clients (Chatnick (PC-Name)): "; + if(Session.State == CRSMSession::None) + { + respond(client, "Es ist zurzeit nichts gehostet.\n"); + return Success; + } + + if(Session.Clonk.Clients.isEmpty()) + { + respond(client, "Keine verbundenen Clients.\n"); + return Success; + } + + QString response = "Verbundene Clients ((Anzahl Spieler) Chatnick (PC-Name)): "; foreach(const ClientInfo& connectedClient, Session.Clonk.Clients) { - if(connectedClient.nick.isEmpty()) - continue; - response += connectedClient.toString() + ", "; + response += "(" + QString::number(connectedClient.players.count()) + ") " + connectedClient.toString() + ", "; + } + + if(!Session.Clonk.Server.players.isEmpty()) + { + response += "(" + QString::number(Session.Clonk.Server.players.count()) + ") " + Session.Clonk.Server.toString() + ", "; + } + else + { + response.chop(2); } - response = response.left(response.length() - 2); respond(client, response + "\n"); return Success; } |
