From Garry's Mod
Jump to: navigation, search
 util.AddNetworkString( )


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.


Due to the way string tables work, it's preferable to call this function as soon as the server starts up, such as in GM:Initialize or even bare in a lua file outside of a function.


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


string str

Adds the specified string to the string table.



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

Same as calling util.NetworkStringToID.
Personal tools