Entity.GetClass

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:GetClass( )
Description:
Returns the classname of the entity. The classname is typically something like "prop_physics".
Returns: String
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.GetClass]Entity.GetClass [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis piece of code checks, using the classname, if the supplied player is currently using a GMOD-camera.
Used onNewerShared.png
Code
function usingGModCameraProp(P)
	if (P == nil || !P:IsValid()) then return false end
	local viewent = P:GetViewEntity()
	if (viewent:IsValid() && viewent:GetClass() == "gmod_cameraprop") then return true end
	return false
end
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox