• Json table problem
    5 replies, posted
Hi, My friend tried to help me to make a code in order to show ulib bans but it doesn't work. Could you help me to fix it ? Regards,   --server util.AddNetworkString( "sendtable" )     local json = util.TableToJSON(ULib.bans)     json = util.Compress(json)     net.Start( "sendtable" )              net.WriteUInt( json:len(), 32 )                  net.WriteData( json, json:len() )     net.Broadcast() --client net.Receive("sendtable", function()         local len = net.ReadUInt( 32 )         local json = net.ReadData( len )         json = util.Decompress(json)         ULib.bans = util.JSONToTable (json)         print(ULib.bans)     end)
the net.broadcast runs as soon as the server loads the addon, when there are no players to receive it
It gives me : table: 0x363d7f60
Yeah, its a table? What do you expect it to print? PrintTable
For example here is my ulib data banlist .txt : "STEAM_1:0:142064608" { "unban" "0" "time" "1534592703" "admin" "yung pitch(STEAM_0:0:142066608)" } I would like to print it in order to get the steam id the time the admin's name etc..
then use PrintTable instead of print like polivilas said. also unless you want the bans to be sent to every player on the server when somebody uses your command you should replace net.broadcast with net.send(player that used the concommand)
Sorry, you need to Log In to post a reply to this thread.