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
This is the save.lua script
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: