Jump to content

Recommended Posts

Posted

hi hommies,with this script as u can see at the title u can make auto restart/shutdown the server

so lets begin:

 

works for l2j and others just change the imports:

 

in the quests folder create a new one called 4098_shutdown

 

 

add the 4098_shutdown to the scripts.cfg file in the data folder

 

 

 

#Created by Newface*

#Date 21-June-2009

#L2J Server Restart/Shutdown Script

#

#Time will be in 24 hour format and must be 4 digits for example 6am is 06:00 and 6pm is 18:00

#

#Days are as follows 00=Sunday 01=Monday 02=Tuesday 03=Wednesday 04=Thursday 05=Friday 06=Saturday

#

#If more restarts/shutdowns are required add more elif statements

#

#If less are required then remove elif statements

#

import sys

import time

from net.sf.l2j.gameserver import Announcements

from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

from net.sf.l2j.gameserver import Shutdown

from net.sf.l2j.gameserver.taskmanager.tasks import TaskShutdown

from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance

from net.sf.l2j.gameserver.model import L2World

from net.sf.l2j.gameserver.script import DateRange

 

class Quest (JQuest) :

 

def __init__(self,id,name,descr):

    JQuest.__init__(self,id,name,descr)

    self.startQuestTimer("timer199",60000,None,None,True)

 

def onAdvEvent(self,event,npc,player) :

   if event == "timer199" :

       day = time.strftime("%w")

       now = time.strftime("%H:%M")

       if day == "01" and now == "23:00" :

           print "Shutdown Initiated"

           Shutdown.getInstance().startTelnetShutdown("Script Triggered Restart/Shutdown",60,0) #change the 60 to your required countdown in seconds and change the 0 to a 1 for restart instead of a shutdown

       elif day == "04" and now == "19:00" :

           print "Shutdown Initiated"

           Shutdown.getInstance().startTelnetShutdown("Script Triggered Restart/Shutdown",60,0) #change the 60 to your required countdown in seconds and change the 0 to a 1 for restart instead of a shutdown

       elif day == "06" and now == "03:00" :

           print "Shutdown Initiated"

           Shutdown.getInstance().startTelnetShutdown("Script Triggered Restart/Shutdown",60,0) #change the 60 to your required countdown in seconds and change the 0 to a 1 for restart instead of a shutdown

 

 

QUEST     = Quest(4098,"4098_shutdown","shutdown")

 

print "Shutdown: Handler Loaded!"

 

credits:Newface*

 

if u find any errors post here thanks

 

Posted

Nice share , but I think better way is create .sql file with auto restarting serwer , someone share it already .

 

Anyway its as good as .sql file

Posted

yeah also u can do it with this:D,but this is for restart

INSERT INTO global_tasks(task,type,last_activation,param1,param2,param3) VALUES

('restart', 'TYPE_GLOBAL_TASK', '2147483647', '1', '00:00:00', '300'); -- At 00:00 in the night he will do a server restart players will have 5 minutes to logout

 

INSERT INTO global_tasks(task,type,last_activation,param1,param2,param3) VALUES

('restart', 'TYPE_GLOBAL_TASK', '2147483647', '1', '12:00:00', '300');-- At 12:00 in the midday he will do a server restart players will have 5 minutes to logout

 

 

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...