Player.GetInfo

From GMod Wiki

Revision as of 06:05, 24 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Player:GetInfo( String clientconvar )
Description:
Grabs a convar string from the client, this is used in stool code.
Returns: String
In Object: Player
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.GetInfo]Player.GetInfo [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionExample code from the gmod_tool swep.
Used onNewerShared.png
CodeDefined in (Source Code)
 
//This part is from the gmod_tool code. Basically an alias.
function ToolObj:GetClientInfo( property )
	local mode = self:GetMode()
	return self:GetOwner():GetInfo( mode.."_"..property )
end
 

Defined in (Source Code)

 
//This part is from the Material stool code.
function TOOL:LeftClick( trace )
	if !( trace.Entity &&			// Hit an entity
	      trace.Entity:IsValid() && 	// And the entity is valid
	      trace.Entity:EntIndex() != 0	// And isn't worldspawn
	    ) then return end
 
	local mat = self:GetClientInfo( "override" )
	SetMaterial( self:GetOwner(), trace.Entity, { MaterialOverride = mat } )
	return true
end
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox