Hi. I get values of entity(eself) and TimeLeft but eself.LampColor don't. What could be wrong?
The server:
util.AddNetworkString("DoWork")
net.Start("DoWork")
net.WriteEntity(self)
net.WriteInt(self.TimeOfBake,8)
net.WriteColor(Color(0,255,0,255))
net.Broadcast()
The client:
function ENT:Initialize()
self.LampColor = Color(255,0,0,255)
end
net.Receive("DoWork", function()
eself = net.ReadEntity()
eself.TimeLeft = net.ReadInt(8)
eself.LampColor = net.ReadColor()
eself.EnableTime = false
eself.trans = 255
eself.rspeed = -120
eself.work_icon = Material( "icons/work.png" )
eself.CountTime = true
end)
I beleive @Biohazard99 's response is adequate, but I would like to clarify-
Is the client able to modify the entity? Sometimes WriteEntity effectively returns a shell of the entity's former self (no position, angle functions, etc can be called), so I hope you are only using the entity as a table upon reaching the client. I could be wrong, but not all entities get networked right.
Nothing helped me. I discovered that print at others net.Receives don't work too (but variables work). If I press CTRL+S and try to do my code all works perfectly. Looks like util.AddNetworkString disappears but after save appears
This shouldn't happen as (Write|Read)Entity just uses the entity index.
garrysmod/net.lua at 394ae745df8f8f353ea33c8780f012fc000f4f56 · ..
Sorry, you need to Log In to post a reply to this thread.