1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Get bought entity owner

Discussion in 'DarkRP Modding Questions & Help' started by Emek, Mar 19, 2020.

  1. Emek

    Emek New Member

    Hello, I am trying to get the owner(Buyer) of a printer that has been bought from the f4 menu, but I cant seem to get it, Is there a way to do it? maybe a function for it?

    I've tried
    Code (Text):
    self:GetCreator()
    however that returns a NULL Entity.

    Thanks in advance!
     
  2. (FPtje) Atheos

    (FPtje) Atheos Main Developer Staff Member

    Perhaps self:Getowning_ent()?
     
  3. Emek

    Emek New Member

    Is there such a function? it gives back an error
    Code (Text):
    attempt to call method 'Getowning_ent' (a nil value)
    and I can't find it in the documentation.
    Perhaps i'm missing something?

    This is the code:
    Code (Text):
    function ENT:Initialize()
        print(self:Getowning_ent())
    end
     
  4. Andorek

    Andorek New Member

  5. Emek

    Emek New Member

    Tried that, returns a NULL Entity, you have to SetOwner() first however for me it still returns NULL Entity if I use SetOwner()
    --- Double Post Merged, Mar 20, 2020 ---
    I understand what you are saying now Atheos, I have set up a network var that seems to automatically get the buyer entity

    Code (Text):
    function ENT:SetupDataTables()
        self:NetworkVar("Entity", 0, "owning_ent")
    end
     
     
    Last edited: Mar 20, 2020

Share This Page