Entity/GetNWString

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
(Added player rank example)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=GetNWString
 
|Parent=Entity
 
 
|Description=Retrieves a networked string value at specified index on the entity that is set by {{ClassFunction|Entity|SetNWString}}.
 
|Description=Retrieves a networked string value at specified index on the entity that is set by {{ClassFunction|Entity|SetNWString}}.
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=Yes
 
|IsClass=Yes
 +
|Name=GetNWString
 +
|Parent=Entity
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 20: Line 20:
 
|type=string
 
|type=string
 
|desc=The retrieved value
 
|desc=The retrieved value
 +
}}
 +
{{Example
 +
|Description=Prints the player's rank
 +
|Code=print( Entity(1):GetNWString( "usergroup" ) )
 +
|Output="superadmin" in single-player
 
}}
 
}}

Revision as of 22:22, 11 September 2016

 Entity:GetNWString( )

Contents

Description

Retrieves a networked string value at specified index on the entity that is set by Entity:SetNWString.

Arguments

string key

The key that is associated with the value

Arguments

string fallback=""

The value to return if we failed to retrieve the value. ( If it isn't set )

Returns

string

The retrieved value

Examples

Example

Prints the player's rank

print( Entity(1):GetNWString( "usergroup" ) )

Output:

"superadmin" in single-player
Personal tools
Navigation