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

Close + Shutdown

xLosT

Member
Joined
Jan 11, 2010
Messages
1,022
Reaction score
13
Location
Brasil, Rio Grande do Sul
I need a script that messages the server 10 minutes before executing it and when it does, it closes the server then after 5 minutes, shutdown the server.
 
Bit messy but ive already tested it and it works, so enjoy:

globalevents/globalevents.xml
XML:
<globalevent name="shutdown" time="16:06" event="script" value="shutdown.lua"/>
globalevents/scripts create new lua and name it "shutdown":
Lua:
local cyko = {
    final_shutdown = 300 --5min until the server gets shutdown
}

function ShutDown()
    doSetGameState(GAMESTATE_SHUTDOWN)
    return TRUE
end

function ServerClose1()
	doSetGameState(GAMESTATE_CLOSED)
	addEvent(ShutDown, cyko.final_shutdown*1000)
	return TRUE
end

function Save()
	doSaveServer()
	doBroadcastMessage("Server save, please be patient.")
	addEvent(ServerClose1, 5*1000)
	return TRUE
end

function ServerClose2()
	doBroadcastMessage("Server will go down in 1 minute, please go to a safe zone.")
	addEvent(Save, 60*1000)
	return TRUE
end

function ServerClose3()
	doBroadcastMessage("Server will go down in 2 minutes, please go to a safe zone.")
	addEvent(ServerClose2, 60*1000)
	return TRUE
end

function ServerClose4()
	doBroadcastMessage("Server will go down in 3 minutes, please go to a safe zone.")
	addEvent(ServerClose3, 60*1000)
	return TRUE
end

function ServerClose5()
	doBroadcastMessage("Server will go down in 4 minutes, please go to a safe zone.")
	addEvent(ServerClose4, 60*1000)
	return TRUE
end

function ServerClose6()
	doBroadcastMessage("Server will go down in 5 minutes, please go to a safe zone.")
	addEvent(ServerClose5, 60*1000)
	return TRUE
end

function ServerClose7()
	doBroadcastMessage("Server will go down in 6 minutes, please go to a safe zone.")
	addEvent(ServerClose6, 60*1000)
	return TRUE
end

function ServerClose8()
	doBroadcastMessage("Server will go down in 7 minutes, please go to a safe zone.")
	addEvent(ServerClose7, 60*1000)
	return TRUE
end

function ServerClose9()
	doBroadcastMessage("Server will go down in 8 minutes, please go to a safe zone.")
	addEvent(ServerClose8, 60*1000)
	return TRUE
end

function ServerClose10()
	doBroadcastMessage("Server will go down in 9 minutes, please go to a safe zone.")
	addEvent(ServerClose9, 60*1000)
	return TRUE
end
 
function onTime(interval)
	doBroadcastMessage("Server will go down in 10 minutes, please go to a safe zone.")
	addEvent(ServerClose10, 60*1000)
	return true
end
 
<globalevent name="shutdown" time="16:06" event="script" value="shutdown.lua"/>

Change the time="16:06" to the time you want it to shut down... for example if you want it to shutdown before midnight put time="23:50"
 
Back
Top