Skip to content

Commit 2d5086f

Browse files
Num10cklouis1706
andauthored
feat: Map.Broadcast(ushort, Func<Player, string>) overload. (#447)
* feat: Spawning NPCs via RA adds them to the `Npc.List` * Update RemoteAdminNpcCommandAddToDictionaryFix.cs RemoteAdminNpcCommandAddToDictionaryFix is now static. * Code style changes. Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Documentation fix. * feat: Map.Broadcast(ushort, Func<Player, string>) overload. --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com>
1 parent f971ca7 commit 2d5086f

File tree

1 file changed

+11
-0
lines changed
  • EXILED/Exiled.API/Features

1 file changed

+11
-0
lines changed

EXILED/Exiled.API/Features/Map.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ public static void Broadcast(ushort duration, string message, global::Broadcast.
133133
Server.Broadcast.RpcAddElement(message, duration, type);
134134
}
135135

136+
/// <summary>
137+
/// Broadcasts delegate invocation result to all <see cref="Player">players</see>.
138+
/// </summary>
139+
/// <param name="duration">The duration in seconds.</param>
140+
/// <param name="func">The delegate whose invocation result will be the message.</param>
141+
public static void Broadcast(ushort duration, Func<Player, string> func)
142+
{
143+
foreach (Player player in Player.List)
144+
player.Broadcast(duration, func.Invoke(player));
145+
}
146+
136147
/// <summary>
137148
/// Shows a hint to all <see cref="Player">players</see>.
138149
/// </summary>

0 commit comments

Comments
 (0)