[GSC] to shutdown server after match
-
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 }
-
Don't use chatGPT to write your code.
-
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!
-
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
-
Resxt said in [GSC] to shutdown server after match:
I highly doubt this can be done in GSC
quit
is a command andcmdexec
exists. -
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 } } }
-
AI is.. mad wild.
-
FomroMadia agree, but with IA i can make some things to save time at my tournament...
-
This post is deleted!