I am having this weird problem where I am trying to update the player info on the scoreboard with values from the sever. So when I run a console command it runs a concommand on the server that sends a net message with here is the output from the console command, and the callback from the net receive.
[IMG]http://puu.sh/3yUcA.png[/IMG]
[code]
concommand.Add("updatesb", function(ply, cmd, args)
net.Start("updatesb")
net.WriteUInt(#player.GetAll(), 32)
for k, v in pairs(player.GetAll()) do
print("Writing", v:Nick(), 69, 0)
net.WriteTable({name = v:Nick(), money = 69, wins = v.wins or 0})
end
net.Broadcast()
print("Sent.")
end)
[/code]
[code]
RunConsoleCommand("updatesb")
net.Receive("updatesb", function()
for i = 1, net.ReadUInt(32) do
table.insert(playerdata, net.ReadTable())
table.foreach(playerdata[i], print)
end
end)
[/code]
Thanks in advance.
EDIT:
To clarify the data in the picture should match the data that the client is receiving, but it isn't)
And once reload the gamemode it works fine
Is v.wins a real variable?
It doesn't have to be. I did
[code]
v.wins or 0
[/code]
So if it is nil then it will assign 0 to it
[editline]9th July 2013[/editline]
Besides I am not getting any errors, the values are just not coming back what they should be.
You are writing a table and reading UInits, of course if will fuck up.
[QUOTE=Robotboy655;41382108]You are writing a table and reading UInits, of course if will fuck up.[/QUOTE]
How should I do it then?
[editline]9th July 2013[/editline]
Also I am reading them in the right order, so what you are saying is not causing the problem.
[img]http://i44.tinypic.com/361lg.png[/img]
Works fine for me.
Change the value in the server file, and then do not reload the client file. And then run the console command.
-snip-
Sorry, you need to Log In to post a reply to this thread.