Serverside:
[CODE]function ENT:PopulateClientModels()
net.Start("FarmPopulateModels")
local ent = self // Ive tried the 2 variations below:
print(self) // "Entity [311][mres_soil]"
print(self.Entity) // "Entity [311][mres_soil]"
print(ent) // "Entity [311][mres_soil]"
net.WriteTable(self.Models)
net.WriteEntity(ent)
PrintTable(self.Models)
net.Broadcast()
end
util.AddNetworkString("FarmPopulateModels")[/CODE]
Clientside
[CODE]function PopulateModels(len, ply)
local models = net.ReadTable()
local ent = net.ReadEntity()
print(ent) // prints out "[NULL Entity]"
for k, v in pairs(models) do
// Is this model empty?
if v == "" then
if ent.Slots[k] then
// Yup. Nothing in that slot, remove the viewmodel
ent.Slots[k]:Remove()
end
else
if ent.Slots and ent.Slots[k] then
// Remove the old one and make a new.
ent.Slots[k]:Remove()
end
ent:MakeModel(k, v)
end
end
end
net.Receive("FarmPopulateModels", PopulateModels)[/CODE]
WHY?! Serverside gets the entity fine, but when I send it through the net library, I always get [NULL ENTITY] on Client despite that Server is displaying the proper entity and supposedly sending it...
Is the entity in the clients PVS?
Yup. It is quite literally about 30 units away from me.
Function gets called when the entity is spawned by the player.
That might be why, entities become valid clientside later than serverside, try sending it in a timer
Thx.
Sorry, you need to Log In to post a reply to this thread.