Player/GetInfo

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
Line 12: Line 12:
 
|type=string
 
|type=string
 
|desc=The value of the {{Type|ConVar}}
 
|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
 
}}
 
}}

Revision as of 11:48, 2 March 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.

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