@@ -16,7 +16,7 @@ public class GameHUD : BasePlugin
1616 public override string ModuleName => "GameHUD" ;
1717 public override string ModuleDescription => "Shows text to the player using static point_worldtext" ;
1818 public override string ModuleAuthor => "DarkerZ [RUS], Oz_Lin" ;
19- public override string ModuleVersion => "1.DZ.3.4 " ;
19+ public override string ModuleVersion => "1.DZ.3.5 " ;
2020
2121 public static HUD [ ] g_HUD = new HUD [ 65 ] ;
2222 static IGameHUDAPI ? _api ;
@@ -109,20 +109,21 @@ private HookResult OnEventPlayerDeathPost(EventPlayerDeath @event, GameEventInfo
109109
110110 private HookResult OnEventRoundStart ( EventRoundStart @event , GameEventInfo info )
111111 {
112- Utilities . GetPlayers ( ) . Where ( p => p is { IsValid : true , IsBot : false , IsHLTV : false } ) . ToList ( ) . ForEach ( player =>
112+ /* Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false }).ToList().ForEach(player =>
113113 {
114114 _ = new CounterStrikeSharp.API.Modules.Timers.Timer(1.0f, () => UpdateEvent(player));
115- } ) ;
115+ });*/
116+ foreach ( var hud in g_HUD )
117+ {
118+ _ = new CounterStrikeSharp . API . Modules . Timers . Timer ( 1.0f , ( ) => UpdateEvent ( hud . GetHUDPlayer ( ) ) ) ;
119+ }
116120 return HookResult . Continue ;
117121 }
118122
119123 private void OnOnTick ( )
120124 {
121125 if ( g_bMethod ) return ;
122- Task . Run ( ( ) =>
123- {
124- Parallel . ForEach ( g_HUD , ( hud ) => hud . ShowAllHUD ( ) ) ;
125- } ) ;
126+ foreach ( var hud in g_HUD ) hud . ShowAllHUD ( ) ;
126127 }
127128
128129 void OnTransmit ( CCheckTransmitInfoList infoList )
@@ -142,20 +143,16 @@ void OnTransmit(CCheckTransmitInfoList infoList)
142143
143144 private static void UpdateEvent ( CCSPlayerController ? player )
144145 {
145- Task . Run ( ( ) =>
146+ if ( player != null && player . IsValid )
146147 {
147- if ( player != null && player . IsValid )
148- Parallel . ForEach ( g_HUD [ player . Slot ] . Channel , ( pair ) => {
149- if ( ! pair . Value . EmptyMessage ( ) )
150- {
151- Server . NextFrame ( ( ) =>
152- {
153- pair . Value . CreateHUD ( ) ;
154- } ) ;
155- }
156- } ) ;
157-
158- } ) ;
148+ foreach ( var pair in g_HUD [ player . Slot ] . Channel )
149+ {
150+ if ( ! pair . Value . EmptyMessage ( ) )
151+ {
152+ pair . Value . CreateHUD ( ) ;
153+ }
154+ }
155+ }
159156 }
160157
161158 // --- Getters for HUD API (for direct plugin use, not required for API interface) ---
0 commit comments