Auto Night Mode for Bombsquad Servers

So Hello Everyone, In this post i will be showing you how you can set auto night mode for your bombsquad servers...


It is used to automatically change the tint of maps to a desired tint between a certain time...It is generally used to setup auto night modes in servers...


Follow These Steps to Setup Auto Night Mode : 


1. First Install Pip by typing:
          
         sudo apt-get install python-pip



2. Now Install Pytz Lib to get current time by TimeZone:

         pip install pytz



3. Now Open bsGame.py and import these two modules:



        import datetime
        import pytz


    Now your Starting should look like this:



4. Now search for           def getMap(self):
   and replace :



  def getMap(self):
        """
        Returns the bs.Map in use for this activity.
        """
        if self._map is None:
            raise Exception(
                "getMap() cannot be called until after onTransitionIn()")
        return self._map



   by this : 


   def getMap(self):
        """
        Returns the bs.Map in use for this activity.
        """
        if self._map is None:
            raise Exception(
                "getMap() cannot be called until after onTransitionIn()")
        now=datetime.datetime.now(pytz.timezone('Asia/Calcutta')).time()
        nightstart=now.replace(hour=14,minute=00)
        nightend=now.replace(hour=6)    
        if(now>nightstart or now<nightend):
             bs.getSharedObject('globals').tint = (0.5,0.7,1)
        return self._map


It should look like this :


Change your timezone as shown in image above..
And change the time to turn on and off the night mode automatically as shown in image...

nightstart : Start Time of Night Mode (According to 24 Hours Clock)

nightend : End Time of Night Mode (According to 24 Hours Clock)



Support me by clicking on some of the ads


 # For More Help Contact Me:

 # Discord Server : https://discord.gg/bzvqSyV
 # YouTube : https://youtube.com/mrstreamer
 # GitHub : https://github.com/FireHead90544

Comments

Popular posts