Skip to content

SetPlayerChatBubble

A line over a player’s head, in a color of your own, for everyone near them.

The same speech bubble a chat line shows over the speaker ([ui] chat_bubbles), but the mode’s: the text, the color (0xRRGGBBAA), how far it is seen (distance metres, 20 by default) and how long it stays (ms; 0 or nil = by the line’s length, 5 to 12 s). The speaker sees nothing - nobody sees their own head - so a role-play mode prints the line in their chat as well. One line at a time per player; a new one replaces the old.

SetPlayerChatBubble(pid, text [, color, distance, ms])
Parameter Type
pid number the player
text string the line (one line; long ones are cut)
color number 0xRRGGBBAA (COLOR_WHITE) (optional)
distance number metres (20) (optional)
ms number milliseconds (0 = by the length) (optional)

boolean - false when not connected

-- /ame nods slowly: "* Henry nods slowly" over the head in the role-play lavender, and in the speaker's chat
if cmd == "ame" then
local line = "* " .. GetPlayerName(pid) .. " " .. args
SetPlayerChatBubble(pid, line, COLOR_PURPLE, 20)
SendClientMessage(pid, COLOR_PURPLE, line)
return true
end

SendClientMessage · GetPlayersInRange · SetPlayerNameplate · the Chat and commands group of the index