Lua:
local inactiveMonthsTomoveCharacter = 1
local function executeDatabase(fromClause)
local totalClear = 0
local resultId = db.storeQuery("SELECT COUNT(*) AS `count` FROM ".. fromClause)
if resultId ~= false then
totalClear = result.getNumber(resultId, 'count')
result.free(resultId)
if totalClear > 0 then
db.query("UPDATE FROM ".. fromClause)
end
end
return totalClear
end
local function doCheckInactivePlayer()
local timeStamp = os.time() - (86400 * (inactiveMonthsTomoveCharacter * 30))
local fromClause = "`players` SET `account_id` = 2 WHERE `group_id` = 1 AND lastlogin <= ".. timeStamp
return executeDatabase(fromClause)
end
function onStartup()
local inactivePlayer = doCheckInactivePlayer()
if inactivePlayer > 0 then
print(">> ".. inactivePlayer .. " inactive players.")
end
end
I'm trying to make if the player is 'X' offline time the character is moved to account id 'Y'