From GMod Wiki
|Syntax||Entity:SetOwner( Entity )|
|Sets the 'owner' of an entity. This disables collision between the entity and its owner. If the prop kills another entity, the owner of the prop will be the inflictor and will get credit for the kill.|
|BBCode Link:||[b][url=http://wiki.garrysmod.com/?title=Entity.SetOwner]Entity.SetOwner [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]|
|Entity:SetOwner should not normally be used unless you want to disable collision between two entities. Sure, Entity:GetOwner gets what's set by Entity:SetOwner, but Entity:SetOwner also disables collisions and gives kill credit to the "owner". If you simply want to give kill credit, use Entity:SetPhysicsAttacker|
|Description||Sets target entity to be owned by you|
function ownd(ply) local tr = utilx.GetPlayerTrace( ply, ply:GetCursorAimVector() ) local trace = util.TraceLine( tr ) trace.Entity:SetOwner(ply) end
- You can walk through an entity you own, and you can't physgun it.
- Bullets goes through entities you own.
- The owner does not have to be a player. It can be any type of entity.
- This function (Or the C++ equivalent) is used for weapons. Hence why collision is disabled and the owner takes kill points.