kito2
www.masteria.net
wat the shouldn't be like that
i guess i have to update this too <_<
It works pretty good, and keeps having my db pretty clean xD
i guess i should make it like that
Lert me help you:
Lua:
function getLastLoginDiff(name)
if type(name) ~= "string" then
return name
end
local res = db.getResult("SELECT `lastlogin` FROM `players` WHERE `name` = '"..name.."';")
if res:getID() ~= -1 then
return os.time()-res:getDataInt('lastlogin')
end
end
local days = 7
function onStartup()
local guild = db.getResult("SELECT `id`, `ownerid` FROM `guilds`;")
if guild:getID() == -1 then
return true
end
repeat
local id, owner = guild:getDataInt("id"), guild:getDataInt("ownerid")
local diff = getLastLoginDiff(getPlayerNameByGUID(owner))
if diff >= 7*24*60*60 then
db.executeQuery("DELETE FROM `guilds` WHERE `id` = "..id..";")
end
until not(guild:next())
guild:free()
return true
end
I think that you made that script once... It clean guilds for leader who hasn't logged in on a few days, but if leader have a name with ', it gives errors, maybe you could add this to this script.