/** * Lobby Gamemode */ // #RequireContext CSmMode #Extends "Modes/TrackMania/TM_TimeAttack_Online.Script.txt" #Include "Libs/Nadeo/Trackmania/Modes/Stunt/Constants.Script.txt" as StuntConstants #Const StuntConstants::C_FigureNames as C_FigureNames #Const C_Manialink_Id "Lobby.Records" #Setting S_TimeLimit 0 #Struct K_BestTime { Text PlayerName; Integer Time; } #Struct K_BestStunt { Text PlayerName; Text FigureName; Integer FigurePoints; } ***Match_StartServer*** *** UseStunts = True; *** ***Match_AfterLoadHud*** *** SetManialink(); *** ***Match_InitMatch*** *** declare netwrite K_BestTime Net_Lobby_BestTime for Teams[0]; declare netwrite Integer Net_Lobby_BestTime_Serial for Teams[0]; declare netwrite K_BestStunt Net_Lobby_BestStunt for Teams[0]; declare netwrite Integer Net_Lobby_BestStunt_Serial for Teams[0]; *** ***Match_StartMatch*** *** Net_Lobby_BestTime = K_BestTime{}; Net_Lobby_BestTime_Serial += 1; Net_Lobby_BestStunt = K_BestStunt{}; Net_Lobby_BestStunt_Serial += 1; *** ***Match_PlayLoop*** *** foreach (Event in PendingEvents) { if (Event.Player == Null || Event.Player.User == Null) continue; switch (Event.Type) { case CSmModeEvent::EType::OnPlayerTriggersWaypoint: { if (Event.IsFinish && (Net_Lobby_BestTime.Time == 0 || Net_Lobby_BestTime.Time > Event.WaypointTime)) { Net_Lobby_BestTime = K_BestTime { PlayerName = Event.Player.User.Name, Time = Event.WaypointTime }; Net_Lobby_BestTime_Serial += 1; } } case CSmModeEvent::EType::OnStuntFigure: { if (Event.StuntFigure.Points < 20) continue; declare Integer FigurePoints = Event.StuntFigure.Points * 10; declare Text FigureName = C_FigureNames[Event.StuntFigure.Name]^" "^ Event.StuntFigure.Angle ^"°"; if (Net_Lobby_BestStunt.FigurePoints == 0 || Net_Lobby_BestStunt.FigurePoints < Event.StuntFigure.Points * 10) { Net_Lobby_BestStunt = K_BestStunt { PlayerName = Event.Player.User.Name, FigureName = FigureName, FigurePoints = FigurePoints }; Net_Lobby_BestStunt_Serial += 1; } declare CUIConfig UI <=> UIManager.GetUI(Event.Player); if (UI != Null) { UI.SendChat("$CFFYou made $<$fff"^ FigurePoints ^" points$> with a $<$fff"^ FigureName^ "$>"); } } } } *** // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // /// Load Manialink Void SetManialink() { declare Text MLText = """