Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. MW3 Modding Support & Discussion
  3. [GSC] to shutdown server after match

[GSC] to shutdown server after match

Scheduled Pinned Locked Moved MW3 Modding Support & Discussion
9 Posts 5 Posters 166 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hikinataundefined Offline
    hikinataundefined Offline
    hikinata
    wrote on last edited by
    #1

    Good morning,
    It's me again!

    I continue to make modifications for my tournament on mw3.. and I would like to have a script that shuts down the server at the end of the match.

    In fact I have several servers to launch so I would like it to shut down properly.

    I tried two scripts without success

    init()
    {
        level thread shutdownServerOnEnd();
    }
    
    shutdownServerOnEnd()
    {
        while(1)
        {
            wait 1;
    
            if (level.gameEnded) // Détection de la fin du match
            {
                iprintln("^1Match terminé ! Fermeture du serveur...");
                wait 10; // Temps d'affichage avant la fermeture (ajustable)
                sys.exit(); // Forcer l'arrêt du serveur dédié
            }
        }
    }
    
    

    or

    init()
    {
        level thread shutdownServerOnEnd();
    }
    
    shutdownServerOnEnd()
    {
        while(1)
        {
            wait 1;
    
            if (level.gameEnded) // Détection de la fin du match
            {
                iprintln("^1Match terminé ! Fermeture du serveur...");
                wait 10;
                thread shutdownServer();
            }
        }
    }
    
    shutdownServer()
    {
        wait 1;
        iprintln("^1Arrêt du serveur...");
        wait 2;
        setDvar("sv_mapRotation", ""); // Annule la rotation des maps pour éviter un restart
        wait 1;
        self [[level.exec]]("quit"); // Ferme proprement le serveur
    }
    
    
    1 Reply Last reply
    0
    • Xerxesundefined Offline
      Xerxesundefined Offline
      Xerxes Plutonium Staff
      wrote on last edited by
      #2

      Don't use chatGPT to write your code.

      1 Reply Last reply
      0
      • Decundefined Offline
        Decundefined Offline
        Dec Contributor
        wrote on last edited by Dec
        #3

        Never tried this approach but the t6 utils has a couple things you could do

        Debugging
        crash(): Crashes the server.
        breakpoint(message): Pauses the server's execution and shows a message box with the passed message and call stack.
        assert(condition): Throws an error if condition is false.

        then again ive never tried these but you could try them see if itll be something youd need

        the base files could also have something to do what you need i just dont know of any function to do this other than from t6 utils!

        1 Reply Last reply
        1
        • Resxtundefined Offline
          Resxtundefined Offline
          Resxt Plutonium Staff
          wrote on last edited by
          #4

          Writing something in batch or powershell would probably be the solution. Is there not a better solution than closing an entire server tho? Load a different cfg and mode or something?

          I highly doubt this can be done in GSC and you won't get anywhere using AI

          Xerxesundefined 1 Reply Last reply
          0
          • Xerxesundefined Offline
            Xerxesundefined Offline
            Xerxes Plutonium Staff
            replied to Resxt on last edited by
            #5

            Resxt said in [GSC] to shutdown server after match:

            I highly doubt this can be done in GSC

            quit is a command and cmdexec exists.

            hikinataundefined 1 Reply Last reply
            2
            • hikinataundefined Offline
              hikinataundefined Offline
              hikinata
              replied to Xerxes on last edited by
              #6

              Xerxes ❤ Perfect !

              init()
              {
                  level thread monitorMatchEnd();
              }
              
              monitorMatchEnd()
              {
                  while(1)
                  {
                      wait 1;
              
                      if (level.gameEnded) // Détection de la fin du match
                      {
                          iprintln("^1Match terminé ! Fermeture du serveur dans 5 secondes...");
                          wait 5;
              			
                          cmdexec("quit"); // Ferme proprement le serveur
                      }
                  }
              }
              
              
              1 Reply Last reply
              1
              • spc.1undefined Offline
                spc.1undefined Offline
                spc.1
                wrote on last edited by
                #7

                AI is.. mad wild.

                hikinataundefined 1 Reply Last reply
                0
                • hikinataundefined Offline
                  hikinataundefined Offline
                  hikinata
                  replied to spc.1 on last edited by
                  #8

                  FomroMadia agree, but with IA i can make some things to save time at my tournament...

                  1 Reply Last reply
                  0
                  • hikinataundefined Offline
                    hikinataundefined Offline
                    hikinata
                    wrote on last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0

                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Donate