diff --git a/TM_DebugMode.Script.txt b/TM_DebugMode.Script.txt
index 9b0da64..bccc2d8 100644
--- a/TM_DebugMode.Script.txt
+++ b/TM_DebugMode.Script.txt
@@ -3,7 +3,7 @@
 * This mode is used to debug your modes during development.
 * To use it, you just have to change the line below to put the path of your mode:
 */
-#Extends "Modes/TrackMania/TM_TimeAttack_Online.Script.txt"
+#Extends "Modes/TM_TeamsCup.Script.txt"
 
 // #RequireContext CSmMode
 
@@ -30,12 +30,12 @@ Layers::SetType(C_DebugMode_MainUI, CUILayer::EUILayerType::Normal);
 ***Match_InitMap***
 ***
 if (S_DebugLib_RestrictUIto == "") {
-    Layers::Attach(C_DebugMode_MainUI);
+	Layers::Attach(C_DebugMode_MainUI);
 } else {
-    foreach (Login in TL::Split(",", S_DebugLib_RestrictUIto)) {
-        declare CSmPlayer Player = GetPlayer(Login);
-        if (Player != Null) Layers::Attach(C_DebugMode_MainUI, Player);
-    }
+	foreach (Login in TL::Split(",", S_DebugLib_RestrictUIto)) {
+		declare CSmPlayer Player = GetPlayer(Login);
+		if (Player != Null) Layers::Attach(C_DebugMode_MainUI, Player);
+	}
 }
 ***
 
@@ -43,221 +43,221 @@ if (S_DebugLib_RestrictUIto == "") {
 ***
 // Manage Custom UI Events
 foreach (Event in UIManager.PendingEvents) {
-    +++DebugMode_LogFormat+++
-    switch (Event.CustomEventType) {
-        case "DebugMode.ClearLogs": {
-            Net_DebugMode_Logs = Prefix ^ "Logs cleared";
-        }
-        case "DebugMode.Bots.DelBots": {
-            declare Text Name = Event.CustomEventData[0];
-            declare Integer NumberOfBots = TL::ToInteger(Event.CustomEventData[1]);
-            if (NumberOfBots == -1) {
-                Users_DestroyAllFakes();
-            } else {
-                foreach (Player in AllPlayers) {
-                    if (Player.IsFakePlayer) {
-                        if (Name == "" || TL::ToLowerCase(Player.User.Name) == TL::ToLowerCase(Name)) {
-                            Net_DebugMode_Logs = Prefix ^ "Bots: Remove bot \"" ^ Player.User.Name ^ "\"\n" ^ Net_DebugMode_Logs;
-                            Users_DestroyFake(Player.User);
-                            NumberOfBots -= 1;
-                        } else {
-                            Net_DebugMode_Logs = Prefix ^ "Bots: Player not found\n" ^ Net_DebugMode_Logs;
-                        }
-                    }
-                    if (NumberOfBots == 0) break;
-                }
-            }
-        }
-        case "DebugMode.Bots.AddBots": {
-            declare Text Name = Event.CustomEventData[0];
-            declare Integer TeamId = TL::ToInteger(Event.CustomEventData[1]);
-            if (TeamId == -1 && Event.CustomEventData[1] == "") TeamId = 0;
-            declare Integer NumberOfBots = TL::ToInteger(Event.CustomEventData[2]);
-            if (TeamId != -1 && Teams.existskey(TeamId)) {
-                for (I, 1, NumberOfBots) {
-                    declare CUser User = Users_CreateFake(Name, TeamId);
-                    if (User != Null) {
-                        Net_DebugMode_Logs = Prefix ^ "Bots: Add bot \"" ^ User.Name ^ "\"\n" ^ Net_DebugMode_Logs;
-                    } else {
-                        Net_DebugMode_Logs = Prefix ^ "Bots: unknown error while adding bot \"" ^ Name ^ "\"\n" ^ Net_DebugMode_Logs;
-                    }
-                }
-            } else {
-                Net_DebugMode_Logs = Prefix ^ "Bots: Invalid TeamId\n" ^ Net_DebugMode_Logs;
-            }
-        }
-        case "DebugMode.PlayersControl.Set": {
-            declare Text TargetText = Event.CustomEventData[2];
-            declare CSmPlayer[] Targets;
-            if (TargetText == "allbots" || TargetText == "allplayers") {
-                foreach (Player in Players) {
-                    if (TargetText == "allbots" && !Player.IsFakePlayer) continue;
-                    Targets.add(Player); 
-                }
-            } else {
-                declare CSmPlayer TmpPlayer = GetPlayer(TargetText);
-                if (TmpPlayer != Null) {
-                    Targets.add(TmpPlayer);
-                }
-            }
-            declare Real[] Speed;
-            foreach (SpeedText in TL::Split(",", Event.CustomEventData[0])) {
-                Speed.add(ML::Clamp(TL::ToReal(SpeedText), -999., 999.));
-            }
-            if (Speed.count > 0) {
-                declare Real[] Steer;
-                foreach (SteerText in TL::Split(",", Event.CustomEventData[1])) {
-                    Steer.add(ML::Clamp(TL::ToReal(SteerText), -1., 1.));
-                }
-
-                foreach (Target in Targets) {
-                    if (Target.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned) continue;
-
-                    Target.TrustClientSimu = False;
-                    SetPlayerVehicle_ControlledByMode(Target, True);
-
-                    declare Real SteerValue;
-                    if (Steer.count == 2) {
-                        SteerValue = ML::Rand(Steer[0] , Steer[1]);
-                    } else if (Steer.count == 1) {
-                        SteerValue = Steer[0];
-                    } else {
-                        SteerValue = 0.;
-                    }
-                    SetPlayerVehicle_SteerValue(Target, SteerValue);
-
-                    declare Real SpeedValue;
-                    if (Speed.count == 1) {
-                        SpeedValue = Speed[0];
-                    } else {
-                        SpeedValue = ML::Rand(Speed[0], Speed[1]);
-                    }
-                    SetPlayerVehicle_TargetSpeedValue(Target, SpeedValue);
-
-                    Net_DebugMode_Logs = Prefix ^ "PlayersControl: Set Player " ^ Target.User.Name ^ " speed to " ^ SpeedValue ^ " & steer to " ^ SteerValue ^ "\n" ^ Net_DebugMode_Logs;
-                }
-            } else {
-                foreach (Target in Targets) {
-                    if (Target.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned) continue;
-
-                    SetPlayerVehicle_ControlledByMode(Target, False);
-                    Race::ApplyNetworkMode(Target); //< Restore TrustClientSimu to its default value
-                }
-            }
-        }
-        case "DebugMode.VarInsp.Dump.Teams0": {
-            declare Text tmp = Net_DebugMode_Logs;
-            Net_DebugMode_Logs = "";
-            Net_DebugMode_Logs = Prefix ^ "Teams[0] dump:\n" ^ Dbg_DumpDeclareForVariables(Teams[0], False) ^"\n" ^ tmp;
-        }
-        case "DebugMode.VarInsp.Dump.UIAll": {
-            Net_DebugMode_Logs = Prefix ^ "UIAll dump:\n" ^ Dbg_DumpDeclareForVariables(UIManager.UIAll, False) ^"\n" ^ Net_DebugMode_Logs;
-        }
-        case "DebugMode.VarInsp.Dump.This": {
-            Net_DebugMode_Logs = Prefix ^ "This dump:\n" ^ Dbg_DumpDeclareForVariables(This, False) ^"\n" ^ Net_DebugMode_Logs;
-        }
-        case "DebugMode.VarInsp.ForVars.Dump.Player": {
-            declare CSmPlayer Player;
-            if (TL::Length(Event.CustomEventData[0]) == 36) {
-                Player <=> ModeUtils::GetPlayerFromAccountId(Event.CustomEventData[0]);
-            } else if (TL::Length(Event.CustomEventData[0]) == 22) {
-                Player <=> GetPlayer(Event.CustomEventData[0]);
-            } else {
-                foreach (TmpPlayer in AllPlayers) {
-                    if (TL::ToLowerCase(Event.CustomEventData[0]) == TL::ToLowerCase(TmpPlayer.User.Name)) {
-                        Player <=> TmpPlayer;
-                        break;
-                    }
-                }
-            }
-
-            if (Player != Null) {
-                if (Event.CustomEventData[1] == "player") {
-                    Net_DebugMode_Logs = Prefix ^ "Player ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(Player, False) ^"\n" ^ Net_DebugMode_Logs;
-                } else if (Event.CustomEventData[1] == "score") {
-                    Net_DebugMode_Logs = Prefix ^ "Score ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(Player.Score, False) ^"\n" ^ Net_DebugMode_Logs;
-                } else {
-                    declare CUIConfig UI = UIManager.GetUI(Player);
-                    if (UI != Null) {
-                        Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(UI, False) ^"\n" ^ Net_DebugMode_Logs;
-                    } else {
-                        Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ": no UI found (it's a bot?)\n" ^ Net_DebugMode_Logs;
-                    }
-                }
-            } else {
-                Net_DebugMode_Logs = Prefix ^ "ForVars dump: player not found\n" ^ Net_DebugMode_Logs;
-            }
-        }
-        case "DebugMode.VarInsp.Struct.Dump.Player": {
-            declare CSmPlayer Player;
-            if (TL::Length(Event.CustomEventData[0]) == 36) {
-                Player <=> ModeUtils::GetPlayerFromAccountId(Event.CustomEventData[0]);
-            } else if (TL::Length(Event.CustomEventData[0]) == 22) {
-                Player <=> GetPlayer(Event.CustomEventData[0]);
-            } else {
-                foreach (TmpPlayer in AllPlayers) {
-                    if (TL::ToLowerCase(Event.CustomEventData[0]) == TL::ToLowerCase(TmpPlayer.User.Name)) {
-                        Player <=> TmpPlayer;
-                        break;
-                    }
-                }
-            }
-
-            if (Player != Null) {
-                if (Event.CustomEventData[1] == "player") {
-                    Net_DebugMode_Logs = Prefix ^ "Player Struct dump for " ^ Player.User.Name ^ ":\n" ^ Player ^"\n" ^ Net_DebugMode_Logs;
-                } else if (Event.CustomEventData[1] == "score") {
-                    Net_DebugMode_Logs = Prefix ^ "Score Struct dump for " ^ Player.User.Name ^ ":\n" ^ Player.Score ^"\n" ^ Net_DebugMode_Logs;
-                } else {
-                    declare CUIConfig UI = UIManager.GetUI(Player);
-                    if (UI != Null) {
-                        Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ":\n" ^ UI ^"\n" ^ Net_DebugMode_Logs;
-                    } else {
-                        Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ": no UI found (it's a bot?)\n" ^ Net_DebugMode_Logs;
-                    }
-                }
-            } else {
-                Net_DebugMode_Logs = Prefix ^ "Struct dump: player not found\n" ^ Net_DebugMode_Logs;
-            }
-        }
-        default: {
-            Net_DebugMode_Logs = Prefix ^ "Struct Event received: " ^ Event.CustomEventType ^"\n" ^ Net_DebugMode_Logs;
-        }
-    }
+	+++DebugMode_LogFormat+++
+	switch (Event.CustomEventType) {
+		case "DebugMode.ClearLogs": {
+			Net_DebugMode_Logs = Prefix ^ "Logs cleared";
+		}
+		case "DebugMode.Bots.DelBots": {
+			declare Text Name = Event.CustomEventData[0];
+			declare Integer NumberOfBots = TL::ToInteger(Event.CustomEventData[1]);
+			if (NumberOfBots == -1) {
+				Users_DestroyAllFakes();
+			} else {
+				foreach (Player in AllPlayers) {
+					if (Player.IsFakePlayer) {
+						if (Name == "" || TL::ToLowerCase(Player.User.Name) == TL::ToLowerCase(Name)) {
+							Net_DebugMode_Logs = Prefix ^ "Bots: Remove bot \"" ^ Player.User.Name ^ "\"\n" ^ Net_DebugMode_Logs;
+							Users_DestroyFake(Player.User);
+							NumberOfBots -= 1;
+						} else {
+							Net_DebugMode_Logs = Prefix ^ "Bots: Player not found\n" ^ Net_DebugMode_Logs;
+						}
+					}
+					if (NumberOfBots == 0) break;
+				}
+			}
+		}
+		case "DebugMode.Bots.AddBots": {
+			declare Text Name = Event.CustomEventData[0];
+			declare Integer TeamId = TL::ToInteger(Event.CustomEventData[1]);
+			if (TeamId == -1 && Event.CustomEventData[1] == "") TeamId = 0;
+			declare Integer NumberOfBots = TL::ToInteger(Event.CustomEventData[2]);
+			if (TeamId != -1 && Teams.existskey(TeamId)) {
+				for (I, 1, NumberOfBots) {
+					declare CUser User = Users_CreateFake(Name, TeamId);
+					if (User != Null) {
+						Net_DebugMode_Logs = Prefix ^ "Bots: Add bot \"" ^ User.Name ^ "\"\n" ^ Net_DebugMode_Logs;
+					} else {
+						Net_DebugMode_Logs = Prefix ^ "Bots: unknown error while adding bot \"" ^ Name ^ "\"\n" ^ Net_DebugMode_Logs;
+					}
+				}
+			} else {
+				Net_DebugMode_Logs = Prefix ^ "Bots: Invalid TeamId\n" ^ Net_DebugMode_Logs;
+			}
+		}
+		case "DebugMode.PlayersControl.Set": {
+			declare Text TargetText = Event.CustomEventData[2];
+			declare CSmPlayer[] Targets;
+			if (TargetText == "allbots" || TargetText == "allplayers") {
+				foreach (Player in Players) {
+					if (TargetText == "allbots" && !Player.IsFakePlayer) continue;
+					Targets.add(Player); 
+				}
+			} else {
+				declare CSmPlayer TmpPlayer = GetPlayer(TargetText);
+				if (TmpPlayer != Null) {
+					Targets.add(TmpPlayer);
+				}
+			}
+			declare Real[] Speed;
+			foreach (SpeedText in TL::Split(",", Event.CustomEventData[0])) {
+				Speed.add(ML::Clamp(TL::ToReal(SpeedText), -999., 999.));
+			}
+			if (Speed.count > 0) {
+				declare Real[] Steer;
+				foreach (SteerText in TL::Split(",", Event.CustomEventData[1])) {
+					Steer.add(ML::Clamp(TL::ToReal(SteerText), -1., 1.));
+				}
+				
+				foreach (Target in Targets) {
+					if (Target.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned) continue;
+					
+					Target.TrustClientSimu = False;
+					SetPlayerVehicle_ControlledByMode(Target, True);
+					
+					declare Real SteerValue;
+					if (Steer.count == 2) {
+						SteerValue = ML::Rand(Steer[0] , Steer[1]);
+					} else if (Steer.count == 1) {
+						SteerValue = Steer[0];
+					} else {
+						SteerValue = 0.;
+					}
+					SetPlayerVehicle_SteerValue(Target, SteerValue);
+					
+					declare Real SpeedValue;
+					if (Speed.count == 1) {
+						SpeedValue = Speed[0];
+					} else {
+						SpeedValue = ML::Rand(Speed[0], Speed[1]);
+					}
+					SetPlayerVehicle_TargetSpeedValue(Target, SpeedValue);
+					
+					Net_DebugMode_Logs = Prefix ^ "PlayersControl: Set Player " ^ Target.User.Name ^ " speed to " ^ SpeedValue ^ " & steer to " ^ SteerValue ^ "\n" ^ Net_DebugMode_Logs;
+				}
+			} else {
+				foreach (Target in Targets) {
+					if (Target.SpawnStatus == CSmPlayer::ESpawnStatus::NotSpawned) continue;
+					
+					SetPlayerVehicle_ControlledByMode(Target, False);
+					Race::ApplyNetworkMode(Target); //< Restore TrustClientSimu to its default value
+				}
+			}
+		}
+		case "DebugMode.VarInsp.Dump.Teams0": {
+			declare Text tmp = Net_DebugMode_Logs;
+			Net_DebugMode_Logs = "";
+			Net_DebugMode_Logs = Prefix ^ "Teams[0] dump:\n" ^ Dbg_DumpDeclareForVariables(Teams[0], False) ^"\n" ^ tmp;
+		}
+		case "DebugMode.VarInsp.Dump.UIAll": {
+			Net_DebugMode_Logs = Prefix ^ "UIAll dump:\n" ^ Dbg_DumpDeclareForVariables(UIManager.UIAll, False) ^"\n" ^ Net_DebugMode_Logs;
+		}
+		case "DebugMode.VarInsp.Dump.This": {
+			Net_DebugMode_Logs = Prefix ^ "This dump:\n" ^ Dbg_DumpDeclareForVariables(This, False) ^"\n" ^ Net_DebugMode_Logs;
+		}
+		case "DebugMode.VarInsp.ForVars.Dump.Player": {
+			declare CSmPlayer Player;
+			if (TL::Length(Event.CustomEventData[0]) == 36) {
+				Player <=> ModeUtils::GetPlayerFromAccountId(Event.CustomEventData[0]);
+			} else if (TL::Length(Event.CustomEventData[0]) == 22) {
+				Player <=> GetPlayer(Event.CustomEventData[0]);
+			} else {
+				foreach (TmpPlayer in AllPlayers) {
+					if (TL::ToLowerCase(Event.CustomEventData[0]) == TL::ToLowerCase(TmpPlayer.User.Name)) {
+						Player <=> TmpPlayer;
+						break;
+					}
+				}
+			}
+			
+			if (Player != Null) {
+				if (Event.CustomEventData[1] == "player") {
+					Net_DebugMode_Logs = Prefix ^ "Player ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(Player, False) ^"\n" ^ Net_DebugMode_Logs;
+				} else if (Event.CustomEventData[1] == "score") {
+					Net_DebugMode_Logs = Prefix ^ "Score ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(Player.Score, False) ^"\n" ^ Net_DebugMode_Logs;
+				} else {
+					declare CUIConfig UI = UIManager.GetUI(Player);
+					if (UI != Null) {
+						Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ":\n" ^ Dbg_DumpDeclareForVariables(UI, False) ^"\n" ^ Net_DebugMode_Logs;
+					} else {
+						Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ": no UI found (it's a bot?)\n" ^ Net_DebugMode_Logs;
+					}
+				}
+			} else {
+				Net_DebugMode_Logs = Prefix ^ "ForVars dump: player not found\n" ^ Net_DebugMode_Logs;
+			}
+		}
+		case "DebugMode.VarInsp.Struct.Dump.Player": {
+			declare CSmPlayer Player;
+			if (TL::Length(Event.CustomEventData[0]) == 36) {
+				Player <=> ModeUtils::GetPlayerFromAccountId(Event.CustomEventData[0]);
+			} else if (TL::Length(Event.CustomEventData[0]) == 22) {
+				Player <=> GetPlayer(Event.CustomEventData[0]);
+			} else {
+				foreach (TmpPlayer in AllPlayers) {
+					if (TL::ToLowerCase(Event.CustomEventData[0]) == TL::ToLowerCase(TmpPlayer.User.Name)) {
+						Player <=> TmpPlayer;
+						break;
+					}
+				}
+			}
+			
+			if (Player != Null) {
+				if (Event.CustomEventData[1] == "player") {
+					Net_DebugMode_Logs = Prefix ^ "Player Struct dump for " ^ Player.User.Name ^ ":\n" ^ Player ^"\n" ^ Net_DebugMode_Logs;
+				} else if (Event.CustomEventData[1] == "score") {
+					Net_DebugMode_Logs = Prefix ^ "Score Struct dump for " ^ Player.User.Name ^ ":\n" ^ Player.Score ^"\n" ^ Net_DebugMode_Logs;
+				} else {
+					declare CUIConfig UI = UIManager.GetUI(Player);
+					if (UI != Null) {
+						Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ":\n" ^ UI ^"\n" ^ Net_DebugMode_Logs;
+					} else {
+						Net_DebugMode_Logs = Prefix ^ "UI ForVars dump for " ^ Player.User.Name ^ ": no UI found (it's a bot?)\n" ^ Net_DebugMode_Logs;
+					}
+				}
+			} else {
+				Net_DebugMode_Logs = Prefix ^ "Struct dump: player not found\n" ^ Net_DebugMode_Logs;
+			}
+		}
+		default: {
+			Net_DebugMode_Logs = Prefix ^ "Struct Event received: " ^ Event.CustomEventType ^"\n" ^ Net_DebugMode_Logs;
+		}
+	}
 }
 
 foreach (Event in PendingEvents) {
-    +++DebugMode_LogFormat+++
-    Net_DebugMode_Logs = Prefix ^ "CSmMode PendingEvent: " ^ Event.Type ^"\n" ^ Net_DebugMode_Logs;
-    if (Event.Type == CSmModeEvent::EType::OnPlayerAdded) {
-        if (Event.Player != Null && TL::Split(",", S_DebugLib_RestrictUIto).exists(Event.Player.User.Login)) {
-            Layers::Attach(C_DebugMode_MainUI, Event.Player);
-        }
-    }
+	+++DebugMode_LogFormat+++
+	Net_DebugMode_Logs = Prefix ^ "CSmMode PendingEvent: " ^ Event.Type ^"\n" ^ Net_DebugMode_Logs;
+	if (Event.Type == CSmModeEvent::EType::OnPlayerAdded) {
+		if (Event.Player != Null && TL::Split(",", S_DebugLib_RestrictUIto).exists(Event.Player.User.Login)) {
+			Layers::Attach(C_DebugMode_MainUI, Event.Player);
+		}
+	}
 }
 
 foreach (Event in XmlRpc.PendingEvents) {
-    +++DebugMode_LogFormat+++
-    if (Event.Type == CXmlRpcEvent::EType::CallbackArray) {
-        Net_DebugMode_Logs = Prefix ^ "XmlRpc PendingEvent: " ^ Event.ParamArray1 ^"\n" ^ Net_DebugMode_Logs;
-    } else {
-        Net_DebugMode_Logs = Prefix ^ "XmlRpc PendingEvent: " ^ Event.Param1 ^"\n" ^ Net_DebugMode_Logs;
-    }
+	+++DebugMode_LogFormat+++
+	if (Event.Type == CXmlRpcEvent::EType::CallbackArray) {
+		Net_DebugMode_Logs = Prefix ^ "XmlRpc PendingEvent: " ^ Event.ParamArray1 ^"\n" ^ Net_DebugMode_Logs;
+	} else {
+		Net_DebugMode_Logs = Prefix ^ "XmlRpc PendingEvent: " ^ Event.Param1 ^"\n" ^ Net_DebugMode_Logs;
+	}
 }
 
 declare RacePendingEvents = Race::GetPendingEvents();
 foreach (Event in RacePendingEvents) {
-    +++DebugMode_LogFormat+++
-    declare Text Type = "Unknown";
-    switch (Event.Type) {
-        case 1: Type = "Waypoint";
-        case 2: Type = "GiveUp";
-        case 3: Type = "Respawn";
-        case 4: Type = "SkipOutro";
-        case 5: Type = "StartLine";
-        case 6: Type = "Eliminated";
-    }
-    Net_DebugMode_Logs = Prefix ^ "Race Pending Event: " ^ Type ^"\n" ^ Net_DebugMode_Logs;
+	+++DebugMode_LogFormat+++
+	declare Text Type = "Unknown";
+	switch (Event.Type) {
+		case 1: Type = "Waypoint";
+		case 2: Type = "GiveUp";
+		case 3: Type = "Respawn";
+		case 4: Type = "SkipOutro";
+		case 5: Type = "StartLine";
+		case 6: Type = "Eliminated";
+	}
+	Net_DebugMode_Logs = Prefix ^ "Race Pending Event: " ^ Type ^"\n" ^ Net_DebugMode_Logs;
 }
 ***
 
@@ -280,7 +280,7 @@ Prefix ^= "] ";
 
 declare netwrite Text Net_DebugMode_Logs for Teams[0];
 if (TL::Length(Net_DebugMode_Logs) > 1000000) {
-    Net_DebugMode_Logs = TL::SubString(Net_DebugMode_Logs, 0, 1000000);
+	Net_DebugMode_Logs = TL::SubString(Net_DebugMode_Logs, 0, 1000000);
 }
 
 
@@ -289,611 +289,620 @@ Net_DebugMode_Logs_Serial += 1;
 ***
 
 Text GetManialink() {
-    return """
-    
-    
-        
-            
-            
-            
-            
-            
-        
-        
-            
-        
-        
-            
-                
-                
-            
-            
-                
-                
-            
-            
-                
-                    
-                        
-                        
-                            
-                            
-                        
-                        
-                            
-                            
-                        
-                    
-                    
-                    
-                        
-                        
-                        
-                    
-                    
-                        
-                            
-                            
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                            
-                        
-                        
-                            
-                                
-                                    
-                                    
-                                    
-                                
-                                
-                            
-                            
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                            
-                            
-                                
-                                    
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                
-                            
-                            
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                            
-                            
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                
-                                
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                
-                                
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                    
-                                        
-                                        
-                                    
-                                
-                            
-                        
-                    
-                    
-                
-            
-        
-        
-    
-    """;
+main() {
+	declare CMlFrame Frame_MainUI = (Page.GetFirstChild("frame-mainui") as CMlFrame);
+	
+	declare CMlFrame Frame_Tooltip = (Page.GetFirstChild("frame-tooltip") as CMlFrame);
+	declare CMlQuad Quad_Tooltip = (Page.GetFirstChild("quad-tooltip") as CMlQuad);
+	declare CMlLabel Label_Tooltip = (Page.GetFirstChild("label-tooltip") as CMlLabel);
+	
+	declare CMlQuad Quad_Topbar = (Page.GetFirstChild("quad-topbar") as CMlQuad);
+	declare CMlFrame Frame_Topbar_Buttons = (Page.GetFirstChild("frame-topbar-buttons") as CMlFrame);
+	declare CMlQuad Quad_Topbar_Maximize = (Page.GetFirstChild("quad-topbar-maximize") as CMlQuad);
+	
+	declare CMlQuad Quad_Background = (Page.GetFirstChild("quad-background") as CMlQuad);
+	
+	declare CMlQuad Quad_Border_Bottom = (Page.GetFirstChild("quad-border-bottom") as CMlQuad);
+	declare CMlQuad Quad_Border_Right = (Page.GetFirstChild("quad-border-right") as CMlQuad);
+	declare CMlQuad Quad_Corner_BottomRight = (Page.GetFirstChild("quad-corner-bottomright") as CMlQuad);
+	
+	declare CMlQuad Quad_LeftPanel_Separator = (Page.GetFirstChild("quad-leftpanel-separator") as CMlQuad);
+	
+	declare CMlTextEdit TextEdit_Logs = (Page.GetFirstChild("textedit-logs") as CMlTextEdit);
+	
+	declare CMlEntry Entry_Bots_Name = (Page.GetFirstChild("entry-bots-name") as CMlEntry);
+	declare CMlEntry Entry_Bots_TeamId = (Page.GetFirstChild("entry-bots-teamid") as CMlEntry);
+	
+	declare CMlEntry Entry_PlayersControl_Speed = (Page.GetFirstChild("entry-playerscontrol-speed") as CMlEntry);
+	declare CMlEntry Entry_PlayersControl_Steer = (Page.GetFirstChild("entry-playerscontrol-steer") as CMlEntry);
+	
+	declare CMlEntry Entry_CustomEvent_Name = (Page.GetFirstChild("entry-customevent-name") as CMlEntry);
+	declare CMlEntry Entry_CustomEvent_Data = (Page.GetFirstChild("entry-customevent-data") as CMlEntry);
+	
+	declare CMlEntry Entry_VarInsp_Players = (Page.GetFirstChild("entry-varinsp-player") as CMlEntry);
+	
+	wait(InputPlayer != Null);
+	declare persistent Boolean P_DebugMode_Window_Open for InputPlayer.User;
+	Frame_MainUI.Visible = P_DebugMode_Window_Open;
+	declare persistent Boolean P_DebugMode_IsMaximized for InputPlayer.User;
+	declare persistent Vec2 P_DebugMode_Window_Pos for InputPlayer.User = <-100., 65.>;
+	declare persistent Vec2 P_DebugMode_Window_Size for InputPlayer.User = <100., 60.>;
+	if (P_DebugMode_IsMaximized) {
+		Frame_MainUI.RelativePosition_V3 = <-160., 85.>;
+		Quad_Background.Size = <320., 175.>;
+		Quad_Topbar_Maximize.StyleSelected = True;
+	} else {
+		Frame_MainUI.RelativePosition_V3 = P_DebugMode_Window_Pos;
+		Quad_Background.Size = P_DebugMode_Window_Size;
+	}
+	declare persistent Text P_DebugMode_SelectedTab for InputPlayer.User = "quad-leftpanel-logs";
+	SwitchToTab("", P_DebugMode_SelectedTab);
+	declare persistent Text P_DebugMode_CustomEvent_Name for InputPlayer.User;
+	Entry_CustomEvent_Name.Value = P_DebugMode_CustomEvent_Name;
+	declare persistent Text P_DebugMode_CustomEvent_Data for InputPlayer.User;
+	Entry_CustomEvent_Data.Value = P_DebugMode_CustomEvent_Data;
+	declare persistent Text P_DebugMode_VarInsp_Players for InputPlayer.User;
+	Entry_VarInsp_Players.Value = P_DebugMode_VarInsp_Players;
+	declare persistent Text P_DebugMode_Bots_Name for InputPlayer.User;
+	Entry_Bots_Name.Value = P_DebugMode_Bots_Name;
+	declare persistent Text P_DebugMode_Bots_TeamId for InputPlayer.User;
+	Entry_Bots_TeamId.Value = P_DebugMode_Bots_TeamId;
+	declare persistent Text P_DebugMode_PlayersControl_Speed for InputPlayer.User;
+	Entry_PlayersControl_Speed.Value = P_DebugMode_PlayersControl_Speed;
+	declare persistent Text P_DebugMode_PlayersControl_Steer for InputPlayer.User;
+	Entry_PlayersControl_Steer.Value = P_DebugMode_PlayersControl_Steer;
+	
+	declare netread Text Net_DebugMode_Logs for Teams[0];
+	declare netread Integer Net_DebugMode_Logs_Serial for Teams[0];
+	declare Integer Last_Logs_Serial;
+	
+	declare Boolean Last_DragAndDrop_State = False;
+	declare Vec2 Last_DragAndDrop_Offset;
+	
+	declare Text[] Last_BorderResize_Side;
+	declare Vec2 Last_BorderResize_Offset;
+	declare Real Last_BorderResize_SizeOffset;
+	
+	while (True) {
+		yield;
+		foreach (Event in PendingEvents) {
+			switch (Event.Type) {
+				case CMlScriptEvent::Type::MouseClick: {
+					switch (Event.Control.ControlId) {
+						case "quad-displaybutton": {
+							Frame_MainUI.Visible = !Frame_MainUI.Visible;
+							P_DebugMode_Window_Open = Frame_MainUI.Visible;
+						}
+						case "quad-topbar-quit": {
+							Frame_MainUI.Visible = False;
+							P_DebugMode_Window_Open = Frame_MainUI.Visible;
+						}
+						case "quad-topbar-maximize": {
+							P_DebugMode_IsMaximized = MaximizeMinimizeWindow(Quad_Topbar_Maximize, Frame_MainUI, P_DebugMode_Window_Pos, Quad_Background, P_DebugMode_Window_Size);
+						}
+						case "quad-topbar": {
+							if (!P_DebugMode_IsMaximized) {
+								Last_DragAndDrop_State = True;
+								Last_DragAndDrop_Offset = ;
+							}
+						}
+						case "quad-border-bottom": {
+							if (!P_DebugMode_IsMaximized) {
+								Last_BorderResize_Side.add("bottom");
+								Last_BorderResize_Offset = ;
+							}
+						}
+						case "quad-border-right": {
+							if (!P_DebugMode_IsMaximized) {
+								Last_BorderResize_Side.add("right");
+								Last_BorderResize_Offset = ;
+							}
+						}
+						case "quad-corner-bottomright": {
+							if (!P_DebugMode_IsMaximized) {
+								Last_BorderResize_Side = ["bottom","right"];
+								Last_BorderResize_Offset = ;
+							}
+						}
+						case "quad-clearlogs": {
+							SendCustomEvent("DebugMode.ClearLogs", []);
+						}
+						case "quad-sendcustomevent": {
+							SendCustomEvent(Entry_CustomEvent_Name.Value, TL::Split(",", Entry_CustomEvent_Data.Value));
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+						case "quad-varinsp-forvars-dumpthis": {
+							SendCustomEvent("DebugMode.VarInsp.Dump.This", []);
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+						case "quad-varinsp-forvars-dumpteams0": {
+							SendCustomEvent("DebugMode.VarInsp.Dump.Teams0", []);
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+						case "quad-varinsp-forvars-dumpuiall": {
+							SendCustomEvent("DebugMode.VarInsp.Dump.UIAll", []);
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+						case "quad-varinsp-forvars-autofill-me": {
+							Entry_VarInsp_Players.Value = InputPlayer.User.Name;
+						}
+						case "quad-varinsp-forvars-autofill-visible": {
+							if (GUIPlayer != Null) {
+								Entry_VarInsp_Players.Value = GUIPlayer.User.Name;
+							} else {
+								Entry_VarInsp_Players.Value = "";
+							}
+						}
+					}
+					if (TL::StartsWith("quad-bots-delbots-", Event.Control.ControlId)) {
+						SendCustomEvent("DebugMode.Bots.DelBots", [Entry_Bots_Name.Value, TL::Split("-",Event.Control.ControlId)[3]]);
+						SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+						P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+					}
+					if (TL::StartsWith("quad-bots-addbots-", Event.Control.ControlId)) {
+						SendCustomEvent("DebugMode.Bots.AddBots", [Entry_Bots_Name.Value, Entry_Bots_TeamId.Value, TL::Split("-",Event.Control.ControlId)[3]]);
+						SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+						P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+					}
+					if (TL::StartsWith("quad-playerscontrol-player-", Event.Control.ControlId)) {
+						declare Text Target = TL::Split("-",Event.Control.ControlId)[3];
+						if (Target != "visible" || (Target == "visible" && GUIPlayer != Null)) {
+							if (Target == "visible") {
+								Target = GUIPlayer.User.Login;
+							}
+							SendCustomEvent("DebugMode.PlayersControl.Set", [Entry_PlayersControl_Speed.Value, Entry_PlayersControl_Steer.Value, Target]);
+						}
+					}
+					if (TL::StartsWith("quad-varinsp-forvars-player-", Event.Control.ControlId)) {
+						if (Entry_VarInsp_Players.Value != "") {
+							SendCustomEvent("DebugMode.VarInsp.ForVars.Dump.Player", [Entry_VarInsp_Players.Value, TL::Split("-",Event.Control.ControlId)[4]]);
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+					}
+					if (TL::StartsWith("quad-varinsp-struct-player-", Event.Control.ControlId)) {
+						if (Entry_VarInsp_Players.Value != "") {
+							SendCustomEvent("DebugMode.VarInsp.Struct.Dump.Player", [Entry_VarInsp_Players.Value, TL::Split("-",Event.Control.ControlId)[4]]);
+							SwitchToTab(P_DebugMode_SelectedTab, "quad-leftpanel-logs");
+							P_DebugMode_SelectedTab = "quad-leftpanel-logs";
+						}
+					}
+					if (Event.Control.HasClass("leftpanel-button")) {
+						SwitchToTab(P_DebugMode_SelectedTab, Event.Control.ControlId);
+						P_DebugMode_SelectedTab = Event.Control.ControlId;
+					}
+					// Save value to persistent variable
+					P_DebugMode_CustomEvent_Name = Entry_CustomEvent_Name.Value;
+					P_DebugMode_CustomEvent_Data = Entry_CustomEvent_Data.Value;
+					P_DebugMode_VarInsp_Players = Entry_VarInsp_Players.Value;
+					P_DebugMode_Bots_Name = Entry_Bots_Name.Value;
+					P_DebugMode_Bots_TeamId = Entry_Bots_TeamId.Value;
+					P_DebugMode_PlayersControl_Speed = Entry_PlayersControl_Speed.Value;
+					P_DebugMode_PlayersControl_Steer = Entry_PlayersControl_Steer.Value;
+				}
+				case CMlScriptEvent::Type::MouseRightClick: {
+					if (TL::StartsWith("quad-playerscontrol-player-", Event.Control.ControlId)) {
+						declare Text Target = TL::Split("-",Event.Control.ControlId)[3];
+						if (Target != "visible" || (Target == "visible" && GUIPlayer != Null)) {
+							if (Target == "visible") {
+								Target = GUIPlayer.User.Login;
+							}
+							SendCustomEvent("DebugMode.PlayersControl.Set", ["", "", Target]);
+						}
+					}
+				}
+				case CMlScriptEvent::Type::MouseOver: {
+					if (Event.Control.Parent.ToolTip != "") {
+						Frame_Tooltip.Visible = True;
+						Label_Tooltip.Value = Event.Control.Parent.ToolTip;
+						
+						// ComputeHeigth is bugged with multiple lines
+						declare Real TextWidth = Label_Tooltip.ComputeWidth(Event.Control.Parent.ToolTip) + 1.;
+						Label_Tooltip.Size.X = ML::Min(30., TextWidth);
+						if (TextWidth > 30.) {
+							Label_Tooltip.Size.Y = ML::ToReal(ML::FloorInteger((TextWidth / 30 + 1.) * 3.));
+						} else {
+							Label_Tooltip.Size.Y = 3.;
+						}
+						
+						Quad_Tooltip.Size.X = ComputeBackgroundSize(Label_Tooltip, Event.Control.Parent.ToolTip, 30.) + .5;
+						Quad_Tooltip.Size.Y = Label_Tooltip.Size.Y + 1.5;
+					}
+					if (Event.Control.HasClass("button")) {
+						declare CMlQuad Quad = (Event.Control as CMlQuad);
+						Quad.Opacity = .9;
+					} else if (Event.Control.HasClass("border")) {
+						declare CMlQuad Quad = (Event.Control as CMlQuad);
+						Quad.Opacity = 1.;
+					} else if (Event.Control.HasClass("leftpanel-button")) {
+						declare CMlQuad Quad = (Event.Control as CMlQuad);
+						Quad.Opacity = .2;
+					}
+				}
+				case CMlScriptEvent::Type::MouseOut: {
+					if (Event.Control.Parent.ToolTip != "") {
+						Frame_Tooltip.Visible = False;
+					}
+					if (Event.Control.HasClass("button")) {
+						declare CMlQuad Quad = (Event.Control as CMlQuad);
+						Quad.Opacity = .7;
+					} else if (Event.Control.HasClass("border")) {
+						declare CMlQuad Quad = (Event.Control as CMlQuad);
+						Quad.Opacity = .0;
+					} else if (Event.Control.HasClass("leftpanel-button")) {
+						if (P_DebugMode_SelectedTab != Event.Control.ControlId) {
+							declare CMlQuad Quad = (Event.Control as CMlQuad);
+							Quad.Opacity = .0;
+						}
+					}
+				}
+				case CMlScriptEvent::Type::KeyPress: {
+					if (Event.KeyCode == 38) { // F1
+						Frame_MainUI.Visible = !Frame_MainUI.Visible;
+						P_DebugMode_Window_Open = Frame_MainUI.Visible;
+					}
+				}
+			}
+		}
+		
+		if (Frame_Tooltip.Visible) {
+			Frame_Tooltip.RelativePosition_V3.X = MouseX + 5;
+			Frame_Tooltip.RelativePosition_V3.Y = MouseY + 1;
+		}
+		
+		if (Last_DragAndDrop_State && MouseLeftButton) {
+			Frame_MainUI.RelativePosition_V3.X = Last_DragAndDrop_Offset.X + ML::Clamp(MouseX, -160., 160.);
+			Frame_MainUI.RelativePosition_V3.Y = Last_DragAndDrop_Offset.Y + ML::Clamp(MouseY, -90., 90.);
+		} else if (Last_DragAndDrop_State && !MouseLeftButton) {
+			Last_DragAndDrop_State = False;
+			P_DebugMode_Window_Pos = ;
+		}
+		
+		if (Last_BorderResize_Side.count > 0 && MouseLeftButton) {
+			declare Vec2 PosOffset = <.5, -.5>; // Diff the size of the quad clicked
+			if (Last_BorderResize_Side.count == 2 ) {
+				Quad_Corner_BottomRight.Opacity = 1.;
+				PosOffset = <2., -2.>;
+			}
+			if (Last_BorderResize_Side.exists("right")) {
+				declare Real X = ML::Max(75., Last_BorderResize_Offset.X + ML::Clamp(MouseX, -160., 160.) + PosOffset.X);
+				Quad_Border_Right.Opacity = 1.;
+				Quad_Background.Size.X = X;
+			}
+			if (Last_BorderResize_Side.exists("bottom")) {
+				declare Real Y = ML::Min(-50., Last_BorderResize_Offset.Y + ML::Clamp(MouseY, -90., 90.) + PosOffset.Y);
+				Quad_Border_Bottom.Opacity = 1.;
+				Quad_Background.Size.Y = -1. * Y;
+			}
+		} else if (Last_BorderResize_Side.count > 0 && !MouseLeftButton) {
+			Last_BorderResize_Side.clear();
+			Quad_Corner_BottomRight.Opacity = 0.;
+			Quad_Border_Right.Opacity = 0.;
+			Quad_Border_Bottom.Opacity = 0.;
+			
+			// Save pos
+			P_DebugMode_Window_Size = Quad_Background.Size;
+		}
+		
+		// Update sizes & pos
+		if (Quad_Background.Size.X != Quad_Border_Bottom.Size.X || Quad_Background.Size.Y != Quad_Border_Right.Size.Y) {
+			Quad_Topbar.Size.X = Quad_Background.Size.X;
+			Frame_Topbar_Buttons.RelativePosition_V3.X = Quad_Background.Size.X;
+			Quad_Border_Bottom.Size.X = Quad_Background.Size.X;
+			Quad_Border_Right.Size.Y = Quad_Background.Size.Y;
+			Quad_Border_Right.RelativePosition_V3.X = Quad_Background.Size.X - 0.5;
+			Quad_Border_Bottom.RelativePosition_V3.Y = -1. * Quad_Background.Size.Y + 0.5;
+			Quad_Corner_BottomRight.RelativePosition_V3 = ;
+			Quad_LeftPanel_Separator.Size.Y = Quad_Background.Size.Y - 2 - 5;
+			TextEdit_Logs.Size = ;
+			TextEdit_Logs.MaxLine += 1;
+			Entry_CustomEvent_Name.Size.X = Quad_Background.Size.X - 28;
+			Entry_CustomEvent_Data.Size.X = Quad_Background.Size.X - 28;
+			Entry_VarInsp_Players.Size.X = Quad_Background.Size.X - 28;
+			Entry_Bots_Name.Size.X = Quad_Background.Size.X - 28;
+			Entry_Bots_TeamId.Size.X = Quad_Background.Size.X - 28;
+			Entry_PlayersControl_Speed.Size.X = Quad_Background.Size.X - 28;
+			Entry_PlayersControl_Steer.Size.X = Quad_Background.Size.X - 28;
+		}
+		
+		if (Last_Logs_Serial != Net_DebugMode_Logs_Serial) {
+			Last_Logs_Serial = Net_DebugMode_Logs_Serial;
+			TextEdit_Logs.Value = Net_DebugMode_Logs;
+		}
+	}
+}
+-->
+
+""";
 }
\ No newline at end of file