chat
The chat namespace outputs client-side messages directly into the game chat box. Messages are local only and are not broadcast to the server or other players.
Functions
Section titled βFunctionsβ| Function | Parameters | Description |
|---|---|---|
chat.print |
...args: any |
Prints arguments concatenated as a system chat message. |
chat.print_player |
entindex: number, ...args: any |
Prints chat line attributed to the player at entindex. |
Color Formatting Tokens
Section titled βColor Formatting TokensβStrings passed to chat functions can contain embedded color tags that map to Source engine chat color bytes:
| Token | Output Color | Token | Output Color | |
|---|---|---|---|---|
{white} |
Default White | {yellow} |
Yellow | |
{darkred} |
Dark Red | {bluegrey} |
Blue-Grey | |
{team} |
Team Color (T/CT) | {blue} |
Blue | |
{green} |
Green | {darkblue} |
Dark Blue | |
{lightgreen} |
Light Green | {purple} |
Purple | |
{lime} |
Lime | {violet} |
Violet | |
{red} |
Red | {lightred} |
Light Red | |
{grey} |
Grey | {orange} |
Orange |
Example: Hit Indicator in Chat
Section titled βExample: Hit Indicator in Chatβclient.add_callback("aim_ack", function(shot) if shot.damage > 0 then chat.print( "{green}[Aimsense] {white}Hit target for {lightgreen}", shot.damage, " {white}damage (Hitchance: {lime}", shot.hitchance, "%{white})" ) endend)