Garry's Mod Wiki

Player:GetInfo

  string Player:GetInfo( string cVarName )

Description

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

On client this function will return value of the local player, regardless of which player the function was called on!

See Player:GetInfoNum for the same function that automatically converts the string to a number.

Arguments

1 string cVarName
The name of the client-side ConVar.

Returns

1 string
The value of the ConVar. Or an empty string if the convar doesn't exist.
The returned value is truncated to 31 bytes.

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