Block team changes during demo playback

Prevent spectators from joining a playing team during demo
playback, which would disrupt the playback state. Prints a
message to the client instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-23 06:26:28 +08:00
parent 300e7c431a
commit 76538c3216

View file

@ -661,6 +661,12 @@ void Cmd_Team_f( gentity_t *ent ) {
int oldTeam;
char s[MAX_TOKEN_CHARS];
// demo playback: spectators only
if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) {
trap_SendServerCommand( ent-g_entities, "print \"Team changes disabled during demo playback.\n\"" );
return;
}
if ( trap_Argc() != 2 ) {
oldTeam = ent->client->sess.sessionTeam;
switch ( oldTeam ) {