Entity.SetNetworkedInt
From GMod Wiki
(Redirected from Entity.SetNWInt)
				
																
				
				
								
				| Function | |
| Syntax | Entity:SetNetworkedInt( Var index, Integer value ) | 
| Description: | |
| Sets a networked Integer 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.SetNetworkedInt]Entity.SetNetworkedInt [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] | 
	
Examples
| Description | Set a entity's 'money' to 30 | 
|---|---|
| Used on |  | 
| Code | Entity:SetNWInt("money", 30) | 
| Output | This sets a new int related to the entity. | 
Additional Notes
- Can be written SetNWInt().
- Running a networked function will cause it to synchronize the networked data with the clients.
- 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.
 
			
			