Entity.GetNetworkedInt
From GMod Wiki
Revision as of 17:51, 10 May 2011 by INCOMING DEMOMAN TORPEDO (Talk | contribs)
Function | |
Syntax | Entity:GetNetworkedInt( Var index [, Integer default] ) |
Description: | |
Returns a networked Integer in this entity set with Entity:SetNetworkedInt with the given index. | |
Returns: | Integer |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.GetNetworkedInt]Entity.GetNetworkedInt [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Client gets the value for its max health, as set by the server. |
---|---|
Used on | |
Code | local Points = LocalPlayer():GetNetworkedInt( "Points", 0 ) -- Sets the value to 0 ONLY if it is nil |
Output | N/A |
Additional Notes
- Can be written GetNWInt().
- Networked data is only synchronized when it is set!
- Index can be a String or Integer .
- "Entity:GetNWInt" is it's shorthand version.
- "Entity:GetNWInt" can return a string in some scenarios
- The default int returns the current value ONLY if it returns nil, but it does not set the value.