Entity.IsNPC
From GMod Wiki
(Redirected from Player.IsNPC)
Function | |
Syntax | Entity:IsNPC( ) |
Description: | |
Returns true if the entity is a NPC. | |
Returns: | Boolean |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.IsNPC]Entity.IsNPC [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- Because NPCs, Players, Vehicles, and Weapons all descend from the Entity object, they can be passed to things that normally take entities (such as the entity a trace hit, or an entity involved in an event). In order to tell the difference each type of entity has a IsNPC function that either always returns true or false. By default, entity's IsNPC always returns false. When overloaded by the NPC object after inheritence however, IsNPC always returns true. So if an Entity object is also an NPC object and you do Entity:IsNPC() then it will return true. If Entity object is not an NPC object and you do Entity:IsNPC() then it will return false.