• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

GlobalEvent 2.0 Database Cleaner - Inactive Players + The Players Child Data (skills, items, etc)

houses doors bugged
maybe you made them with a normal door without chaning them to house door
 
@GOD Wille
Open phpmyadmin, go 'status' and check server uptime (mysql). If it's few seconds, it mean that script crashed mysql. Edit mysql configuration and restart mysql. Maybe than script will not lose connection.

@Teh Maverick
Doesn't this script bug houses? Maybe before you do anything in database, you set owner = 0 [lua function] on houses that player (that you want delete) own. Server will move his items to depot (and set None name on doors, make house again buyable) and then you delete these items also by mysql query.
 
hmm the script needs to be worked on for house doors, doing that now. Will repost when I'm done (instead of deleting the house I will change the values required to 0)

EDIT- Fixed the house issue:
Lua:
------------------------------------------------------------------------------*
----- [[> Automated Database Cleanup 1.1 Structure //By Cybermaster <]] ------|
-------------- [[> System 2.0 Revamped by Teh Maverick <3 <]] ----------------|
------------- [[>  Removal of empty accounts by darkaos :) <]] ---------------|
--------------- [[> Function getDBPlayersCount() by Elf <]] ------------------|
------------------------------------------------------------------------------|
------------------------------------------------------------------------------|
--- ~!READ THIS!~ ------------------------------------------------------------|
--- Be sure to back up your database and test this on your server first, -----|
--- I(Teh Maverick) cannot guarantee it will work the same for every core. ---|
--- It is very easy to test, with the log file and values that are printed ---|
-----------------------------------Enjoy!-------------------------------------|
------------------------------------------------------------------------------*
 
function countRowsWhereInTable(table, field, condition)
    local result = db.getResult("SELECT COUNT(" .. field .. ") as count FROM " .. table .. " WHERE " .. field .. " = '" .. condition .. "';")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBPlayersCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `players`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBAccountsCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `accounts`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function onStartup()
	local DB_BEFORE = {players = getDBPlayersCount(), accounts = getDBAccountsCount()}
	local result,result1, ii, numPlayersToDelete, numAccountsDeleted, tmp = 0, 0, 0, 0, 0
	local pid, aid = {}, {}
	local dropCount = {players={},accounts={}}
 
	local config = {
		deleteAccountWithNoPlayers = true,
		cleanChildTables = true,
		printResult = true,
		saveResultToFile = true,
		logFileName = 'db_cleanup.txt'
	}
 
    --In each table, players with below specified level, and days of inactivity will be deleted from db on server startup
	local cleanup = {
		[1] = {level = 11, time = 5 * 24 * 60 * 60},
		[2] = {level = 20, time = 15 * 24 * 60 * 60},
		[3] = {level = 50, time = 30 * 24 * 60 * 60},
		[4] = {level = 100, time = 60 * 24 * 60 * 60},
		[5] = {level = 130, time = 90 * 24 * 60 * 60}
	}
 
	local childAttributeTables = {
		players = {
			[1] = {table = "`player_viplist`", idField = "`player_id`"},
			[2] = {table = "`player_storage`", idField = "`player_id`"},
			[3] = {table = "`player_spells`", idField = "`player_id`"},
			[4] = {table = "`player_skills`", idField = "`player_id`"},
			[5] = {table = "`player_namelocks`", idField = "`player_id`"},
			[6] = {table = "`player_items`", idField = "`player_id`"},
			[7] = {table = "`player_depotitems`", idField = "`player_id`"},
			[8] = {table = "`houses`", idField = "`owner`"},
			[9] = {table = "`house_auctions`", idField = "`player_id`"},
			[10] = {table = "`players`", idField = "`id`"} -- Keep this as the last item in the array
			--Note: `houses` and `bans` are in the DB triggers for TFS so don't worry about them.
			--Also I did not want to put killers, or deaths on here because that is historic data,
			--do so at your own risk.
		},
		accounts = {
			[1] = {table = "`accounts`", idField = "`id`"},
			[2] = {table = "`account_viplist`", idField = "`account_id`"}
		}
	}
	
	--Clean up all the players and player data
	for i = 1, #cleanup do
		result = db.getResult("SELECT `id`,`name`,`account_id` FROM `players` WHERE `level` < ".. cleanup[i].level .." AND `name` NOT IN('Account Manager', 'Sorcerer Sample', 'Druid Sample', 'Paladin Sample', 'Knight Sample', 'Rook Sample') AND `group_id` < 2 AND `lastlogin` < UNIX_TIMESTAMP() - ".. cleanup[i].time ..";")
		if(result:getID() ~= -1) then
			ii = 1
			repeat
				pid[ii] = result:getDataInt("id") -- list the players id into an array
				aid[ii] = result:getDataInt("account_id") -- list the account id of each player being removed into an array
				ii = ii + 1
			until not(result:next())
			result:free()
		end
		numPlayersToDelete = ii - 1
 
		--Drop players and their child table attribute data such as skills, items, etc.
		for j = 1, numPlayersToDelete do
			
			if(config.cleanChildTables) then
				for k = 1, #childAttributeTables.players do
					if childAttributeTables.players[k].table == "houses" then
						house = getHouseByPlayerGUID(pid[j])
						if house ~= 0 or house ~= nil then
							doCleanHouse(house)
							doUpdateHouseAuctions()
						end
					else
						dropCount.players[k] = ((dropCount.players[k] or 0) + countRowsWhereInTable(childAttributeTables.players[k].table, childAttributeTables.players[k].idField, pid[j]))
						db.executeQuery("DELETE FROM " .. childAttributeTables.players[k].table .. " WHERE " .. childAttributeTables.players[k].idField .. " = '" .. pid[j] .. "';")
					end
				end
			else
				db.executeQuery("DELETE FROM `players` WHERE `id` = '" .. pid[j] .. "';")
			end
		end
    end
	
	--Drop all the accounts that have 0 players linked to them (at the moment its only checking from the list of players removed)
	if config.deleteAccountWithNoPlayers then
		--This part was scripted by Darkhaos, modified/fixed by Teh Maverick --[[
		for acc = 1, #aid do
			result1 = db.getResult("SELECT `id` FROM `accounts` WHERE `id` = '" .. aid[acc] .. "';")
			if result1:getID() ~= -1 then -- check to make sure the account exists
				result1:free()
				for i = 1, #childAttributeTables.accounts do
					--Make sure there are no other players on the account
					result1 = db.getResult("SELECT COUNT(id) as count FROM `players` WHERE `account_id` = '" .. aid[acc] .. "';")
					tmp = result1:getDataInt("count")
					if(tmp <= 0) then
						--Remove accounts
						dropCount.accounts[i] = ((dropCount.accounts[i] or 0) + countRowsWhereInTable(childAttributeTables.accounts[i].table, childAttributeTables.accounts[i].idField, aid[acc]))
						db.executeQuery("DELETE FROM " .. childAttributeTables.accounts[i].table .. " WHERE " .. childAttributeTables.accounts[i].idField .. " = '" .. aid[acc] .. "';")
					end
				end
			end
		end
	end
	--]]
 
	--Print and Save results (configurable)
	local DB_NOW = {players = DB_BEFORE.players - getDBPlayersCount(), accounts = DB_BEFORE.accounts - getDBAccountsCount()}
	if DB_NOW.players > 0 or DB_NOW.accounts > 0 then
		local text = ">> [DBCLEANUP] " .. DB_NOW.players .. " inactive players" .. (config.deleteAccountWithNoPlayers and " and " .. DB_NOW.accounts .. " empty accounts" or "") .. " have been deleted from the database."
 
		--Write to console
		if config.printResult then
			print("")
			print(text)
			if config.cleanChildTables then
				--Write player info
				for i = 1,#dropCount.players do
					print("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1,#dropCount.accounts do
						print("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table")
					end
				end
				print("")
			end
		end
 
		--Write to file
		if config.saveResultToFile then
 
			local file = io.open("data/logs/"..config.logFileName, "a")
			file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. text .. "\n")
 
			if config.cleanChildTables then
				--Write player info
				for i = 1, #dropCount.players do
					file:write("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table\n")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1, #dropCount.accounts do
						file:write("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table\n")
					end
				end
				file:write("\n")
			end
			file:close()
		end
	end
	return true
end

Updated main post
 
Last edited:
Bumping for people who used this while it was untested lol.

I have been using on my dedicated server for a couple of weeks now and have had no issues :)
 
I added a feature here, now you can decide if script can delete empty accounts with premdays or not.
Lua:
------------------------------------------------------------------------------*
----- [[> Automated Database Cleanup 1.1 Structure //By Cybermaster <]] ------|
-------------- [[> System 2.0 Revamped by Teh Maverick <3 <]] ----------------|
------------- [[>  Removal of empty accounts by darkhaos :) <]] ---------------|
--------------- [[> Function getDBPlayersCount() by Elf <]] ------------------|
------------------------------------------------------------------------------|
------------------------------------------------------------------------------|
--- ~!READ THIS!~ ------------------------------------------------------------|
--- Be sure to back up your database and test this on your server first, -----|
--- I(Teh Maverick) cannot guarantee it will work the same for every core. ---|
--- It is very easy to test, with the log file and values that are printed ---|
-----------------------------------Enjoy!-------------------------------------|
------------------------------------------------------------------------------*
 
function countRowsWhereInTable(table, field, condition)
    local result = db.getResult("SELECT COUNT(" .. field .. ") as count FROM " .. table .. " WHERE " .. field .. " = '" .. condition .. "';")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBPlayersCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `players`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBAccountsCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `accounts`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function onStartup()
	local DB_BEFORE = {players = getDBPlayersCount(), accounts = getDBAccountsCount()}
	local result,result1, ii, numPlayersToDelete, numAccountsDeleted, tmp = 0, 0, 0, 0, 0
	local pid, aid = {}, {}
	local dropCount = {players={},accounts={}}
 
	local config = {
		deleteAccountWithNoPlayers = true,
		deleteAccountWithPremDays = true,
		cleanChildTables = true,
		printResult = true,
		saveResultToFile = true,
		logFileName = 'db_cleanup.txt'
	}
 
    --In each table, players with below specified level, and days of inactivity will be deleted from db on server startup
	local cleanup = {
		[1] = {level = 11, time = 5 * 24 * 60 * 60},
		[2] = {level = 20, time = 15 * 24 * 60 * 60},
		[3] = {level = 50, time = 30 * 24 * 60 * 60},
		[4] = {level = 100, time = 60 * 24 * 60 * 60},
		[5] = {level = 130, time = 90 * 24 * 60 * 60}
	}
 
	local childAttributeTables = {
		players = {
			[1] = {table = "`player_viplist`", idField = "`player_id`"},
			[2] = {table = "`player_storage`", idField = "`player_id`"},
			[3] = {table = "`player_spells`", idField = "`player_id`"},
			[4] = {table = "`player_skills`", idField = "`player_id`"},
			[5] = {table = "`player_namelocks`", idField = "`player_id`"},
			[6] = {table = "`player_items`", idField = "`player_id`"},
			[7] = {table = "`player_depotitems`", idField = "`player_id`"},
			[8] = {table = "`houses`", idField = "`owner`"},
			[9] = {table = "`house_auctions`", idField = "`player_id`"},
			[10] = {table = "`players`", idField = "`id`"} -- Keep this as the last item in the array
			--Note: `houses` and `bans` are in the DB triggers for TFS so don't worry about them.
			--Also I did not want to put killers, or deaths on here because that is historic data,
			--do so at your own risk.
		},
		accounts = {
			[1] = {table = "`accounts`", idField = "`id`"},
			[2] = {table = "`account_viplist`", idField = "`account_id`"}
		}
	}
 
	--Clean up all the players and player data
	for i = 1, #cleanup do
		result = db.getResult("SELECT `id`,`name`,`account_id` FROM `players` WHERE `level` < ".. cleanup[i].level .." AND `name` NOT IN('Account Manager', 'Sorcerer Sample', 'Druid Sample', 'Paladin Sample', 'Knight Sample', 'Rook Sample') AND `group_id` < 2 AND `lastlogin` < UNIX_TIMESTAMP() - ".. cleanup[i].time ..";")
		if(result:getID() ~= -1) then
			ii = 1
			repeat
				pid[ii] = result:getDataInt("id") -- list the players id into an array
				aid[ii] = result:getDataInt("account_id") -- list the account id of each player being removed into an array
				ii = ii + 1
			until not(result:next())
			result:free()
		end
		numPlayersToDelete = ii - 1
 
		--Drop players and their child table attribute data such as skills, items, etc.
		for j = 1, numPlayersToDelete do
 
			if(config.cleanChildTables) then
				for k = 1, #childAttributeTables.players do
					if childAttributeTables.players[k].table == "houses" then
						house = getHouseByPlayerGUID(pid[j])
						if house ~= 0 or house ~= nil then
							doCleanHouse(house)
							doUpdateHouseAuctions()
						end
					else
						dropCount.players[k] = ((dropCount.players[k] or 0) + countRowsWhereInTable(childAttributeTables.players[k].table, childAttributeTables.players[k].idField, pid[j]))
						db.executeQuery("DELETE FROM " .. childAttributeTables.players[k].table .. " WHERE " .. childAttributeTables.players[k].idField .. " = '" .. pid[j] .. "';")
					end
				end
			else
				db.executeQuery("DELETE FROM `players` WHERE `id` = '" .. pid[j] .. "';")
			end
		end
    end
 
	--Drop all the accounts that have 0 players linked to them (at the moment its only checking from the list of players removed)
	if config.deleteAccountWithNoPlayers then
		--This part was scripted by Darkhaos, modified/fixed by Teh Maverick --[[
		local deny = false
		for acc = 1, #aid do
			result1 = db.getResult("SELECT `id` FROM `accounts` WHERE `id` = '" .. aid[acc] .. "';")
			if result1:getID() ~= -1 then -- check to make sure the account exists
				result1:free()
				for i = 1, #childAttributeTables.accounts do
					--Make sure there are no other players on the account
					result1 = db.getResult("SELECT COUNT(id) as count FROM `players` WHERE `account_id` = '" .. aid[acc] .. "';")
					tmp = result1:getDataInt("count")
					if(tmp <= 0) then
						if config.deleteAccountWithPremDays then
							local p_result = db.getResult("SELECT `premdays` from `accounts` where `id` = '" .. aid[acc] .. "';")
							if p_result:getID() ~= -1 then
								if p_result:getDataInt("premdays") > 0 then
									deny = true
								else
									deny = false
								end
							else
								deny = false
							end
						end
						if not deny then
							--Remove accounts
							dropCount.accounts[i] = ((dropCount.accounts[i] or 0) + countRowsWhereInTable(childAttributeTables.accounts[i].table, childAttributeTables.accounts[i].idField, aid[acc]))
							db.executeQuery("DELETE FROM " .. childAttributeTables.accounts[i].table .. " WHERE " .. childAttributeTables.accounts[i].idField .. " = '" .. aid[acc] .. "';")
						end
						deny = false
					end
				end
			end
		end
	end
	--]]
 
	--Print and Save results (configurable)
	local DB_NOW = {players = DB_BEFORE.players - getDBPlayersCount(), accounts = DB_BEFORE.accounts - getDBAccountsCount()}
	if DB_NOW.players > 0 or DB_NOW.accounts > 0 then
		local text = ">> [DBCLEANUP] " .. DB_NOW.players .. " inactive players" .. (config.deleteAccountWithNoPlayers and " and " .. DB_NOW.accounts .. " empty accounts" or "") .. " have been deleted from the database."
 
		--Write to console
		if config.printResult then
			print("")
			print(text)
			if config.cleanChildTables then
				--Write player info
				for i = 1,#dropCount.players do
					print("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1,#dropCount.accounts do
						print("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table")
					end
				end
				print("")
			end
		end
 
		--Write to file
		if config.saveResultToFile then
 
			local file = io.open("data/logs/"..config.logFileName, "a")
			file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. text .. "\n")
 
			if config.cleanChildTables then
				--Write player info
				for i = 1, #dropCount.players do
					file:write("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table\n")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1, #dropCount.accounts do
						file:write("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table\n")
					end
				end
				file:write("\n")
			end
			file:close()
		end
	end
	return true
end
 
Can you change premdays to vip_time? :D
Code:
------------------------------------------------------------------------------*
----- [[> Automated Database Cleanup 1.1 Structure //By Cybermaster <]] ------|
-------------- [[> System 2.0 Revamped by Teh Maverick <3 <]] ----------------|
------------- [[>  Removal of empty accounts by darkhaos :) <]] ---------------|
--------------- [[> Function getDBPlayersCount() by Elf <]] ------------------|
------------------------------------------------------------------------------|
------------------------------------------------------------------------------|
--- ~!READ THIS!~ ------------------------------------------------------------|
--- Be sure to back up your database and test this on your server first, -----|
--- I(Teh Maverick) cannot guarantee it will work the same for every core. ---|
--- It is very easy to test, with the log file and values that are printed ---|
-----------------------------------Enjoy!-------------------------------------|
------------------------------------------------------------------------------*
 
function countRowsWhereInTable(table, field, condition)
    local result = db.getResult("SELECT COUNT(" .. field .. ") as count FROM " .. table .. " WHERE " .. field .. " = '" .. condition .. "';")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBPlayersCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `players`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function getDBAccountsCount()
    local result = db.getResult("SELECT COUNT(id) as count FROM `accounts`;")
    local tmp = result:getDataInt("count")
    result:free()
    return tmp
end
 
function onStartup()
	local DB_BEFORE = {players = getDBPlayersCount(), accounts = getDBAccountsCount()}
	local result,result1, ii, numPlayersToDelete, numAccountsDeleted, tmp = 0, 0, 0, 0, 0
	local pid, aid = {}, {}
	local dropCount = {players={},accounts={}}
 
	local config = {
		deleteAccountWithNoPlayers = true,
		deleteAccountWithPremDays = true,
		cleanChildTables = true,
		printResult = true,
		saveResultToFile = true,
		logFileName = 'db_cleanup.txt'
	}
 
    --In each table, players with below specified level, and days of inactivity will be deleted from db on server startup
	local cleanup = {
		[1] = {level = 11, time = 5 * 24 * 60 * 60},
		[2] = {level = 20, time = 15 * 24 * 60 * 60},
		[3] = {level = 50, time = 30 * 24 * 60 * 60},
		[4] = {level = 100, time = 60 * 24 * 60 * 60},
		[5] = {level = 130, time = 90 * 24 * 60 * 60}
	}
 
	local childAttributeTables = {
		players = {
			[1] = {table = "`player_viplist`", idField = "`player_id`"},
			[2] = {table = "`player_storage`", idField = "`player_id`"},
			[3] = {table = "`player_spells`", idField = "`player_id`"},
			[4] = {table = "`player_skills`", idField = "`player_id`"},
			[5] = {table = "`player_namelocks`", idField = "`player_id`"},
			[6] = {table = "`player_items`", idField = "`player_id`"},
			[7] = {table = "`player_depotitems`", idField = "`player_id`"},
			[8] = {table = "`houses`", idField = "`owner`"},
			[9] = {table = "`house_auctions`", idField = "`player_id`"},
			[10] = {table = "`players`", idField = "`id`"} -- Keep this as the last item in the array
			--Note: `houses` and `bans` are in the DB triggers for TFS so don't worry about them.
			--Also I did not want to put killers, or deaths on here because that is historic data,
			--do so at your own risk.
		},
		accounts = {
			[1] = {table = "`accounts`", idField = "`id`"},
			[2] = {table = "`account_viplist`", idField = "`account_id`"}
		}
	}
 
	--Clean up all the players and player data
	for i = 1, #cleanup do
		result = db.getResult("SELECT `id`,`name`,`account_id` FROM `players` WHERE `level` < ".. cleanup[i].level .." AND `name` NOT IN('Account Manager', 'Sorcerer Sample', 'Druid Sample', 'Paladin Sample', 'Knight Sample', 'Rook Sample') AND `group_id` < 2 AND `lastlogin` < UNIX_TIMESTAMP() - ".. cleanup[i].time ..";")
		if(result:getID() ~= -1) then
			ii = 1
			repeat
				pid[ii] = result:getDataInt("id") -- list the players id into an array
				aid[ii] = result:getDataInt("account_id") -- list the account id of each player being removed into an array
				ii = ii + 1
			until not(result:next())
			result:free()
		end
		numPlayersToDelete = ii - 1
 
		--Drop players and their child table attribute data such as skills, items, etc.
		for j = 1, numPlayersToDelete do
 
			if(config.cleanChildTables) then
				for k = 1, #childAttributeTables.players do
					if childAttributeTables.players[k].table == "houses" then
						house = getHouseByPlayerGUID(pid[j])
						if house ~= 0 or house ~= nil then
							doCleanHouse(house)
							doUpdateHouseAuctions()
						end
					else
						dropCount.players[k] = ((dropCount.players[k] or 0) + countRowsWhereInTable(childAttributeTables.players[k].table, childAttributeTables.players[k].idField, pid[j]))
						db.executeQuery("DELETE FROM " .. childAttributeTables.players[k].table .. " WHERE " .. childAttributeTables.players[k].idField .. " = '" .. pid[j] .. "';")
					end
				end
			else
				db.executeQuery("DELETE FROM `players` WHERE `id` = '" .. pid[j] .. "';")
			end
		end
    end
 
	--Drop all the accounts that have 0 players linked to them (at the moment its only checking from the list of players removed)
	if config.deleteAccountWithNoPlayers then
		--This part was scripted by Darkhaos, modified/fixed by Teh Maverick --[[
		local deny = false
		for acc = 1, #aid do
			result1 = db.getResult("SELECT `id` FROM `accounts` WHERE `id` = '" .. aid[acc] .. "';")
			if result1:getID() ~= -1 then -- check to make sure the account exists
				result1:free()
				for i = 1, #childAttributeTables.accounts do
					--Make sure there are no other players on the account
					result1 = db.getResult("SELECT COUNT(id) as count FROM `players` WHERE `account_id` = '" .. aid[acc] .. "';")
					tmp = result1:getDataInt("count")
					if(tmp <= 0) then
						if config.deleteAccountWithPremDays then
							local p_result = db.getResult("SELECT `vip_time` from `accounts` where `id` = '" .. aid[acc] .. "';")
							if p_result:getID() ~= -1 then
								if p_result:getDataInt("vip_time") > 0 then
									deny = true
								else
									deny = false
								end
							else
								deny = false
							end
						end
						if not deny then
							--Remove accounts
							dropCount.accounts[i] = ((dropCount.accounts[i] or 0) + countRowsWhereInTable(childAttributeTables.accounts[i].table, childAttributeTables.accounts[i].idField, aid[acc]))
							db.executeQuery("DELETE FROM " .. childAttributeTables.accounts[i].table .. " WHERE " .. childAttributeTables.accounts[i].idField .. " = '" .. aid[acc] .. "';")
						end
						deny = false
					end
				end
			end
		end
	end
	--]]
 
	--Print and Save results (configurable)
	local DB_NOW = {players = DB_BEFORE.players - getDBPlayersCount(), accounts = DB_BEFORE.accounts - getDBAccountsCount()}
	if DB_NOW.players > 0 or DB_NOW.accounts > 0 then
		local text = ">> [DBCLEANUP] " .. DB_NOW.players .. " inactive players" .. (config.deleteAccountWithNoPlayers and " and " .. DB_NOW.accounts .. " empty accounts" or "") .. " have been deleted from the database."
 
		--Write to console
		if config.printResult then
			print("")
			print(text)
			if config.cleanChildTables then
				--Write player info
				for i = 1,#dropCount.players do
					print("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1,#dropCount.accounts do
						print("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table")
					end
				end
				print("")
			end
		end
 
		--Write to file
		if config.saveResultToFile then
 
			local file = io.open("data/logs/"..config.logFileName, "a")
			file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. text .. "\n")
 
			if config.cleanChildTables then
				--Write player info
				for i = 1, #dropCount.players do
					file:write("[!] --> Dropped: " .. dropCount.players[i] .. " from " .. childAttributeTables.players[i].table .. " table\n")
				end
				--Write account info
				if config.deleteAccountWithNoPlayers then
					for i = 1, #dropCount.accounts do
						file:write("[!] --> Dropped: " .. dropCount.accounts[i] .. " from " .. childAttributeTables.accounts[i].table .. " table\n")
					end
				end
				file:write("\n")
			end
			file:close()
		end
	end
	return true
end
 
[27 May 2011 07:35:12 ] >> [DBCLEANUP] 1909 inactive players have been deleted from database.
[27 May 2011 07:46:11 ] >> [DBCLEANUP] 2 inactive players have been deleted from database.
[28 May 2011 07:01:57 ] >> [DBCLEANUP] 302 inactive players have been deleted from database.
[29 May 2011 07:01:56 ] >> [DBCLEANUP] 322 inactive players have been deleted from database.
[30 May 2011 07:02:00 ] >> [DBCLEANUP] 344 inactive players have been deleted from database.
[30 May 2011 17:57:02 ] >> [DBCLEANUP] 70 inactive players have been deleted from database.
[31 May 2011 07:02:00 ] >> [DBCLEANUP] 166 inactive players have been deleted from database.
[01 June 2011 07:02:00 ] >> [DBCLEANUP] 196 inactive players have been deleted from database.
[02 June 2011 07:02:01 ] >> [DBCLEANUP] 209 inactive players have been deleted from database.
[03 June 2011 07:52:33 ] >> [DBCLEANUP] 322 inactive players have been deleted from database.
[03 June 2011 21:09:54 ] >> [DBCLEANUP] 230 inactive players have been deleted from database.
[04 June 2011 07:02:02 ] >> [DBCLEANUP] 88 inactive players have been deleted from database.
[05 June 2011 07:02:00 ] >> [DBCLEANUP] 241 inactive players have been deleted from database.
[06 June 2011 07:02:01 ] >> [DBCLEANUP] 278 inactive players have been deleted from database.
[07 June 2011 07:02:02 ] >> [DBCLEANUP] 124 inactive players have been deleted from database.
[08 June 2011 07:02:11 ] >> [DBCLEANUP] 131 inactive players have been deleted from database.
[09 June 2011 07:02:03 ] >> [DBCLEANUP] 141 inactive players have been deleted from database.
[10 June 2011 07:02:03 ] >> [DBCLEANUP] 115 inactive players have been deleted from database.
[11 June 2011 07:02:11 ] >> [DBCLEANUP] 157 inactive players have been deleted from database.
[12 June 2011 07:02:03 ] >> [DBCLEANUP] 205 inactive players have been deleted from database.
[13 June 2011 07:02:06 ] >> [DBCLEANUP] 151 inactive players have been deleted from database.
[14 June 2011 07:02:06 ] >> [DBCLEANUP] 101 inactive players have been deleted from database.
[15 June 2011 07:02:05 ] >> [DBCLEANUP] 114 inactive players have been deleted from database.
[16 June 2011 07:02:06 ] >> [DBCLEANUP] 114 inactive players have been deleted from database.
[17 June 2011 07:02:07 ] >> [DBCLEANUP] 125 inactive players have been deleted from database.
[18 June 2011 07:02:08 ] >> [DBCLEANUP] 112 inactive players have been deleted from database.
[19 June 2011 07:02:06 ] >> [DBCLEANUP] 164 inactive players have been deleted from database.
[20 June 2011 07:02:09 ] >> [DBCLEANUP] 145 inactive players have been deleted from database.
[21 June 2011 07:02:06 ] >> [DBCLEANUP] 118 inactive players have been deleted from database.
[22 June 2011 07:02:07 ] >> [DBCLEANUP] 113 inactive players have been deleted from database.
[23 June 2011 07:02:10 ] >> [DBCLEANUP] 108 inactive players have been deleted from database.
[24 June 2011 07:02:11 ] >> [DBCLEANUP] 132 inactive players have been deleted from database.
[25 June 2011 07:02:10 ] >> [DBCLEANUP] 134 inactive players have been deleted from database.
[26 June 2011 07:03:57 ] >> [DBCLEANUP] 160 inactive players have been deleted from database.
[26 June 2011 16:40:36 ] >> [DBCLEANUP] 54 inactive players have been deleted from database.
[27 June 2011 07:02:11 ] >> [DBCLEANUP] 92 inactive players have been deleted from database.
[28 June 2011 07:02:11 ] >> [DBCLEANUP] 117 inactive players have been deleted from database.
[29 June 2011 07:02:13 ] >> [DBCLEANUP] 135 inactive players have been deleted from database.
[29 June 2011 21:12:43 ] >> [DBCLEANUP] 69 inactive players have been deleted from database.
[30 June 2011 07:02:10 ] >> [DBCLEANUP] 47 inactive players have been deleted from database.
[01 July 2011 07:02:12 ] >> [DBCLEANUP] 119 inactive players have been deleted from database.
[02 July 2011 07:02:09 ] >> [DBCLEANUP] 137 inactive players have been deleted from database.
[02 July 2011 20:29:58 ] >> [DBCLEANUP] 98 inactive players have been deleted from database.
[02 July 2011 20:38:59 ] >> [DBCLEANUP] 1 inactive players have been deleted from database.
[02 July 2011 23:19:47 ] >> [DBCLEANUP] 26 inactive players have been deleted from database.

I love this xD
 
Is that even this script? lool looks like Cyber Masters old one.
hahahaha xD yours must be
Code:
[24 May 2011 05:52:38 ] >> [DBCLEANUP] 1866 inactive players and 587 empty accounts have been deleted from the database.
[!] --> Dropped: 305 from `player_viplist` table
[!] --> Dropped: 13911 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 13062 from `player_skills` table
[!] --> Dropped: 1 from `player_namelocks` table
[!] --> Dropped: 23021 from `player_items` table
[!] --> Dropped: 939 from `player_depotitems` table
[!] --> Dropped: 2 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1866 from `players` table
[!] --> Dropped: 587 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[25 May 2011 02:23:17 ] >> [DBCLEANUP] 72 inactive players and 16 empty accounts have been deleted from the database.
[!] --> Dropped: 13 from `player_viplist` table
[!] --> Dropped: 589 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 504 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 1070 from `player_items` table
[!] --> Dropped: 39 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 72 from `players` table
[!] --> Dropped: 16 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[31 May 2011 05:50:21 ] >> [DBCLEANUP] 315 inactive players and 97 empty accounts have been deleted from the database.
[!] --> Dropped: 160 from `player_viplist` table
[!] --> Dropped: 5614 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 2205 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 3603 from `player_items` table
[!] --> Dropped: 482 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 315 from `players` table
[!] --> Dropped: 97 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[03 June 2011 06:28:19 ] >> [DBCLEANUP] 186 inactive players and 68 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 3280 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1302 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 1708 from `player_items` table
[!] --> Dropped: 471 from `player_depotitems` table
[!] --> Dropped: 1 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 186 from `players` table
[!] --> Dropped: 68 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[03 June 2011 06:40:28 ] >> [DBCLEANUP] 1 inactive players and 0 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 0 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 0 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table

[03 June 2011 06:44:39 ] >> [DBCLEANUP] 1 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 0 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 0 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 03:51:39 ] >> [DBCLEANUP] 80 inactive players and 29 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 1123 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 560 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 780 from `player_items` table
[!] --> Dropped: 138 from `player_depotitems` table
[!] --> Dropped: 2 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 80 from `players` table
[!] --> Dropped: 29 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 03:55:28 ] >> [DBCLEANUP] 2 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 0 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 14 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 0 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 2 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 04:35:41 ] >> [DBCLEANUP] 79 inactive players and 30 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 1160 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 553 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 800 from `player_items` table
[!] --> Dropped: 138 from `player_depotitems` table
[!] --> Dropped: 2 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 79 from `players` table
[!] --> Dropped: 30 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 08:17:34 ] >> [DBCLEANUP] 82 inactive players and 31 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 1230 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 574 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 835 from `player_items` table
[!] --> Dropped: 143 from `player_depotitems` table
[!] --> Dropped: 3 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 82 from `players` table
[!] --> Dropped: 31 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 08:18:15 ] >> [DBCLEANUP] 1 inactive players and 0 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 34 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 11 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table

[04 June 2011 08:42:37 ] >> [DBCLEANUP] 1 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 34 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 8 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 12:16:51 ] >> [DBCLEANUP] 4 inactive players and 3 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 11 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 28 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 34 from `player_items` table
[!] --> Dropped: 17 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 4 from `players` table
[!] --> Dropped: 3 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 12:53:40 ] >> [DBCLEANUP] 261 inactive players and 94 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 4627 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1827 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 2631 from `player_items` table
[!] --> Dropped: 640 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 261 from `players` table
[!] --> Dropped: 94 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 12:58:42 ] >> [DBCLEANUP] 261 inactive players and 94 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 4627 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1827 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 2631 from `player_items` table
[!] --> Dropped: 640 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 261 from `players` table
[!] --> Dropped: 94 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 13:03:28 ] >> [DBCLEANUP] 261 inactive players and 94 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 4627 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1827 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 2631 from `player_items` table
[!] --> Dropped: 640 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 261 from `players` table
[!] --> Dropped: 94 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 13:06:38 ] >> [DBCLEANUP] 261 inactive players and 94 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 4627 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1827 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 2631 from `player_items` table
[!] --> Dropped: 640 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 261 from `players` table
[!] --> Dropped: 94 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 13:11:54 ] >> [DBCLEANUP] 90 inactive players and 35 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 1347 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 630 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 923 from `player_items` table
[!] --> Dropped: 169 from `player_depotitems` table
[!] --> Dropped: 3 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 90 from `players` table
[!] --> Dropped: 35 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[04 June 2011 13:15:25 ] >> [DBCLEANUP] 261 inactive players and 94 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 4627 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 1827 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 2631 from `player_items` table
[!] --> Dropped: 640 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 261 from `players` table
[!] --> Dropped: 94 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[18 June 2011 01:38:03 ] >> [DBCLEANUP] 856 inactive players and 307 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 16279 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 5992 from `player_skills` table
[!] --> Dropped: 1 from `player_namelocks` table
[!] --> Dropped: 8723 from `player_items` table
[!] --> Dropped: 2229 from `player_depotitems` table
[!] --> Dropped: 10 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 856 from `players` table
[!] --> Dropped: 307 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[24 June 2011 03:22:41 ] >> [DBCLEANUP] 375 inactive players and 132 empty accounts have been deleted from the database.
[!] --> Dropped: 14 from `player_viplist` table
[!] --> Dropped: 7889 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 2625 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 4163 from `player_items` table
[!] --> Dropped: 1199 from `player_depotitems` table
[!] --> Dropped: 4 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 375 from `players` table
[!] --> Dropped: 132 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 12:52:31 ] >> [DBCLEANUP] 517 inactive players and 152 empty accounts have been deleted from the database.
[!] --> Dropped: 43 from `player_viplist` table
[!] --> Dropped: 10643 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 3619 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 5553 from `player_items` table
[!] --> Dropped: 1871 from `player_depotitems` table
[!] --> Dropped: 3 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 517 from `players` table
[!] --> Dropped: 152 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 16:10:03 ] >> [DBCLEANUP] 6 inactive players and 3 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 206 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 42 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 68 from `player_items` table
[!] --> Dropped: 13 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 6 from `players` table
[!] --> Dropped: 3 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 16:35:38 ] >> [DBCLEANUP] 2 inactive players and 0 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 0 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 14 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 0 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 2 from `players` table

[02 July 2011 16:40:13 ] >> [DBCLEANUP] 1 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 35 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 12 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 16:42:17 ] >> [DBCLEANUP] 1 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 0 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 0 from `player_items` table
[!] --> Dropped: 0 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 17:01:31 ] >> [DBCLEANUP] 1 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 36 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 7 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 6 from `player_items` table
[!] --> Dropped: 4 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 1 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 17:57:46 ] >> [DBCLEANUP] 6 inactive players and 3 empty accounts have been deleted from the database.
[!] --> Dropped: 0 from `player_viplist` table
[!] --> Dropped: 2 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 42 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 5 from `player_items` table
[!] --> Dropped: 3 from `player_depotitems` table
[!] --> Dropped: 0 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 6 from `players` table
[!] --> Dropped: 3 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 19:17:09 ] >> [DBCLEANUP] 11 inactive players and 6 empty accounts have been deleted from the database.
[!] --> Dropped: 1 from `player_viplist` table
[!] --> Dropped: 35 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 63 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 8 from `player_items` table
[!] --> Dropped: 4 from `player_depotitems` table
[!] --> Dropped: 1 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 11 from `players` table
[!] --> Dropped: 6 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table

[02 July 2011 20:01:15 ] >> [DBCLEANUP] 6 inactive players and 1 empty accounts have been deleted from the database.
[!] --> Dropped: 1 from `player_viplist` table
[!] --> Dropped: 138 from `player_storage` table
[!] --> Dropped: 0 from `player_spells` table
[!] --> Dropped: 42 from `player_skills` table
[!] --> Dropped: 0 from `player_namelocks` table
[!] --> Dropped: 27 from `player_items` table
[!] --> Dropped: 6 from `player_depotitems` table
[!] --> Dropped: 1 from `houses` table
[!] --> Dropped: 0 from `house_auctions` table
[!] --> Dropped: 6 from `players` table
[!] --> Dropped: 1 from `accounts` table
[!] --> Dropped: 0 from `account_viplist` table
 
by me it just stack when starting up the server

PHP:
[14:38:49.841] >> Initializing game state and binding services...
 
Hi,

I am using rev 3858, and it doesnt work on my server.

I am using an linux ubuntu 10.04 for it!
Does anyone have clue what the problem is?
cuz I rly need to delete inactieve people
 
by me it just stack when starting up the server

PHP:
[14:38:49.841] >> Initializing game state and binding services...

What distro of tfs are you using?

Hi,

I am using rev 3858, and it doesnt work on my server.

I am using an linux ubuntu 10.04 for it!
Does anyone have clue what the problem is?
cuz I rly need to delete inactieve people

What doesn't work for you? Are there errors? or what... I have been using on 0.4 for months now with no issue.
 
Hello Teh Maverick,

I sended u an private message with the problem, please check ur inbox I also gaved mine email to u.
I hope u can help me out
 
@up
error fixed [priv msg]

Cleanup database, fast:
1. Shutdown server.
2. Execute in phpmyadmin (change days offline and level) - remove inactive players:
PHP:
DELETE FROM `players` WHERE `lastlogin` < (UNIX_TIMESTAMP() - (3 * 24 * 3600)) AND `level` < 20 AND `account_id` != 1;
DELETE FROM `players` WHERE `lastlogin` < (UNIX_TIMESTAMP() - (5 * 24 * 3600)) AND `level` < 70 AND `account_id` != 1;
DELETE FROM `players` WHERE `lastlogin` < (UNIX_TIMESTAMP() - (7 * 24 * 3600)) AND `level` < 100 AND `account_id` != 1;
DELETE FROM `players` WHERE `lastlogin` < (UNIX_TIMESTAMP() - (14 * 24 * 3600)) AND `level` < 200 AND `account_id` != 1
DELETE FROM `players` WHERE `lastlogin` < (UNIX_TIMESTAMP() - (24 * 24 * 3600)) AND `account_id` != 1
< 20 lvl, 3 days
< 70 lvl, 5 days
...
offline > 24 days, delete, doesn't check level

Before you ask, it will delete items, skills, storage etc.

3. Execute in phpmyadmin - remove players with 0 players on it and 0 premium points:
PHP:
DELETE `accounts` FROM `accounts` LEFT JOIN `players` ON `accounts`.`id`=`players`.`account_id` WHERE `players`.`account_id` IS NULL AND `accounts`.`premium_points` = 0

4. Start server, it will remove players (deleted) from houses.
 
Back
Top