diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 20:43:26 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 20:43:26 -0400 |
| commit | 522cdfc0e24b45cf02d8c22cef85fa32408f1376 (patch) | |
| tree | 463ce70002a98847bdd6f6d78f479276cf92c684 /gamemode/core | |
| parent | 5e6e88f98300d4c3d41aad7cff5346539f4f9f66 (diff) | |
| download | artery-522cdfc0e24b45cf02d8c22cef85fa32408f1376.tar.gz artery-522cdfc0e24b45cf02d8c22cef85fa32408f1376.tar.bz2 artery-522cdfc0e24b45cf02d8c22cef85fa32408f1376.zip | |
Fixed a bug with server teleporters
Server teleports were not saveing to the database in the right format
Diffstat (limited to 'gamemode/core')
| -rw-r--r-- | gamemode/core/database/sv_setup.lua | 7 | ||||
| -rw-r--r-- | gamemode/core/mapstich/sv_mapstich.lua | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua index 6a7548d..6676735 100644 --- a/gamemode/core/database/sv_setup.lua +++ b/gamemode/core/database/sv_setup.lua @@ -67,7 +67,10 @@ function sql.GetPlayerData(ply) ply:ConCommand("connect " .. mtbl.lastserver) return end - ply:SetPos(mtbl.lastlocation) + local _,_,x,y,z = string.find(mtbl.lastlocation,"([-%d%.]+) ([-%d%.]+) ([-%d%.]+)") + local vec = {x,y,z} + for k,v in pairs(vec) do vec[k] = tonumber(v) end + ply:SetPos(Vector(unpack(vec))) q.deserialize_player(ply,plyd) end end @@ -88,6 +91,8 @@ function sql.CreatePlayerTable(ply) local plymet = data.newmeta() local plydata = util.TableToJSON(plytbl) local metdata = util.TableToJSON(plymet) + print("plydata", plydata) + print("metdata", metdata) local q_str = q.s_fmt(create_player_query,s64,plydata,metdata) local q_suc = function(res,li) --print("Inserted new player",ply) diff --git a/gamemode/core/mapstich/sv_mapstich.lua b/gamemode/core/mapstich/sv_mapstich.lua index 121c0c9..7a90189 100644 --- a/gamemode/core/mapstich/sv_mapstich.lua +++ b/gamemode/core/mapstich/sv_mapstich.lua @@ -23,8 +23,9 @@ local function SavePlayerData(ply) ]] local pmet = util.TableToJSON({ lastserver = game.GetIPAddress(), - lastlocation = ply:GetPos() + lastlocation = tostring(ply:GetPos()) }) + print("pmet turns out to be",pmet) query = q.s_fmt(query,pdat,pmet,ply:SteamID64()) end MySQLite.query(query,function(data) @@ -48,16 +49,14 @@ net.Receive("art_zonechange",function(len,ply) dontupdatedisconnect[ply] = true local query = [[ - UPDATE playerdata SET PlayerData='%s',MetaData='%s' WHERE SteamID=%.0f + UPDATE playerdata SET MetaData='%s' WHERE SteamID=%.0f ]] - local pdat = util.TableToJSON(ply.data) local pmet = util.TableToJSON({ lastserver = zone.toserver, - lastlocation = zone.topos + lastlocation = tostring(zone.topos) }) - print("pdat is", pdat) print("pmet is", pmet) - local fquery = q.s_fmt(query,pdat,pmet,ply:SteamID64()) + local fquery = q.s_fmt(query,pmet,ply:SteamID64()) print("fquery was", fquery) print("Running query:",qc) MySQLite.query(fquery,function(data) |
