diff --git a/code/server/sv_game.c b/code/server/sv_game.c index 202994e..4063fc7 100644 --- a/code/server/sv_game.c +++ b/code/server/sv_game.c @@ -83,13 +83,25 @@ Sends a command string to a client =============== */ void SV_GameSendServerCommand( int clientNum, const char *text ) { + // capture for demo recording (deduplicate: only capture broadcasts + // and first per-client send of chat/print commands) + if ( clientNum == -1 ) { + SVD_CaptureServerCommand( text ); + } else if ( clientNum == 0 ) { + // per-client commands sent to client 0 first — capture "chat" and + // "tchat" once (they'll be sent to all clients in a loop) + if ( !strncmp( text, "chat", 4 ) || !strncmp( text, "tchat", 5 ) ) { + SVD_CaptureServerCommand( text ); + } + } + if ( clientNum == -1 ) { SV_SendServerCommand( NULL, "%s", text ); } else { if ( clientNum < 0 || clientNum >= sv_maxclients->integer ) { return; } - SV_SendServerCommand( svs.clients + clientNum, "%s", text ); + SV_SendServerCommand( svs.clients + clientNum, "%s", text ); } } diff --git a/code/server/sv_main.c b/code/server/sv_main.c index 7d980b2..da5e89a 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -177,9 +177,6 @@ void QDECL SV_SendServerCommand(client_t *cl, const char *fmt, ...) { return; } - // capture broadcast commands for demo recording - SVD_CaptureServerCommand( (char *)message ); - // hack to echo broadcast prints to console if ( com_dedicated->integer && !strncmp( (char *)message, "print", 5) ) { Com_Printf ("broadcast: %s\n", SV_ExpandNewlines((char *)message) );