Player.GetInfoNum

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:GetInfoNum( String clientconvar, Integer default )
Description:
Grabs a convar integer from the client, this is used in stool code.
Returns: Integer
In Object: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.GetInfoNum]Player.GetInfoNum [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionExample code from the gmod_tool swep.
Used onNewerServer.png
Code
 
//This part is from the gmod_tool code. Basically an alias.
function ToolObj:GetClientNumber( property, default )
	default = default or 0
	local mode = self:GetMode()
	return self:GetOwner():GetInfoNum( mode.."_"..property, default )
end
 
//This part is from the Color 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
//Clients can leave now.
		if (CLIENT) then
			return true 
		end
 
		local r		= self:GetClientNumber( "r", 0 )
		local g		= self:GetClientNumber( "g", 0 )
		local b		= self:GetClientNumber( "b", 0 )
		local a		= self:GetClientNumber( "a", 0 )
		local mode	= self:GetClientNumber( "mode", 0 )
		local fx	= self:GetClientNumber( "fx", 0 )
 
		SetColour( self:GetOwner(), trace.Entity, { Color = Color( r, g, b, a ), RenderMode = mode, RenderFX = fx } )
 
		return true
	end
end
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox