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