CreatorsServer exports
BroadcastChat
Last updated on
Sends a chat line to everyone, a bucket or a radius.
local res = exports.opx_infinity:BroadcastChat(message, options)Scope write · await it. It answers from memory today, but it is a write: use the promise form.
Parameters
-
message:
string | table -
options?:
table- bucket?:
integer— a routing bucket - radius?:
number— metres, up to 10 000, withorigin - origin?:
number | { x, y, z }— a player id or a point
- bucket?:
-
messageis a string, or{ text, author?, kind? }.kindischat,system(default),info,warningorerror. -
The line is not attributed to a player.
-
With a player as
originand nobucket, only that player's bucket is reached. With no options, everyone gets the line.
Returns
integer— how many players got the line
Errors
chat.invalidMessage,chat.invalidKind,chat.invalidScope,export.badArgument
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'BroadcastChat', 'Shots fired near the market', { origin = playerId, radius = 150 })
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print(res.value .. ' heard it')
end)