I have an entity and I want to set the entity in the message to the entity itself. How do I do it?
Uh, what? You want to use self in a net message? Just use self. Show code where you want to send the message for further help.
Sorry for being vauge, not sure why its so hard to explain lol.
Im trying to send WriteEntity self in a Net message on my clientside code:
[code]
net.Receive("showUpgrades", function(length, client)
local upgradeMechanics = vgui.Create("DButton" , upgradesMenu)
upgradeMechanics:SetPos(7, 75)
upgradeMechanics:SetSize(185, 30)
upgradeMechanics:SetText("Destroy")
upgradeMechanics.DoClick = function()
net.Start("DestroyPrinter")
net.WriteEntity(self)
net.SendToServer()
end
[/code]
On the other end I just get a nil entity
Can you show more surrounding code? Is this inside cl_init.lua of an entity or what? Do you have a reference to the entity you want to send somewhere?
Oh jesus. Sorry, my head is all over the place today! I left a bit of code relating to this that I knew had an error and forgot to remove.
:v:
Thanks for the help folks.
Sorry, you need to Log In to post a reply to this thread.