Fix wrong use of the Login

This commit is contained in:
Beu 2023-07-10 23:16:10 +02:00
parent e78d7f411a
commit 4a6881cbd8

View File

@ -186,7 +186,7 @@ declare Integer Map_NextMalusPreparationTime;
declare Integer Map_MalusDuration;
declare Integer Map_RoundsPerMap;
declare Text[] LoginsOfPlayers for This = [];
declare Text[] AccountIdsOfPlayers for This = [];
declare Integer LandmarkIndex for This = 0;
declare Integer[Text] CustomTimes for This = [];
declare K_Malus[Text] MalusQueue;
@ -276,11 +276,11 @@ MalusQueue = [];
// Spawn players for the race
---Rounds_CanSpawn---
declare Text[] LoginsOfPlayers for This = [];
declare Text[] AccountIdsOfPlayers for This = [];
declare CMapLandmark PlayerLM;
declare Integer LandmarkIndex for This = 0;
LoginsOfPlayers = [];
AccountIdsOfPlayers = [];
// Suffle Players list to randomise spawn
declare CSmPlayer[] ShuffledPlayers = Players;
@ -310,11 +310,11 @@ foreach (Player in ShuffledPlayers) {
LandmarkIndex = LandmarkIndex + 1 ;
}
Race::Start(Player, PlayerLM , StartTime);
LoginsOfPlayers.add(Player.User.Login);
AccountIdsOfPlayers.add(Player.User.WebServicesUserId);
MalusQueue[Player.User.Login] = GetNewMalus(C_Malus_Reset, 1500);
}
Net_NBPlayers = LoginsOfPlayers.count;
Net_NBPlayers = AccountIdsOfPlayers.count;
UpdateCustomRanking(Null, -1);
StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]);
@ -335,7 +335,7 @@ MalusQueue = [];
if (!RankInitialized) {
RankInitialized = True;
Net_PlayersNbAlive = PlayersNbAlive;
Net_NBPlayers = LoginsOfPlayers.count;
Net_NBPlayers = AccountIdsOfPlayers.count;
foreach (Player in Players) {
CarRank::SetRank(Player, PlayersNbAlive);
}
@ -348,7 +348,7 @@ if (Now < StartTime + 3000) {
declare CMapLandmark PlayerLM = Null;
if (PlayersNbDead >= 1) {
foreach (Player in Players) {
if (Player.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned && !LoginsOfPlayers.exists(Player.User.Login)) {
if (Player.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned && !AccountIdsOfPlayers.exists(Player.User.WebServicesUserId)) {
PlayerSpawned = True;
PlayerLM = Null;
while (PlayerLM == Null) {
@ -361,7 +361,7 @@ if (Now < StartTime + 3000) {
LandmarkIndex = LandmarkIndex + 1 ;
}
Race::Start(Player, PlayerLM , StartTime);
LoginsOfPlayers.add(Player.User.Login);
AccountIdsOfPlayers.add(Player.User.WebServicesUserId);
MalusQueue[Player.User.Login] = GetNewMalus(C_Malus_Reset);
}
@ -369,7 +369,7 @@ if (Now < StartTime + 3000) {
}
if (PlayerSpawned) {
PlayerSpawned = False;
Net_NBPlayers = LoginsOfPlayers.count;
Net_NBPlayers = AccountIdsOfPlayers.count;
Net_PlayersNbAlive = PlayersNbAlive;
UpdateCustomRanking(Null, -1);
foreach (Player in Players) {
@ -415,7 +415,7 @@ foreach (Event in PendingEvents) {
Events::Invalid(Event);
}
if (PlayersNbAlive <= 1 && LoginsOfPlayers.count >= 2) { //TODO just respawn in case of 1 player
if (PlayersNbAlive <= 1 && AccountIdsOfPlayers.count >= 2) { //TODO just respawn in case of 1 player
Net_TimeBeforeMalus = -1;
MB_StopRound();
}
@ -549,7 +549,7 @@ if (Round_ForceEndRound || Round_SkipPauseRound) {
declare CSmScore WinnerScore <=> Scores::GetBestPlayer(Scores::C_Sort_RoundPoints);
if (WinnerScore == Null) {
foreach (Score in Scores) {
if (Score.BestRaceTimes.count <= 0 && Score.User != Null && LoginsOfPlayers.exists(Score.User.Login)) {
if (Score.BestRaceTimes.count <= 0 && Score.User != Null && AccountIdsOfPlayers.exists(Score.User.WebServicesUserId)) {
declare CSmPlayer Player = GetPlayer(Score.User.Login);
if (Player != Null && !Player.RequestsSpectate) {
WinnerScore <=> Score;
@ -617,7 +617,7 @@ if (Round_ForceEndRound || Round_SkipPauseRound) {
*/
Void UpdateCustomRanking(CSmPlayer _EliminatedPlayer, Integer _EventType) {
declare Integer[Text] CustomTimes for This;
declare Text[] LoginsOfPlayers for This;
declare Text[] AccountIdsOfPlayers for This;
foreach (Score in Scores) {
if (Score == Null) continue;
declare CSmPlayer Player = GetPlayer(Score.User.Login);
@ -635,7 +635,7 @@ if (Round_ForceEndRound || Round_SkipPauseRound) {
Scores::SetPlayerRoundPoints(Score,PlayersNbDead);
}
}
UIModules_ScoresTable::DisplayOnly(LoginsOfPlayers);
UIModules_ScoresTable::DisplayOnly(AccountIdsOfPlayers);
UIModules_ScoresTable::SetCustomTimes(CustomTimes);
}