diff --git a/LastManStanding.Script.txt b/LastManStanding.Script.txt index ab98422..50ffd01 100644 --- a/LastManStanding.Script.txt +++ b/LastManStanding.Script.txt @@ -193,14 +193,32 @@ declare netwrite Integer Net_RoundsPerMap for Teams[0] = 0; declare netwrite Integer Net_CurrentRoundNb for Teams[0] = 0; // Map Intro -declare Integer WaitingScreenDuration = 0; -StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]); -ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro); -while (MB_MapIsRunning() && S_IntroTime - WaitingScreenDuration > 0) { - WaitingScreenDuration = WaitingScreenDuration + 1; - MB_Sleep(1000); +declare Boolean MapIsCompatible; +declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps(); +foreach (Landmark in Landmarks) { + if (Map::IsMultilap(Landmark)) { + MapIsCompatible = True; + break; + } } -ModeUtils::PopAndApplyUISequence(UIManager.UIAll); +if (!MapIsCompatible) { + UIManager.UIAll.QueueMessage(3000, 1, CUIConfig::EMessageDisplay::Big, _("This map is not valid")); + MB_Sleep(3000); + MB_StopMap(); +} else if (S_IntroTime > 0) { + declare netwrite Boolean Net_LMS_IsIntro for Teams[0]; + Net_LMS_IsIntro = True; + StateMgr::ForcePlayersStates([StateMgr::C_State_Waiting]); + ModeUtils::PushAndApplyUISequence(UIManager.UIAll, CUIConfig::EUISequence::RollingBackgroundIntro); + declare Integer WaitingScreenDuration = 0; + while (MB_MapIsRunning() && S_IntroTime - WaitingScreenDuration > 0) { + WaitingScreenDuration = WaitingScreenDuration + 1; + MB_Sleep(1000); + } + ModeUtils::PopAndApplyUISequence(UIManager.UIAll); + Net_LMS_IsIntro = False; +} + *** ***Match_StartMap*** @@ -240,64 +258,51 @@ MalusQueue = []; ---Rounds_CanSpawn--- declare Text[] AccountIdsOfPlayers for This = []; -declare CMapLandmark[] Landmarks = Map::GetFinishesAndMultilaps(); -declare Boolean MapIsCompatible; -foreach (Landmark in Landmarks) { - if (Map::IsMultilap(Landmark)) { - MapIsCompatible = True; - break; - } +declare CMapLandmark PlayerLM; +declare Integer LandmarkIndex for This = 0; +AccountIdsOfPlayers = []; + +// Suffle Players list to randomise spawn +declare CSmPlayer[] ShuffledPlayers = Players; +declare Integer i=0; +while(i Landmarks.count - 1 ) { - LandmarkIndex = 0; - } - if (Map::IsMultilap(Landmarks[LandmarkIndex])) { - PlayerLM = Landmarks[LandmarkIndex]; - } - LandmarkIndex = LandmarkIndex + 1 ; + +foreach (Player in ShuffledPlayers) { + PlayerLM = Null; + while (PlayerLM == Null) { + if (LandmarkIndex > Landmarks.count - 1 ) { + LandmarkIndex = 0; } - Race::Start(Player, PlayerLM , StartTime); - AccountIdsOfPlayers.add(Player.User.WebServicesUserId); - MalusQueue[Player.User.WebServicesUserId] = GetNewMalus(C_Malus_Reset); + if (Map::IsMultilap(Landmarks[LandmarkIndex])) { + PlayerLM = Landmarks[LandmarkIndex]; + } + LandmarkIndex = LandmarkIndex + 1 ; } - - Net_NBPlayers = AccountIdsOfPlayers.count; - - UpdateCustomRanking(Null, -1); - StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]); - CarRank::Update(CarRank::C_SortCriteria_BestRace); - Race::EnableIntroDuringMatch(False); - UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>"); + Race::Start(Player, PlayerLM , StartTime); + AccountIdsOfPlayers.add(Player.User.WebServicesUserId); + MalusQueue[Player.User.WebServicesUserId] = GetNewMalus(C_Malus_Reset); } + +Net_NBPlayers = AccountIdsOfPlayers.count; + +UpdateCustomRanking(Null, -1); +StateMgr::ForcePlayersStates([StateMgr::C_State_Playing]); +CarRank::Update(CarRank::C_SortCriteria_BestRace); +Race::EnableIntroDuringMatch(False); +UIManager.UIAll.SendChat("$<$ff3$> Stay the most time on the structure. $<$ff9GL HF!$>"); + *** /***Match_InitPlayLoop*** @@ -740,7 +745,7 @@ Void SetML() { declare TotalWidth = 44.5; declare Text MLText = """ - + + +