SendClientMessageInRange
The same line in the chat of everyone near a point - a role-play mode’s nearby chat.
Every spawned player within radius metres of x, y, z gets the line - the players GetPlayersInRange would list -
and with world only those of that virtual world. The point may be a player’s own position:
they get the line too.
The line is made once and sent to all of them, so a nearby chat costs the mode one call however many people stand
around - a loop of SendClientMessage over GetPlayersInRange does the same with a call per listener, which adds
up when a crowd talks. The same limit as SendClientMessage: a text over 16384 bytes of UTF-8 is cut at that size.
Syntax
Section titled “Syntax”SendClientMessageInRange(x, y, z, radius, color, text [, world])| Parameter | Type | |
|---|---|---|
x |
number | metres |
y |
number | metres |
z |
number | metres |
radius |
number | metres |
color |
number | 0xRRGGBBAA |
text |
string | the line |
world |
number | a virtual world; nil = any (optional) |
Returns
Section titled “Returns”number - how many players got it
Example
Section titled “Example”-- what a player says, heard within 20 m in their own worldfunction OnPlayerText(pid, text) local x, y, z = GetPlayerPos(pid) SendClientMessageInRange(x, y, z, 20, COLOR_WHITE, GetPlayerName(pid) .. " says: " .. text, GetPlayerVirtualWorld(pid)) return falseendSee also
Section titled “See also”GetPlayersInRange · SendClientMessage · SetPlayerChatBubble · the Chat and commands group of the index
