Player/GetInfo

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
m (more of a warning, really)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=GetInfo
+
|Description=Retrieves the value of a client-side {{Type|ConVar}}. The {{Type|ConVar}} must have a [[Enums/FCVAR|FCVAR_USERINFO]] flag for this to work.
|Parent=Player
+
 
|Description=Retrieves the value of a client-side ConVar
+
{{Warning|The returned value is truncated to 31 bytes.}}
 
|Realm=Server
 
|Realm=Server
 
|IsClass=Yes
 
|IsClass=Yes
Line 9: Line 9:
 
|type=string
 
|type=string
 
|name=cVarName
 
|name=cVarName
|desc=The name of the client-side ConVar
+
|desc=The name of the client-side {{Type|ConVar}}
 
}}
 
}}
 
{{Ret
 
{{Ret
 
|type=string
 
|type=string
|desc= ConVar Value
+
|desc=The value of the {{Type|ConVar}}
 +
}}
 +
{{Example
 +
|Description=Creates clientside {{Type|ConVar}} 'Apple' and retrieves value of it.
 +
|Code=if CLIENT then
 +
CreateConVar( "Apple", "ILikeApples", FCVAR_USERINFO )
 +
else
 +
MsgN( Entity( 1 ):GetInfo( "Apple" ) )
 +
end
 +
|OutputFixedWidth=Fixed width
 +
|Output=ILikeApples
 
}}
 
}}

Latest revision as of 04:44, 10 December 2017

 Player:GetInfo( )

Contents

Description

Retrieves the value of a client-side ConVar. The ConVar must have a FCVAR_USERINFO flag for this to work.

WARNING

The returned value is truncated to 31 bytes.

Arguments

string cVarName

The name of the client-side ConVar

Returns

string

The value of the ConVar

Examples

Example

Creates clientside ConVar 'Apple' and retrieves value of it.

if CLIENT then
	CreateConVar( "Apple", "ILikeApples", FCVAR_USERINFO )
else
	MsgN( Entity( 1 ):GetInfo( "Apple" ) )
end

Output:

ILikeApples
Personal tools
Navigation