]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'fix_2884_v2' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 4bd2e2e695a1208b68b338e81517c3d9b6733e9c..c97f09c777424fb198c2c6b4b0501de71e50d672 100644 (file)
@@ -1879,8 +1879,26 @@ void SetSpectatee_status(entity this, int spectatee_num)
                        CS(this).pressedkeys = 0;
                        STAT(PRESSED_KEYS, this) = 0;
                }
                        CS(this).pressedkeys = 0;
                        STAT(PRESSED_KEYS, this) = 0;
                }
+
                ClientData_Touch(this);
                ClientData_Touch(this);
-               if (g_race || g_cts) race_InitSpectator();
+
+               // init or clear race data
+               if ((g_race || g_cts) && g_race_qualifying && IS_REAL_CLIENT(this))
+               {
+                       msg_entity = this;
+
+                       if (this.enemy && this.enemy.race_laptime)
+                       {
+                               // init
+                               race_SendNextCheckpoint(this.enemy, 1);
+                       }
+                       else
+                       {
+                               // send reset to this spectator
+                               WriteHeader(MSG_ONE, TE_CSQC_RACE);
+                               WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_CLEAR);
+                       }
+               }
        }
 }
 
        }
 }
 
@@ -2682,6 +2700,8 @@ void PlayerFrame (entity this)
        anticheat_prethink(this);
 
        // Check if spectating is allowed
        anticheat_prethink(this);
 
        // Check if spectating is allowed
+       if (!autocvar_sv_spectate) blockSpectators = 1;
+
        if (blockSpectators && IS_REAL_CLIENT(this)
        && (IS_SPEC(this) || IS_OBSERVER(this)) && !INGAME(this)
        && time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime))
        if (blockSpectators && IS_REAL_CLIENT(this)
        && (IS_SPEC(this) || IS_OBSERVER(this)) && !INGAME(this)
        && time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime))