X-Log before Server Save
This script will close the client at a random period before the server save.
It will only X-log when no creatures are no screen.
lua code:
-- Xlog at server save
--Version 1.0
--[[ Made by
___ .__ __. ______ ____ ____ .__ __.
/ \ | \ | | / __ \ \ \ / / | \ | |
/ ^ \ | \| | | | | | \ \/ / | \| |
/ /_\ \ | . ` | | | | | \_ _/ | . ` |
/ _____ \ | |\ | | `--' | | | | |\ |
/__/ \__\ |__| \__| \______/ |__| |__| \__|
]]
-----CONFIG------
--the hour before the server save (server save is at 3 AM for my computer)
local sshour = "02"
-- the script will logout sometime between the two times
local ssEarlyLogout = 10
local ssLateLogout = 40
-----SCRIPT------
local ssmin = tostring(math.random(ssEarlyLogout,ssLateLogout))
Module.New('xLogSS', function(xLogSS)
if ((os.date("%H") == sshour) and (os.date("%M") >= ssmin)) then
--Check to see if there are creatures on screen
PlayersOnScreen = Self.GetSpectators()
creatureOnScreen = false
for i = 1, #PlayersOnScreen do
if not PlayersOnScreen[i]:isPlayer() then
creatureOnScreen = true
break
end
end
--If there are no creatures on screen
if not creatureOnScreen then
os.exit()
end
end
xLogSS:Delay(10000)
end)