Entity.IsPlayer
From GMod Wiki
Function | |
Syntax | Entity:IsPlayer( ) |
Description: | |
Returns true if the entity is a Player. | |
Returns: | Boolean |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.IsPlayer]Entity.IsPlayer [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 IsPlayer function that either always returns true or false. By default, entity's IsPlayer always returns false. When overloaded by the Player object after inheritence however, IsPlayer always returns true. So if an Entity object is also a Player object and you do Entity:IsPlayer() then it will return true. If Entity object is not a player object and you do Entity:IsPlayer() then it will return false.