For some reason, I made a database but seems it not 'saving' the information, Could someone point me where I'm going wrong.
the creating of the database
db:create("playerstatus", {
players = {
name = "",
status = "",
class = "",
_unique = { "name" },
_violations = "REPLACE"
},
})
mayhem.playerstatus.db = db:get_database("playerstatus")
setStatus()
function setStatus(player, status)
echo(player:title() .. " set to " .. status:title())
local Uname = player:title()
local class = getClass(player)
db:merge_unique(mayhem.playerstatus.db.players, {name=Uname, status=status:lower(), class=class})
end
getStatus
function getStatus(player)
local Uname = player:title()
local results = db:fetch(mayhem.playerstatus.db.players, db:eq(mayhem.playerstatus.db.players.name, Uname))
if not results[1] then
return "Unknown"
else
return results[1].status:title()
end
return "Unknown"
end
So, if I do, lua setStatus("Batman", "undead") it echos - Batman set to Undead - to show its working right?
but when I do, display(mayhem.playstatus) it shows
{
db = {
_db_name = "playerstatus",
players = {
_sht_name = "players",
name = {
database = "playerstatus",
type = "string",
name = "name",
sheet = "players"
},
_db_name = "playerstatus"
}
}
}
Any help or advise will be greatly appreciated