Detect when a player change from Player to Spectator
This commit is contained in:
parent
0ef831d0c3
commit
8ab7886e6b
@ -380,9 +380,17 @@ foreach (Event in PendingEvents) {
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayersNbAlive <= 1 && AccountIdsOfPlayers.count >= 2) { //TODO just respawn in case of 1 player
|
||||
Net_TimeBeforeMalus = -1;
|
||||
MB_StopRound();
|
||||
// Detect when a players count changed without having triggered any of Event (when becoming spectator for example)
|
||||
if (!ThrottleUpdate && Net_PlayersNbAlive != PlayersNbAlive) {
|
||||
log("Trying to detect why the player count changed");
|
||||
foreach (Player in AllPlayers) {
|
||||
if (Player.User == Null || Player.Score == Null) continue;
|
||||
if (!AccountIdsOfPlayers.exists(Player.User.WebServicesUserId)) continue;
|
||||
if (Player.SpawnStatus != CSmPlayer::ESpawnStatus::NotSpawned) continue;
|
||||
if (IsEliminated(Player.User, Player.Score)) continue;
|
||||
UpdateCustomRanking(Player.User, True);
|
||||
ThrottleUpdate = True;
|
||||
}
|
||||
}
|
||||
|
||||
if (ThrottleUpdate) {
|
||||
@ -397,6 +405,11 @@ if (ThrottleUpdate) {
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayersNbAlive <= 1 && AccountIdsOfPlayers.count >= 2) { //TODO just respawn in case of 1 player
|
||||
Net_TimeBeforeMalus = -1;
|
||||
MB_StopRound();
|
||||
}
|
||||
|
||||
|
||||
// Update the map duration setting
|
||||
if (Map_TimeBeforeMalus != S_TimeBeforeMalus || Map_TimeBeforeMalus != S_TimeBeforeNightmare || Map_MalusEveryNSecs != S_MalusEveryNSecs || Map_NextMalusPreparationTime != S_NextMalusPreparationTime || Map_MalusDuration != S_MalusDuration || Map_RoundsPerMap != S_RoundsPerMap) {
|
||||
|
Loading…
Reference in New Issue
Block a user