function SearchDatabase(ply, value)
local id = ply:SteamID()
if id == nil then return end
local query = ECLIPSEUSERDATA:query("SELECT " .. value .. " FROM main WHERE usersteamid = '" .. id .. "';")
if not query then return end
query.onData = function(q, d)
if(#query:getData() >= 1)then
print("[SQL]" .. value .. " = " .. tostring(d[value]))
print(tostring(d[value]))
return tostring(d[value])
end
end
query.onError = function(db, err)
print("[SQL] Failed to search database - Error: ", err)
end
query:start()
query:wait()
end
function UpdatePlaytime(ply)
if ply == nil then
return
end
local PlayersPlaytime = SearchDatabase(ply, "playtime")
print(PlayersPlaytime)
local PlaytimeUpdate = PlayersPlaytime + 1
end
我当前遇到的问题是当值:d [value]返回到我的函数UpdatePlaytime()函数时,它返回的是nil值,我不知道如何解决它。
控制台日志:
[SQL]playtime = 0
0
nil
任何帮助将不胜感激!
-D12
好,我的问题已经解决,非常感谢!
-D12