util.AddNetworkString

From Garry's Mod
Revision as of 06:49, 7 May 2019 by Code gs (Talk | contribs)
Jump to: navigation, search
 util.AddNetworkString( )

Description

Adds the specified string to a string table, which will cache it and network it to all clients automatically.
Whenever you want to create a net message with net.Start, you must add the name of that message as a networked string via this function.

If the passed string already exists, nothing will happen and the ID of the existing item will be returned.

NOTE

Do not put this function call into any other functions. Preferable place for this function is in a serverside lua file, or in a shared file with the net.Receive function.

NOTE

The string table used for this function does not interfere with the engine string tables and has 2048 slots.

Arguments

string str

Adds the specified string to the string table.

Returns

number

The id of the string that was added to the string table.

Same as calling util.NetworkStringToID.
Personal tools
Navigation