In the darkrp money printer script I was reading through it and saw this
shared:
[CODE]function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "owning_ent")
end[/CODE]
cl_init:
[CODE]local owner = self:Getowning_ent()
owner = (IsValid(owner) and owner:Nick()) or DarkRP.getPhrase("unknown")[/CODE]
What does it do to extract the owner of the printer? I am not sure how the F$@% it works. clarification would be cool.
[code]function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "owning_ent")
end[/code]
The function here create a Entity:Set/Getowning_ent functions for the ENT table, assigns ID of 0 and type of Entity to it.
There functions are synched with client whenever Setowning_ent is called on the server, so you can call self:Getowning_ent() in cl_init and it will return the same value as on server.
See this article: [url]http://wiki.garrysmod.com/page/Networking_Entities[/url]
Sorry, you need to Log In to post a reply to this thread.