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
}