I've got a net message going from server->client that writes an entity, but when it's received client-side the entity is Null - The entity itself is a nextbot I created:
[B]Server-side:[/B]
[CODE]
function Hint:ClientCreate( target )
net.Start( "GAME_Hint_Create" )
if isentity( self:GetTrigger() ) then
print( "IS ENTITY" )
print( self:GetTrigger() )
net.WriteEntity( self:GetTrigger() )
end
net.Send( self:GetTargets() )
end
[/CODE]
[B]Server-side Output:[/B]
[CODE]
> IS ENTITY
> NextBot [65][npc_marshal]
[/CODE]
[B]Client-side:[/B]
[CODE]
function hint.Create()
print( "Creating locally" )
local trigger = net.ReadEntity()
print(trigger)
end
net.Receive( "GAME_Hint_Create", hint.Create )
[/CODE]
[B]Client-side Output:[/B]
[CODE]
> Creating locally
> [NULL Entity]
[/CODE]
[editline]6th February 2017[/editline]
[B]Solved[/B]
As I was doing this on spawn, the entity hadn't been created client-side yet, so adding a 0.1 second delay fixed this.
[url]https://facepunch.com/showthread.php?t=1254042&p=39925699&viewfull=1#post39925699[/url]
[url]https://facepunch.com/showthread.php?t=1254042&p=39925923&viewfull=1#post39925923[/url]
Sorry, you need to Log In to post a reply to this thread.