Entity.SkinCount

From GMod Wiki

Revision as of 17:04, 9 December 2010 by Joerdgs (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Entity:SkinCount( )
Description:
Returns an integer representing the total number of skins an entities' model has.
Returns: Integer
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.SkinCount]Entity.SkinCount [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionSet an entity to its last skin if it's frozen with the physgun
Used onNewerServer.png
Code
function FrozenSkin( ent )
	local numskins = ent:SkinCount()
 
	if ent:GetSkin() != numskins then
		ent:SetSkin( numskins )
	end
end
 
hook.Add( "OnPhysgunFreeze", "FrozenSkin", function( wep, phys, ent, pl ) FrozenSkin( ent ) end
OutputAn entity that is frozen with the physgun will set its skin to its last, if it hasn't already.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox