Return to Main Docs Page

GetOwner

NewerServer.png Returns the owner entity of weapon.

Weapon:GetOwner()
               

Returns:


  • 1) Entity owner
  • Entity of weapon owner/holder.

Example:



function SWEP:PrimaryAttack()
   local pPlayer = self:GetOwner() --Returns owner entity. 

   if ( pPlayer == NULL ) then
      return --Ends the function if player is invalid. 
   end
end