local config = {
broadcast = {120, 30},
shallow = "no",
delay = 120,
events = 30
}
config.shallow = getbooleanfromstring(config.shallow)
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)
if(table.maxn(config.broadcast) == 0) then
dosaveserver(config.shallow)
else
executesave(config.delay)
end
return true
end