diff --git a/Events.cs b/Events.cs index eabf5403..e6e28252 100644 --- a/Events.cs +++ b/Events.cs @@ -59,6 +59,8 @@ namespace WeaponPaints catch { } + + Players.Add(player); return HookResult.Continue; } @@ -114,6 +116,7 @@ namespace WeaponPaints _temporaryPlayerWeaponWear.TryRemove(player.Slot, out _); CommandsCooldown.Remove(player.Slot); + Players.Remove(player); return HookResult.Continue; } @@ -239,7 +242,7 @@ namespace WeaponPaints if (steamid != null && steamid.IsValid()) { - player = Utilities.GetPlayers().FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64); + player = Players.FirstOrDefault(p => p.IsValid && p.SteamID == steamid.SteamId64); if (player == null) player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow); @@ -266,11 +269,7 @@ namespace WeaponPaints { if (!Config.Additional.ShowSkinImage) return; - foreach (var player in Utilities.GetPlayers().Where(p => - p is { IsValid: true, PlayerPawn.IsValid: true, IsBot: false } and - { Connected: PlayerConnectedState.PlayerConnected } - ) - ) + foreach (var player in Players) { if (_playerWeaponImage.TryGetValue(player.Slot, out var value) && !string.IsNullOrEmpty(value)) { diff --git a/Variables.cs b/Variables.cs index d5ceeb3a..ae012096 100644 --- a/Variables.cs +++ b/Variables.cs @@ -168,4 +168,6 @@ public partial class WeaponPaints private static readonly PluginCapability MenuCapability = new("menu:nfcore"); private int _fadeSeed; + + internal List Players = []; } \ No newline at end of file diff --git a/WeaponPaints.csproj b/WeaponPaints.csproj index e6025094..af12d7fa 100644 --- a/WeaponPaints.csproj +++ b/WeaponPaints.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/WeaponPaints.sln.DotSettings.user b/WeaponPaints.sln.DotSettings.user index c1b8dc0b..d0a7d6ed 100644 --- a/WeaponPaints.sln.DotSettings.user +++ b/WeaponPaints.sln.DotSettings.user @@ -1,6 +1,11 @@  True ForceIncluded + ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded + ForceIncluded ForceIncluded \ No newline at end of file