Left 4 Dead 2/Scripting/Script Functions/ClientPrint
< Left 4 Dead 2 | Scripting | Script Functions
Jump to navigation
Jump to search
Function Description
void ClientPrint(CTerrorPlayer player, int destination, string message)
Print a client message. If you pass null instead of a valid player, the message will be sent to all clients.
Printing to the chat box supports using a limited amount of color codes for custom colors. To use them add the characte before the colored text, either as a \x
escape code into the string, or as a char with the integer value.
Parameters
Type | Name | Description |
---|---|---|
CTerrorPlayer | player | The handle of the player who receives the message or null for everyone.
|
int | destination | The destination to print to. See Print Destinations for a list of destinations. |
string | message | The message to print. |
Example
function ConsolePrint()
{
// Print a chat message visible to everyone
ClientPrint(null, DirectorScript.HUD_PRINTTALK, "\x03" + "Hello everyone!")
local player = null
// Iterate through every player
while(player = Entities.FindByClassname(player, "player"))
{
// Only print to human controlled survivors and special infected
if(!IsPlayerABot(player))
{
// Print a personalized chat message for the player
ClientPrint(player, DirectorScript.HUD_PRINTTALK, "\x04" + "Hello " + "\x05" + player.GetPlayerName())
}
}
}
ConsolePrint()
Print Destinations
These are the destinations that can be printed to.

DirectorScript
. fore example DirectorScript.HUD_PRINTTALK
Enumeration | Value | Description |
---|---|---|
HUD_PRINTNOTIFY | 1 | Todo: Prints the message to console, sets some kind of notify flag.
|
HUD_PRINTCONSOLE | 2 | Prints the message to console. |
HUD_PRINTTALK | 3 | Prints the message to the chat box. Supports custom color codes. |
HUD_PRINTCENTER | 4 | Prints the message to the center of the screen. Todo: The formatting is almost unreadable, and the message fades quickly.
|
(Unknown) | 5 | Todo: Prints the message to the chat box with an orange color by default. Supports custom color codes.
|
Color Codes
Color | Value |
---|---|
Beige (default color) | \x01
|
Bright green | \x03
|
Orange | \x04
|
Olive green | \x05
|