diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 17:52:42 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 17:52:42 -0400 |
| commit | 5e6e88f98300d4c3d41aad7cff5346539f4f9f66 (patch) | |
| tree | bc5de00f63a8b1d5226b0c2988fcdaa06f6e2f13 /gamemode/core/database/sv_queries.lua | |
| parent | 978909d830dd173f8b018f36c5f142d225732ba1 (diff) | |
| download | artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.tar.gz artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.tar.bz2 artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.zip | |
Fixed loading bug
Fixed a bug where the equipment inventory would not load correctly.
Diffstat (limited to 'gamemode/core/database/sv_queries.lua')
| -rw-r--r-- | gamemode/core/database/sv_queries.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gamemode/core/database/sv_queries.lua b/gamemode/core/database/sv_queries.lua index 4e48255..f059b44 100644 --- a/gamemode/core/database/sv_queries.lua +++ b/gamemode/core/database/sv_queries.lua @@ -11,19 +11,21 @@ function q.serialize_player(ply) local sdata = {} local invs = {} for k,v in pairs(ply.data.inventories) do - invs[k] = {v.Name,v:Serialize()} + local idata = string.format("%q",v:Serialize()) + invs[k] = {v.Name,string.sub(idata,2,#idata-1)} --remove the otter quotes end sdata.inventories = invs sdata.skills = ply.data.skills sdata.quests = ply.data.quests sdata.prayers = ply.data.prayers sdata.credits = ply.data.credits - return util.TableToJSON(sdata) + local ret = util.TableToJSON(sdata) + return ret end function q.deserialize_player(ply,str) - print("Deseriailizeing player",ply," with ", str) track.ClearInventories(ply) + ply.data = ply.data or {} local tbl = util.JSONToTable(str) local invs = tbl.inventories print("Inventories was", invs) @@ -32,7 +34,6 @@ function q.deserialize_player(ply,str) print("Giveing inventory",v[1],v[2]) track.GiveInventoryWithData(ply,v[1],v[2]) end - ply.data = ply.data or {} ply.data.skills = tbl.skills or {} ply.data.quests = tbl.quests or {} ply.data.prayers = tbl.prayers or {} |
