Skip to content

Commit

Permalink
fix: call utilities on nextframe
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar-wos committed Jul 2, 2024
1 parent e2dbd9c commit 80d291b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/AntiRush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ public override void Load(bool isReload)
AddCommand("css_addzone", "Add Zone", CommandAddZone);
//AddCommand("css_viewzones", "View Zones", CommandViewZones);

foreach (var controller in Utilities.GetPlayers())
_playerData[controller] = new PlayerData();
Server.NextFrame(() =>
{
foreach (var controller in Utilities.GetPlayers())
_playerData[controller] = new PlayerData();
});

LoadJson(Server.MapName);
Server.ExecuteCommand("mp_restartgame 1");
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ private void OnTick()
var announceNoRush = false;
var announceNoCamp = false;

if (Config.NoRushTime != 0 && Math.Abs(Config.NoRushTime + _roundStart - Server.CurrentTime).ToString("0.00") == "0.00")
if (Config.NoRushTime != 0 && Math.Abs(Config.NoRushTime + _roundStart - Server.CurrentTime) == 0)
announceNoRush = true;

if (Config.NoCampTime != 0 && Math.Abs(Config.NoCampTime + _roundStart - Server.CurrentTime).ToString("0.00") == "0.00")
if (Config.NoCampTime != 0 && Math.Abs(Config.NoCampTime + _roundStart - Server.CurrentTime) == 0)
announceNoCamp = true;

if (announceNoRush || announceNoCamp)
Expand Down

0 comments on commit 80d291b

Please sign in to comment.