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