• 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!

Got one problem players items disappear when logout [FAST PLEASE]

Krutus

Mapper/Scripter
Joined
Oct 31, 2011
Messages
22
Reaction score
1
Location
Stockholm
I have start a new server named velzia.tk now i got a problem as need to be fixed fast. What is the problem if players disappear items when they logout?


I have set save = 1 at players in database

I have chmod the otserver folder to 777

I have look so everything in talkactions are ok!

Globalevents

PHP:
<globalevent name="save" interval="3600000" event="script" value="save.lua"/>

This is the save.lua script

PHP:
local config = {
	broadcast = {120, 30},
	shallow = "no",
	delay = 120,
	events = 30,
	
	days = 14,
	houseInterval = 7200, --2 hrs
	log = true,
	file = getDataDir() .. "/logs/cleanhouses.txt",
	onlyNonPremium = false
}

config.shallow = getBooleanFromString(config.shallow)

local lastClean = 0;

local function cleanHouses()

	if(lastClean > os.time())then
		return;
	end
	
	local ns_query = "SELECT houses.owner, houses.id as hid, houses.name as house_name ,players.name FROM houses LEFT JOIN players ON players.id=houses.owner LEFT JOIN accounts ON players.account_id=accounts.id WHERE players.lastlogin < (UNIX_TIMESTAMP() - " ..config.days.. "*24*60*60) " ..(config.onlyNonPremium and ' AND accounts.premdays=0 ' or '');
	local house = db.getResult(ns_query)
	local logs = " :: Houses cleaned:\n\n"
	if house:getID() ~= -1 then
		repeat
			logs = logs .. house:getDataString('house_name') ..", owned by " .. house:getDataString('name') .. "\n"
			setHouseOwner(house:getDataInt('hid'), 0)
		until not house:next()
		house:free()
	else
		logs = logs .. "There were no houses to clean."
	end
	if config.log then
		doWriteLogFile(config.file, logs)
	end
	lastClean = os.time();
end

local function executeSave(seconds)
	if(isInArray(config.broadcast, seconds)) then
		local text = ""
		if(not config.shallow) then
			text = "Full s"
		else
			text = "S"
		end

		text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
		doBroadcastMessage(text)
	end

	if(seconds > 0) then
		addEvent(executeSave, config.events * 1000, seconds - config.events)
	else
		doSaveServer(config.shallow)
	end
end

function onThink(interval)
	cleanHouses();
	if(table.maxn(config.broadcast) == 0) then
		doSaveServer(config.shallow)
	else
		executeSave(config.delay)
	end

	return true
end
 
Last edited:
Umm I am not an expert but here is something you can try. Go to config.lua and make sure you have your sqltype=mysql and not sqllite. I am not even sure if that will fix it. I'm thinking that it isn't saving the info in the database so when players log back in, the items are gone. That is the only issue i can think of that might be happening. Also, is your consol giving you any errors when players log out?
 
Umm I am not an expert but here is something you can try. Go to config.lua and make sure you have your sqltype=mysql and not sqllite. I am not even sure if that will fix it. I'm thinking that it isn't saving the info in the database so when players log back in, the items are gone. That is the only issue i can think of that might be happening. Also, is your consol giving you any errors when players log out?

Already tried that and console dont give errors :/

But what this means?

PHP:
theforgottenserver: /usr/include/boost/thread/pthread/condition_variable_fwd.hpp:38: boost::condition_variable::~condition_variable(): Assertion `!pthread_cond_destroy(&cond)' failed.
Aborted
 
:s can see my character list but when i click on some char it says , servgame is down for the moment please try agian later

hope it will get fixed soon want to play ^_^
 
Back
Top