Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: DC_Volo
Script Function: Server_Auto
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; http://autoitscript.fr/forum/viewtopic.php?p=52416#p52416
#NoTrayIcon
#include <Array.au3>
#include <Process.au3>
Sleep(10000)
; ICONE
Opt ("TrayMenuMode",1)
$serversitem = TrayCreateMenu("Servers")
$privateitem = TrayCreateMenu ("Privates", $serversitem)
$45item = TrayCreateItem("Private 45", $privateitem)
$44item = TrayCreateItem("Private 44", $privateitem)
$publicitem = TrayCreateMenu ("Public", $serversitem)
$p1 = TrayCreateItem (" UG #1 DM", $publicitem)
$p2 = TrayCreateItem (" UG #2 1v1", $publicitem)
$p3 = TrayCreateItem (" UG #3 1v1", $publicitem)
$p4 = TrayCreateItem (" UG #4 1on1", $publicitem)
$p5 = TrayCreateItem (" UG #5 TD", $publicitem)
$p6 = TrayCreateItem (" UG #6 CTF", $publicitem)
$p7 = TrayCreateItem (" UG #7 AS", $publicitem)
$p8 = TrayCreateItem (" UG #8 MAP", $publicitem)
$mod = TrayCreateMenu ("Game Mod", $serversitem)
$hostage = TrayCreateItem ("Hostage Mod", $mod)
$prey = TrayCreateItem ("Prey Mod", $mod)
$conquest = TrayCreateItem ("Conquest Mod", $mod)
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
While 1
Sleep(1000)
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $aboutitem
Msgbox(64,"About:","It is running all UG Star Wars Republic Commando Servers")
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
; Creer le fichier ini du log
If FileExists ("Log_Crash.ini") Then
; rien
ElseIf Not FileExists ("Log_Crash.ini") Then
IniWrite("Log_Crash.ini", "Premier Lancement", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , " Demarrage de Start_Server.exe")
EndIf
Sleep(2000)
; CONFIGURATION DES SERVEURS
$1a_45 = ("D:\Star Wars Republic Commando\1a_45\SWRepublicCommandoServerPrivate.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?RespawnDelay=3?timelimit=0?GameStats=True?BalanceTeams=false?FF=0.5?MaxPlayers=32?MapListType=MPGame.MapListTeamDeathMatch -ini=privateserver.ini -log=privateserver.log -server")
$1b_44 = ("D:\Star Wars Republic Commando\1b_44\SWRepublicCommandoServerPrivate2.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?RespawnDelay=3?timelimit=0?GameStats=True?BalanceTeams=false?FF=0.5?MaxPlayers=32?MapListType=MPGame.MapListTeamDeathMatch -ini=privateserver2.ini -log=privateserver.log -server")
$1c_P1 = ("D:\Star Wars Republic Commando\1c_P1\SWRepublicCommando1.exe DM_engine?game=dc.dmgamedc?GoalScore=0?timelimit=20?RespawnDelay=0?GameStats=True?BalanceTeams=False?FF=0.0?maxplayers=16?MapListType=MPGame.MapListDeathMatch -ini=server1.ini -log=server.log -server")
$1d_P2 = ("D:\Star Wars Republic Commando\1d_P2\SWRepublicCommando2.exe DM_engine?game=dc.dmgamedc?GoalScore=15?timelimit=0?RespawnDelay=0?GameStats=True?BalanceTeams=false?FF=0.0?MaxPlayers=2?Maxspectators=8?MapListType=MPGame.MapListDeathMatch -ini=server2.ini -log=server.log -server")
$1e_P3 = ("D:\Star Wars Republic Commando\1e_P3\SWRepublicCommando2-2.exe DM_siege?game=dc.dmgamedc?GoalScore=15?timelimit=0?RespawnDelay=0?GameStats=True?BalanceTeams=false?FF=0.0?MaxPlayers=2?maxspectators=8?MapListType=MPGame.MapListDeathMatch -ini=server22.ini -log=server.log -server")
$1f_P4 = ("D:\Star Wars Republic Commando\1f_P4\SWRepublicCommando2-3.exe DM_1on1?game=dc.dmgamedc?GoalScore=15?timelimit=0?RespawnDelay=0?GameStats=True?BalanceTeams=false?FF=0.0?MaxPlayers=2?maxspectators=8?MapListType=MPGame.MapListDeathMatch -ini=server23.ini -log=server.log -server")
$1g_P5 = ("D:\Star Wars Republic Commando\1g_P5\SWRepublicCommando3.exe DM_engine?game=dc.tdgamedc?GoalScore=200?RespawnDelay=3?timelimit=30?GameStats=True?BalanceTeams=true?FF=0.0?MaxPlayers=16?MapListType=MPGame.MapListTeamDeathMatch -ini=server3.ini -log=server.log -server")
$1h_P6 = ("D:\Star Wars Republic Commando\1h_P6\SWRepublicCommando4.exe CTF_engine?game=dc.ctfgamedc?GoalScore=3?timelimit=0?RespawnDelay=5?GameStats=True?BalanceTeams=true?FF=0.0?MaxPlayers=20?MapListType=MPGame.MapListCaptureTheFlag -ini=server4.ini -log=server.log -server")
$1i_P7 = ("D:\Star Wars Republic Commando\1i_P7\SWRepublicCommando5.exe CTF_engine?game=dc.asgamedc?GoalScore=5?RespawnDelay=5?timelimit=0?RoundTime=300?GameStats=True?BalanceTeams=true?FF=0.0?MaxPlayers=16?MapListType=MPGame.MapListAssault -ini=server5.ini -log=server.log -server")
$1j_P8 = ("D:\Star Wars Republic Commando\1j_P8\SWRepublicCommandoserver7.exe LL_nochance?game=dc.ctfgamedc?respawdelay=5?Timelimit=15?GameStats=True?BalanceTeams=true?FF=0.0?MaxPlayers=20?MapListType=MPGame.MapListDeathMatch -ini=server7.ini -log=server.net.log -server")
$1k_SM1 = ("D:\Star Wars Republic Commando\1k_SM1\SWRepublicCommandoconquest.exe ER_Engine?Game=CommandPostObjects.ConqGame?GoalScore=100?TimeLimit=30?RespawnDelay=4?MaxPlayers=20?GameStats=True?BalanceTeams=true?MapListType=MPGame.MapListTeamDeathMatch -ini=server6cst.ini -log=server.log -server")
$1l_SM2 = ("D:\Star Wars Republic Commando\1l_SM2\SWRepublicCommandoPrey.exe DM_engine?game=dc.preygamedc?GoalScore=30?timelimit=30?RespawnDelay=2?GameStats=True?BalanceTeams=false?FF=0.0?maxplayers=12?MapListType=MPGame.MapListDeathMatch -ini=server9.ini -log=server1.log -server")
$1m_SM3 = ("D:\Star Wars Republic Commando\1m_SM3\SWRepublicCommandoHOSTAGE.exe CTF_engine?game=tag.taghost?goalscore=4?timelimit=0?respawndelay=6?GameStats=True?BalanceTeams=true?FF=0.00?RoundTime=600?NumRounds=0?MaxPlayers=20?MapListType=MPGame.MapListTeamDeathMatch -ini=server11HOSTAGE.ini -log=server.log -server")
; LANCEMENT DES SERVEURS
Sleep(5000)
Run ($1c_P1)
Sleep(2000)
Run ($1d_P2)
Sleep(2000)
Run ($1e_P3)
Sleep(2000)
Run ($1f_P4)
Sleep(2000)
Run ($1g_P5)
Sleep(2000)
Run ($1h_P6)
Sleep(2000)
Run ($1i_P7)
Sleep(2000)
Run ($1j_P8)
Sleep(2000)
Run ($1k_SM1)
Sleep(2000)
Run ($1l_SM2)
Sleep(2000)
Run ($1m_SM3)
Sleep(2000)
Run ($1a_45)
Sleep(2000)
Run ($1b_44)
Sleep(2000)
IniWrite("Log_Crash.ini", "BOOT_ALL_SERVER", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "Done") ; LOG de demarrage des serveurs UG
Sleep(2000)
; REBOOT SI CRASH
$nps[13] = ["SWRepublicCommandoServerPrivate.exe","SWRepublicCommandoServerPrivate2.exe","SWRepublicCommando1.exe","SWRepublicCommando2.exe","SWRepublicCommando2-2.exe","SWRepublicCommando2-3.exe","SWRepublicCommando3.exe","SWRepublicCommando4.exe","SWRepublicCommando5.exe","SWRepublicCommandoserver7.exe","SWRepublicCommandoconquest.exe","SWRepublicCommandoPrey.exe","SWRepublicCommandoHOSTAGE.exe"]
; private -> hor -> 45 -> 44 | Public -> soc, 12345678 | Mod -> Conquest , prey , hostage
While 1
Sleep(4000)
; different processus regroupé dans un tableau
; demandé le PID d'un programme
; grâce au PID definir la fenetre
; avec la fenetre controler sa variable nombre de joueur
; si nombre est negatif, on kill le processus qui sera donc relancé.
For $i=0 To UBound($nps)-1 ; on fait une boucle pour parcourir le tableau
_Fenetre($nps[$i]) ; on appelle la fonction
Next
Func _Fenetre($Name_Process)
$titre = _GetHwndFromPID(ProcessExists($Name_Process))
$array = StringRegExp($titre,".*\(([0-9]+).players\)",1)
$nbJoueur = $array[0]
If $Nbplayers < 0 Then
ProcessClose ($Name_Process)
EndIf
EndFunc
Func _GetHwndFromPID($PID)
$winlist = WinList()
For $i = 1 To $winlist[0][0]
If $winlist[$i][0] <> "" And WinGetProcess($winlist[$i][1]) = $PID Then Return $winlist[$i][0]
Next
EndFunc ;==>_GetHwndFromPID
Sleep(1000)
if not ProcessExists ("SWRepublicCommando1.exe") Then
Run ($1c_P1)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #1 Crashed") ; LOG de Public #1
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando2.exe") Then
Run ($1d_P2)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #2 Crashed"); LOG de Public #2
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando2-2.exe") Then
Run ($1e_P3)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #3 Crashed") ; LOG de Public #3
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando2-3.exe") Then
Run ($1f_P4)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #4 Crashed") ; LOG de Public #4
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando3.exe") Then
Run ($1g_P5)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #5 Crashed") ; LOG de Public #5
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando4.exe") Then
Run ($1h_P6)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #6 Crashed") ; LOG de Public #6
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommando5.exe") Then
Run ($1i_P7)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #7 Crashed") ; LOG de Public #7
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoconquest.exe") Then
Run ($1k_SM1)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public Conquest Mod Crashed") ; LOG de Conquest Mod
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoserver7.exe") Then
Run ($1j_P8)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public #8 Crashed") ; LOG de Public #8
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoPrey.exe") Then
Run ($1l_SM2)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public Prey Mod Crashed") ; LOG de Prey Mod
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoServerPrivate.exe") Then
Run ($1a_45)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Private 45 Crashed") ; LOG de Private 45
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoServerPrivate2.exe") Then
Run ($1b_44)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Private 44 Crashed") ; LOG de Private 44
EndIf
Sleep(1000)
If Not ProcessExists ("SWRepublicCommandoHOSTAGE.exe") Then
Run ($1m_SM3)
IniWrite("Log_Crash.ini", "CRASH", " "& @HOUR & ":" & @MIN & ":" & @SEC & "|" & @MDAY & "/" & @Mon & "/" & @Year , "UG Server Public Hostage Mod Crashed") ; LOG de Hostage Mod
EndIf
WEnd