Entity:SetNWVarProxy

From Garry's Mod
Jump to: navigation, search
 Entity:SetNWVarProxy( )

Contents

Description

Sets a function to be called when the NWVar changes.

NOTE Currently this function only works for the NW2Var system (accessed by adding a 2 in between NW and Var for most NWVar functions), which will replace the original one at some point in the future

Arguments

string name

The name of the NWVar to add callback for.

Arguments

function callback

The function to be called when the NWVar changes. It has 3 arguments: Entity ent - The entity
string name - Name of the NWVar that has changed
any oldval - The old value
any newval - The new value


Examples

Example

Prints all changes to UserGroup NWVar of Player 1.

Entity(1):SetNWVarProxy( "UserGroup", print )
Entity(1):SetNWString( "UserGroup", "admin" )

Output: Player [1][Rubat] superadmin admin

Personal tools
Navigation