Entity.SetNetworkedVar
From GMod Wiki
Function | |
Syntax | Entity:SetNetworkedVar( Var index, Var value ) |
Description: | |
Sets a networked Var in this entity with the given index to the given value. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.SetNetworkedVar]Entity.SetNetworkedVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Sets a networked variable on an entity. |
---|---|
Used on | |
Code | myString = "This is a string!" Entity:SetNetWorkedVar( "SomeString", mystring ) |
Output | N/A |
Additional Notes
- Index can be a string or integer.
- Running this function clientside will only set it clientside - not serverside. You should set networked variables to their defaults in the initilization function of a scripted entity or SWEP.
- Only set networked variables when necessary - sending networked variables constantly is expensive.
- Unlike the other networked variables, the Entity.SetNWVar shortcut doesn't work.