Entity.IsNPC

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:IsNPC( )
Description:
Returns true if the entity is a NPC.
Returns: Boolean
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.IsNPC]Entity.IsNPC [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionUpon entering "getnpcs" in console, for every NPC found, this will print "NPC Found!"
Used onNewerServer.png
Code
function cmdGetNPCs( ply, cmd, arg )
 
	for _, v in pairs( ents.GetAll() ) do
		if v:IsNPC() then print( "NPC found!" )	end
	end
 
end
concommand.Add( "getnpcs", cmdGetNPCs )
OutputA list of entities.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox