Count active players only when needed
authorterencehill <piuntn@gmail.com>
Wed, 22 Jan 2020 19:23:27 +0000 (20:23 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 22 Jan 2020 19:23:27 +0000 (20:23 +0100)
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc

index 66f2937c638b35f20f15f6fc8bd01631a9d638aa..61a6d701bde01e03345a660b53669f60e93179b8 100644 (file)
@@ -184,15 +184,15 @@ void lms_RemovePlayer(entity player)
        float player_rank = GameRules_scoring_add(player, LMS_RANK, 0);
        if (!player_rank)
        {
-               int pl_cnt = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
-                       pl_cnt++;
-               });
                if (player.lms_spectate_warning < 2)
                {
                        if(IS_BOT_CLIENT(player))
                                bot_clear(player);
                        player.frags = FRAGS_PLAYER_OUT_OF_GAME;
+                       int pl_cnt = 0;
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+                               pl_cnt++;
+                       });
                        GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1);
                }
                else