Entity.GetMaterial

From GMod Wiki

Revision as of 12:21, 27 August 2011 by GIG (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Entity:GetMaterial( )
Description:
Returns the override material for the model.
Returns: String
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetMaterial]Entity.GetMaterial [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionGetting the override material of the entity the player is looking at.
Used onNewerClient.png
Code
function EntMaterial() 
	local ent = LocalPlayer():GetEyeTrace().Entity 
 
	if (ent:IsValid()) then //yup, its a valid entity!
		local entmat = ent:GetMaterial()
		LocalPlayer():ChatPrint(entmat)
	end 
end
concommand.Add("GetEntMaterial", EntMaterial)
 
OutputPrints the override material that the player is looking at into Chat.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox