]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Get rid of a couple backtraces printed in the console when a player is kicked for...
authorterencehill <piuntn@gmail.com>
Fri, 16 Apr 2021 16:15:11 +0000 (18:15 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 16 Apr 2021 16:15:11 +0000 (18:15 +0200)
qcsrc/server/client.qc
qcsrc/server/client.qh

index 0f4a46bf90363381a73686c6af9fca20c632bdcf..08a0b68da2fb55fceddcba709ed6bc669ddaca8c 100644 (file)
@@ -2095,23 +2095,6 @@ int nJoinAllowed(entity this, entity ignore)
        return free_slots;
 }
 
-/**
- * Checks whether the client is an observer or spectator, if so, he will get kicked after
- * g_maxplayers_spectator_blocktime seconds
- */
-void checkSpectatorBlock(entity this)
-{
-       if(IS_SPEC(this) || IS_OBSERVER(this))
-       if(!this.caplayer)
-       if(IS_REAL_CLIENT(this))
-       {
-               if( time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
-                       dropclient(this);
-               }
-       }
-}
-
 void PrintWelcomeMessage(entity this)
 {
        if(CS(this).motd_actived_time == 0)
@@ -2475,12 +2458,17 @@ void PlayerPreThink (entity this)
        if (frametime) {
                // physics frames: update anticheat stuff
                anticheat_prethink(this);
-       }
 
-       if (blockSpectators && frametime) {
                // WORKAROUND: only use dropclient in server frames (frametime set).
                // Never use it in cl_movement frames (frametime zero).
-               checkSpectatorBlock(this);
+               if (blockSpectators && IS_REAL_CLIENT(this)
+                       && (IS_SPEC(this) || IS_OBSERVER(this)) && !this.caplayer
+                       && time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime))
+               {
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+                       dropclient(this);
+                       return;
+               }
        }
 
        zoomstate_set = false;
index 4dd93563e42707bbae74ecc238e20541ed5e7cf9..ed3273be84e8f7125256f4d23d73bfd065b07341 100644 (file)
@@ -365,8 +365,6 @@ void ClientData_Touch(entity e);
 
 int nJoinAllowed(entity this, entity ignore);
 
-void checkSpectatorBlock(entity this);
-
 void PlayerUseKey(entity this);
 
 void FixClientCvars(entity e);