- // Only if the player cannot play at all
- if(PlayerScore_Add(player, SP_LMS_RANK, 0) == 666)
- player.frags = FRAGS_SPECTATOR;
- else
- player.frags = FRAGS_LMS_LOSER;
+ static int quitters = 0;
+ float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0);
+ if (!player_rank)
+ {
+ int pl_cnt = 0;
+ FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; });
+ if (player.lms_spectate_warning != 2)
+ {
+ if(IS_BOT_CLIENT(player))
+ bot_clear(player);
+ player.frags = FRAGS_LMS_LOSER;
+ PlayerScore_Add(player, SP_LMS_RANK, pl_cnt + 1);
+ }
+ else
+ {
+ lms_lowest_lives = 999;
+ FOREACH_CLIENT(true, {
+ if (it.frags == FRAGS_LMS_LOSER)
+ {
+ float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0);
+ if (it_rank > player_rank && it_rank <= 256)
+ PlayerScore_Add(it, SP_LMS_RANK, -1);
+ lms_lowest_lives = 0;
+ }
+ else if (it.frags != FRAGS_SPECTATOR)
+ {
+ float tl = PlayerScore_Add(it, SP_LMS_LIVES, 0);
+ if(tl < lms_lowest_lives)
+ lms_lowest_lives = tl;
+ }
+ });
+ PlayerScore_Add(player, SP_LMS_RANK, 665 - quitters); // different from 666
+ if(!warmup_stage)
+ {
+ PlayerScore_Add(player, SP_LMS_LIVES, -PlayerScore_Add(player, SP_LMS_LIVES, 0));
+ ++quitters;
+ }
+ player.frags = FRAGS_LMS_LOSER;
+ TRANSMUTE(Observer, player);
+ }
+ if (pl_cnt == 2 && !warmup_stage) // a player is forfeiting leaving only one player
+ lms_lowest_lives = 0; // end the game now!
+ }