GM/EntityNetworkedVarChanged

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
{{Hook
 
{{Hook
|Name=EntityNetworkedVarChanged
 
|Parent=GM
 
 
|Description=Called when an NWVar is changed.
 
|Description=Called when an NWVar is changed.
 +
 +
{{Note|Currently this hook 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}}
 
|Realm=Shared
 
|Realm=Shared
 
|Predicted=No
 
|Predicted=No
 +
|HidePredictionWarning=No
 +
|Name=EntityNetworkedVarChanged
 +
|Parent=GM
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 32: Line 35:
 
-- Trigger a change!
 
-- Trigger a change!
 
Entity(1):SetNWString( "UserGroup", "owner" )
 
Entity(1):SetNWString( "UserGroup", "owner" )
 
 
|Output=<pre>
 
|Output=<pre>
 
Player [1][Rubat] UserGroup superadmin owner
 
Player [1][Rubat] UserGroup superadmin owner
 
</pre>
 
</pre>
 
}}
 
}}

Revision as of 14:28, 15 September 2016

 GM:EntityNetworkedVarChanged( )

Contents

Description

Called when an NWVar is changed.

NOTE

Currently this hook 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

Entity ent

The owner entity of changed NWVar

Arguments

string name

The name if changed NWVar

Arguments

any oldval

The old value of the NWVar

Arguments

any newval

The new value of the NWVar

Examples

Example

Example usage of the hook. Prints out all NWVar changes.

hook.Add("EntityNetworkedVarChanged","print out everything", print )

-- Trigger a change!
Entity(1):SetNWString( "UserGroup", "owner" )

Output:

Player [1][Rubat]	UserGroup	superadmin	owner
Personal tools
Navigation