Even sneaking it through the table via:
[code]net.WriteTable( { ent = self, schema = self.schema } )[/code]
Returns: ent = [NULL Entity ]
:snip:
[QUOTE=MPan1;50370192]You have spawned the entity, right?[/QUOTE]
[t]http://puu.sh/p0Vzs/3dddd74dc4.png[/t]
This is probably not going to work whatsoever, but try something like this:
[CODE]
function ENT:SpawnFunction( ply, tr, ClassName )
self.ent = ents.Create( ClassName )
-- blah blah
self.ent:Spawn()
-- try sending self.ent here
end
[/CODE]
Then try sending self.ent
[QUOTE=MPan1;50370198]This is probably not going to work whatsoever, but try something like this:
[CODE]
function ENT:SpawnFunction( ply, tr, ClassName )
self.ent = ents.Create( ClassName )
-- blah blah
self.ent:Spawn()
-- try sending self.ent here
end
[/CODE]
Then try sending self.ent[/QUOTE]
Still Null
[QUOTE=Netheous;50370204]Still Null[/QUOTE]
do some debug and check if the self var is definitely a entity serverside
[QUOTE=rtm516;50370211]do some debug and check if the self var is definitely a entity serverside[/QUOTE]
Again, I did.
[t]http://puu.sh/p0VmF/3e50cfd1e8.png[/t]
[QUOTE=Netheous;50370221]Again, I did.
[t]http://puu.sh/p0VmF/3e50cfd1e8.png[/t][/QUOTE]
oh soz missed that
Does the entity even exist clientside? Do PrintTable(ents.FindByClass "pw_constructionside") clientside and see if you get anything.
I don't have much experience with entities, but I think some ENT.Type's are meant for serverside use only.
[QUOTE=NeatNit;50370229]Does the entity even exist clientside? Do PrintTable(ents.FindByClass "pw_constructionside") clientside and see if you get anything.[/QUOTE]
[t]http://puu.sh/p0Wec/8a8695a4d1.png[/t]
[editline]22nd May 2016[/editline]
[QUOTE=man with hat;50370230]I don't have much experience with entities, but I think some ENT.Type's are meant for serverside use only.[/QUOTE]
I'm using anim - I used the same for everything else that has a working networking.
[QUOTE=Netheous;50370235][t]http://puu.sh/p0Wec/8a8695a4d1.png[/t]
[editline]22nd May 2016[/editline]
I'm using anim - I used the same for everything else that has a working networking.[/QUOTE]
Only other things I can think of is trying the stuff on this page.
[url]http://wiki.garrysmod.com/page/Controlling_Entity_Transmission[/url]
[QUOTE=man with hat;50370243]Only other things I can think of is trying the stuff on this page.
[url]http://wiki.garrysmod.com/page/Controlling_Entity_Transmission[/url][/QUOTE]
I've set transmit rate to: always, but the outcome is the same:
[NULL Entity]
Can you write any other ents in that particular net broadcast and see if the client receives them correctally
Hmm, what is weird is that when I print out self.pieces inside that funciton, it returns nothing.. but when I print it within swep I created it with, it prints out pieces just fine - I'm assuming this is the issue, here's code:
[code]AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
SWEP.Weight = 1
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
util.AddNetworkString( "construction_placedummies" )
function SWEP:placeDummiesInWorld()
local uid = net.ReadString()
local dummies = net.ReadTable()
local site = ents.Create( "pw_constructionsite" )
site:SetPos( self.Owner:GetEyeTrace().HitPos )
site:Spawn()
site:setSchema( uid )
for i, dummy in pairs( dummies ) do
local piece = ents.Create( "pw_constructionpiece" )
piece:SetModel( dummy.piece.model )
piece:SetPos( dummy.pos )
piece:SetAngles( dummy.ang )
piece:Spawn()
piece:SetMaterial( "shadertest/wireframe" )
piece.site = site
table.insert( site.pieces, piece )
PrintTable( site.pieces )
end
notifications.send( self.Owner, "Construction site created for " .. construction.list[ uid ].name, Color( 0, 200, 255 ) )
end
net.Receive( "construction_placedummies", function( len, ply ) ply:GetActiveWeapon():placeDummiesInWorld() end )[/code]
[editline]22nd May 2016[/editline]
Printing them out in ENT:Use() also prints out all pieces so it's setSchema being faulty
Try to delay the net message with a timer of .5 seconds
You could try writing the EntIndex or also try
[CODE]
timer.Simple( 0, function() --send end )
[/CODE]
Because the ent may just be initializing.
That reminds me of an old issue I had, using EntIndex() helped in that case... let's see here.
You are too fast. As stated previously the entity will exist on the server the same frame but not necessarily on the client, this factors in ping and framerate of the server. The network is usually pretty fast so a frameskip is usually enough but that not might be the case with high latency or low fps on the server so a few miliseconds of margin will fix the problem.
Edit:
if you want to do it the proper way make the clientside ENT:Initialize() tell the server it's ready.
I'm damn clueless:
-I've sent EntIndex
-I've selected entity via ents.GetByIndex( 1 )
-I've delayed message even by 5 seconds
[t]http://puu.sh/p0Xu5/c2c6d98552.png[/t]
[editline]22nd May 2016[/editline]
-snip-
[editline]22nd May 2016[/editline]
I had to move setSchema() below generation of dummy models - it was being executed before dummy models were created and since net message was inside.
Thanks for all the input - it really helped me out!
Sorry, you need to Log In to post a reply to this thread.