Level history is now stored in player_level

This commit is contained in:
Timo Smit 2016-09-04 21:48:03 +02:00
parent de9e7b50fe
commit 73d66589e7
2 changed files with 8 additions and 8 deletions

View file

@ -137,13 +137,13 @@ function mysql.getlastalias(playerid)
return alias
end
-- setlevels
-- level history
function mysql.addsetlevel(playerid, level, adminid, datetime)
cur = assert(con:execute("INSERT INTO `level` (`player_id`, `level`, `admin_id`, `datetime`) VALUES ("..tonumber(playerid)..", "..tonumber(level)..", "..tonumber(adminid)..", "..tonumber(datetime)..")"))
cur = assert(con:execute("INSERT INTO `player_level` (`player_id`, `level`, `admin_id`, `datetime`) VALUES ("..tonumber(playerid)..", "..tonumber(level)..", "..tonumber(adminid)..", "..tonumber(datetime)..")"))
end
function mysql.getlevelscount(playerid)
cur = assert(con:execute("SELECT COUNT(`id`) AS `count` FROM `level` WHERE `player_id`="..tonumber(playerid)..""))
cur = assert(con:execute("SELECT COUNT(`id`) AS `count` FROM `player_level` WHERE `player_id`="..tonumber(playerid)..""))
local count = tonumber(cur:fetch({}, "a")["count"])
cur:close()
@ -155,7 +155,7 @@ function mysql.getlevels(playerid, limit, offset)
limit = limit or 30
offset = offset or 0
cur = assert(con:execute("SELECT * FROM `level` WHERE `player_id`="..tonumber(playerid).." LIMIT "..tonumber(limit).." OFFSET "..tonumber(offset)))
cur = assert(con:execute("SELECT * FROM `player_level` WHERE `player_id`="..tonumber(playerid).." LIMIT "..tonumber(limit).." OFFSET "..tonumber(offset)))
local levels = {}
local row = cur:fetch({}, "a")

View file

@ -137,13 +137,13 @@ function sqlite3.getlastalias(playerid)
return alias
end
-- setlevels
-- level history
function sqlite3.addsetlevel(playerid, level, adminid, datetime)
cur = assert(con:execute("INSERT INTO `level` (`player_id`, `level`, `admin_id`, `datetime`) VALUES ("..tonumber(playerid)..", "..tonumber(level)..", "..tonumber(adminid)..", "..tonumber(datetime)..")"))
cur = assert(con:execute("INSERT INTO `player_level` (`player_id`, `level`, `admin_id`, `datetime`) VALUES ("..tonumber(playerid)..", "..tonumber(level)..", "..tonumber(adminid)..", "..tonumber(datetime)..")"))
end
function sqlite3.getlevelscount(playerid)
cur = assert(con:execute("SELECT COUNT(`id`) AS `count` FROM `level` WHERE `player_id`="..tonumber(playerid)..""))
cur = assert(con:execute("SELECT COUNT(`id`) AS `count` FROM `player_level` WHERE `player_id`="..tonumber(playerid)..""))
local count = tonumber(cur:fetch({}, "a")["count"])
cur:close()
@ -155,7 +155,7 @@ function sqlite3.getlevels(playerid, limit, offset)
limit = limit or 30
offset = offset or 0
cur = assert(con:execute("SELECT * FROM `level` WHERE `player_id`="..tonumber(playerid).." LIMIT "..tonumber(limit).." OFFSET "..tonumber(offset)))
cur = assert(con:execute("SELECT * FROM `player_level` WHERE `player_id`="..tonumber(playerid).." LIMIT "..tonumber(limit).." OFFSET "..tonumber(offset)))
local levels = {}
local row = cur:fetch({}, "a")