diff --git a/jRandomSkills - SRC Files/jRandomSkills.csproj b/jRandomSkills - SRC Files/jRandomSkills.csproj index 33a5330..c9bf873 100644 --- a/jRandomSkills - SRC Files/jRandomSkills.csproj +++ b/jRandomSkills - SRC Files/jRandomSkills.csproj @@ -71,7 +71,9 @@ + + diff --git a/jRandomSkills - SRC Files/src/player/PerfLog.cs b/jRandomSkills - SRC Files/src/player/PerfLog.cs index 05bdb25..734900c 100644 --- a/jRandomSkills - SRC Files/src/player/PerfLog.cs +++ b/jRandomSkills - SRC Files/src/player/PerfLog.cs @@ -14,7 +14,22 @@ namespace src.player public static bool Enabled => Config.LoadedConfig.PerfMode; - public static long Start() => Enabled ? Stopwatch.GetTimestamp() : 0; + private static bool _headerWritten; + + public static long Start() + { + if (!Enabled) return 0; + + // Write a header on the first measurement so the perf file appears immediately + // when PerfMode is active - makes "is it working?" instantly visible. + if (!_headerWritten) + { + _headerWritten = true; + Write($"PerfMode enabled (plugin v{Instance.ModuleVersion})"); + } + + return Stopwatch.GetTimestamp(); + } // One-shot measurement: logs "label took X.XXms" when the elapsed time reaches the threshold. public static void End(string label, long startTimestamp, double thresholdMs = 1.0) diff --git a/jRandomSkills - SRC Files/src/player/PlayerEvents.cs b/jRandomSkills - SRC Files/src/player/PlayerEvents.cs index 1247aa2..7bbd0f4 100644 --- a/jRandomSkills - SRC Files/src/player/PlayerEvents.cs +++ b/jRandomSkills - SRC Files/src/player/PlayerEvents.cs @@ -595,7 +595,7 @@ namespace src.player { lock (setLock) { - bool isWarmup = Instance.GameRules != null && Instance.GameRules.WarmupPeriod == true; + bool isWarmup = Instance.GameRules == null || Instance.GameRules.WarmupPeriod == true; isTransmitRegistered = false; Instance.AddTimer(.1f, () => DisableAll(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); @@ -877,7 +877,9 @@ namespace src.player { if (Instance == null) return; - if (Instance.GameRules != null && Instance.GameRules.WarmupPeriod == true) + // GameRules can be null for a short window right after plugin load/hot-reload; + // treat that as "not ready" so skills are never assigned during warmup by accident. + if (Instance.GameRules == null || Instance.GameRules.WarmupPeriod == true) { setSkillTimer?.Kill(); return; diff --git a/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll b/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll index a87b3d0..c5c63ec 100644 Binary files a/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll and b/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll differ diff --git a/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll b/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll index dd044c5..27bb56a 100644 Binary files a/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll and b/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll differ