Skip to content

Commit

Permalink
Fixed potential crash when users were joining the server
Browse files Browse the repository at this point in the history
  • Loading branch information
B3none committed Mar 24, 2024
1 parent 4102f9f commit 03515df
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion RetakesPlugin/RetakesPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,15 @@ public HookResult OnPlayerConnectFull(EventPlayerConnectFull @event, GameEventIn
player.ForceTeamTime = 3600.0f;

// Create a timer to do this as it would occasionally fire too early.
AddTimer(1.0f, () => player.ExecuteClientCommand("teammenu"));
AddTimer(1.0f, () =>
{
if (!player.IsValid)
{
return;
}

player.ExecuteClientCommand("teammenu");
});

// Many hours of hard work went into this.
if (new List<ulong> {76561198028510846,76561198044886803,76561198414501446}.Contains(player.SteamID))
Expand Down

0 comments on commit 03515df

Please sign in to comment.