• Tried to use a NULL entity! Error
    5 replies, posted
I tried this code and it gives me a error. ERROR > [line 31] Tried to use a NULL entity! CODE> [CODE] [26] function updateClient(ply) [27] net.Start("StartingVars") [28] net.WriteInt(GMoney, 8) [29] net.WriteInt(GLevel, 8) [30] net.WriteInt(GEXP, 8) [31] net.Send(ply) [32] end [/CODE]
Where are you running updateClient? You need to give it a player
in server [CODE] util.AddNetworkString("StartingVars") GMoney = 50 GLevel = 1 GEXP = 0 GMoney1 = 50 GLevel1 = 1 GEXP1 = 0 function updateClient(ply) net.Start("StartingVars") net.WriteInt(GMoney, 8) net.WriteInt(GLevel, 8) net.WriteInt(GEXP, 8) net.Send(ply) end net.Receive("StartingVars",function(len, ply) GMoney1 = net.ReadInt(8) GLevel1 = net.ReadInt(8) GEXP1 = net.ReadInt(8) updateClient() end) [/CODE] and in CLIENT [CODE] function updateServer() net.Start("example") net.WriteInt(GMoney, 8) net.WriteInt(GLevel, 8) net.WriteInt(GEXP, 8) net.SendToServer() end net.Receive("example" , function(len) GMoney1 = net.ReadInt(8) GLevel1 = net.ReadInt(8) GEXP1 = net.ReadInt(8) updateServer() end) [/CODE]
[QUOTE=GoldenLeopard;50542185]in server [CODE] util.AddNetworkString("StartingVars") GMoney = 50 GLevel = 1 GEXP = 0 GMoney1 = 50 GLevel1 = 1 GEXP1 = 0 function updateClient(ply) net.Start("StartingVars") net.WriteInt(GMoney, 8) net.WriteInt(GLevel, 8) net.WriteInt(GEXP, 8) net.Send(ply) end net.Receive("StartingVars",function(len, ply) GMoney1 = net.ReadInt(8) GLevel1 = net.ReadInt(8) GEXP1 = net.ReadInt(8) updateClient() end) [/CODE] and in CLIENT [CODE] function updateServer() net.Start("example") net.WriteInt(GMoney, 8) net.WriteInt(GLevel, 8) net.WriteInt(GEXP, 8) net.SendToServer() end net.Receive("example" , function(len) GMoney1 = net.ReadInt(8) GLevel1 = net.ReadInt(8) GEXP1 = net.ReadInt(8) updateServer() end) [/CODE][/QUOTE] You need to pass ply as an argument, Go look at the code that you saw again and read through it.
You didn't ever give updateClient a player. Just do [CODE] updateClient( ply ) [/CODE] In the server file [editline]18th June 2016[/editline] ninja'd
[QUOTE=GoldenLeopard;50542185]-snip-[/QUOTE] Use code tags, either [noparse] [code] -- CODE HERE [/code] or [lua] -- CODE HERE [/lua] [/noparse] Back onto the topic, you have to call `updateClient` with a player argument. I can't really tell what you're going for though, considering your net message names don't match, and if they did it'd just create an inf loop.
Sorry, you need to Log In to post a reply to this thread.