• net.ReadEntity Null
    2 replies, posted
Hello, From my client I send one entity to my server like that: [CODE] net.Start( "call_taxi" ) net.WriteString( "trolol" ) net.WriteEntity( LocalPlayer() ) net.SendToServer() [/CODE] On my serverside I receive that entity like that: [CODE] util.AddNetworkString( "call_taxi" ) net.Receive( "call_taxi", function() local ply = net.ReadEntity() local text = net.ReadString() print( ply:IsValid(), ply ) print( text ) end) [/CODE] Result : [CODE] false [NULL Entity] olol [/CODE] Why my "trolol" become "olol" and why my entity is null ? I'm trying to understand, but no thread solve my problem. Thanks.
You have to read data in the same order you write it. Also, you shouldn't need to network the local player to the server as it'll be passed as the net.Receive callback's second argument. [code] net.Receive("call_taxi", function(len, ply) local text = net.ReadString() print( ply:IsValid(), ply ) print( text ) end) [/code] and so on
Oh my god ! Thank you so much ! it works !
Sorry, you need to Log In to post a reply to this thread.