Garry's Mod Wiki

Garry's Mod Wiki

  Entity:SetNWVarProxy( string key, function callback )

Description

Only one NWVarProxy can be set per-var
Running this function will only set it for the realm it is called on.

Sets a function to be called when the NWVar changes.

Arguments

1 string key
The key of the NWVar to add callback for.
2 function callback
The function to be called when the NWVar changes.
Function argument(s):
1 Entity ent - The entity
2 string name - Name of the NWVar that has changed
3 any oldval - The old value
4 any newval - The new value

Example

Prints all changes to a NWVar called "Key" of Player 1.

Entity( 1 ):SetNWVarProxy( "Key", print ) Entity( 1 ):SetNWString( "Key", "Value" ) Entity( 1 ):SetNWString( "Key", "Table" )
Output:
Player [1][Player1] Key nil Value Player [1][Player1] Key Value Table

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...