Entity.GetOwner
From GMod Wiki
| Function | |
| Syntax | Entity:GetOwner( ) |
| Description: | |
| Returns the owner of the entity, set with Entity:SetOwner. Make sure to do Entity:IsValid() on the returned entity to determine if the prop has an owner. | |
| Returns: | Entity or Player |
| In Object: | Entity |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.GetOwner]Entity.GetOwner [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
| Entity:GetOwner() does NOT return the player who spawned the entity! It only returns what's set by Entity:SetOwner |
Examples
| Description | Returns true if an entity has an owner, false otherwise. |
|---|---|
| Used on | |
| Code | function HasOwner( ent ) return ValidEntity( ent:GetOwner() ) end |
| Output | N/A |
Additional Notes
- Can return Player if a Player owns the object