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.

The returned value is truncated to 31 bytes.
On client this function will return value of the local player, regardless of which player the function was called on!

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.

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