You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a new native, TRIGGER_MULTICAST_CLIENT_EVENT_INTERNAL (i didn't want to edit TriggerClientEventInternal, so i made a new one) that takes the same event name and payload as TRIGGER_CLIENT_EVENT_INTERNAL plus the targets as a msgpack array of net ids. The packet is built once, the list is deduplicated so a player never receives the event twice, and the packet is sent to every connected client of the list. The packet building of the existing TriggerClientEvent was moved to a shared function so both paths produce the exact same bytes, the scalar path itself is unchanged.
localplayers= { 4, 5, 6 }
TriggerClientEvent("sendmsg", players, "Hello everyone")
-- You can also dolocalplayers= { "4", "5", "6" }
TriggerClientEvent("sendmsg", players, "Hello everyone")
This PR applies to the following area(s)
Server, Natives, ScRT: Lua, ScRT: JS, ScRT: C#
Successfully tested on
Platforms: Windows
Checklist
Code compiles and has been tested successfully.
Code explains itself well and/or is documented.
My commit message explains what the changes do and what they are for.
No extra compilation warnings are added by these changes.
github-actionsBot
added
ScRT: C#
Issues/PRs related to either C# scripting runtimes
ScRT: JS
Issues/PRs related to the JavaScript scripting runtime
ScRT: Lua
Issues/PRs related to the Lua scripting runtime
triage
Needs a preliminary assessment to determine the urgency and required action
labels
Sep 2, 2026
This is a great change, but I don't think we should add this onto existing paths, we should just make new wrapper functions for the multicast variant.
I did it like this, because you said: "From a general perspective adding more functions might be more confusing than just overloading TriggerClientEvent, especially when they copy the same behavior"
And for me too it's better to not recreate another native, but if everyone prefer a new native, that's okay for me x)
Maybe i missed that part in the code.. but what if i send the event to a list with server id repeated such as {1, 1, 2, 2, 3, 3, 3, 3}?
Edit: Found it! 😄 seems nice to me.. especially in the .net part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScRT: C#Issues/PRs related to either C# scripting runtimesScRT: JSIssues/PRs related to the JavaScript scripting runtimeScRT: LuaIssues/PRs related to the Lua scripting runtimetriageNeeds a preliminary assessment to determine the urgency and required action
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
Allow
TriggerClientEventon the server to send an event to a list of players in one call, instead of looping and calling it once per player.Based on the PR of @PichotM #1210
How is this PR achieving the goal
I added a new native,
TRIGGER_MULTICAST_CLIENT_EVENT_INTERNAL(i didn't want to edit TriggerClientEventInternal, so i made a new one) that takes the same event name and payload asTRIGGER_CLIENT_EVENT_INTERNALplus the targets as a msgpack array of net ids. The packet is built once, the list is deduplicated so a player never receives the event twice, and the packet is sent to every connected client of the list. The packet building of the existingTriggerClientEventwas moved to a shared function so both paths produce the exact same bytes, the scalar path itself is unchanged.This PR applies to the following area(s)
Server, Natives, ScRT: Lua, ScRT: JS, ScRT: C#
Successfully tested on
Platforms: Windows
Checklist
Fixes issues
None