diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index 6895a1da..59a5361c 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -51,22 +51,21 @@ namespace QSB.Player } var player = PlayerList.FirstOrDefault(x => x.PlayerId == id); - if (player != null) + if (player == null) { - return player; - } - - if (!QSBCore.IsInMultiplayer) - { - DebugLog.ToConsole($"Error - Tried to create player id:{id} when not in multiplayer! Stacktrace : {Environment.StackTrace}", MessageType.Error); + DebugLog.ToConsole($"Error - Player with id {id} does not exist! Stacktrace : {Environment.StackTrace}", MessageType.Error); return default; } + return player; + } + + public static void AddPlayer(uint id) + { DebugLog.DebugWrite($"Create Player : id<{id}>", MessageType.Info); - player = new PlayerInfo(id); + var player = new PlayerInfo(id); PlayerList.Add(player); OnAddPlayer?.Invoke(id); - return player; } public static void RemovePlayer(uint id) diff --git a/QSB/Player/TransformSync/PlayerTransformSync.cs b/QSB/Player/TransformSync/PlayerTransformSync.cs index 8c90ead7..ef2e0209 100644 --- a/QSB/Player/TransformSync/PlayerTransformSync.cs +++ b/QSB/Player/TransformSync/PlayerTransformSync.cs @@ -50,6 +50,7 @@ namespace QSB.Player.TransformSync public override void Start() { base.Start(); + QSBPlayerManager.AddPlayer(PlayerId); Player.TransformSync = this; }