From Garry's Mod
Adds a net message handler. Only one receiver can be used to receive the net message.
|NOTE||The message-name is converted to lower-case so the message-names "BigBlue" and "bigblue" would be equal.|
|WARNING||You must put this function outside of any other function or hook for it to work properly unless you know what you are doing!|
|WARNING||You must read information in the same order as you write it.|
|WARNING||Each net message has a length limit of 64KB!|
The message name to hook to.
A simple callback
net.Receive( "my_message", function( len, pl ) if ( IsValid( pl ) and pl:IsPlayer() ) then print( "Message from " .. pl:Nick() .. " received. Its length is " .. len .. "." ) else print( "Message from server received. Its length is " .. len .. "." ) end end )
When run server-side:
Message from John received. Its length is 4.
Message from server received. Its length is 4.