Garry's Mod Wiki

net.WriteString

  net.WriteString( string string )

Description

Appends a string to the current net message. The size of the string is 8 bits plus 8 bits for every ASCII character in the string. The maximum allowed length of a single written string is 65532 characters.

Arguments

1 string string
The string to be sent.

Example

Sends a message to all the clients.

-- Server util.AddNetworkString( "SendMessage" ) net.Start( "SendMessage" ) net.WriteString( "Hello World!" ) net.Broadcast() -- Client net.Receive( "SendMessage", function( len ) local message = net.ReadString() chat.AddText( color_white, message ) end )