TSG-KaMiKaZeE

Arma 3 Server launcher.bat

Jan 17th, 2021 (edited)
164
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: EDIT TO YOUR OWN NEEDS
  2.  
  3. @echo off
  4. color F
  5. echo Pre startup initialised
  6. echo.
  7. :: Command window name, does not affect anything else
  8. :: Default is: ARMA Server #1
  9. set server_name=TSG ARMA3 Server
  10. :: Path to the ARMA 3 server executable, for example C:ARMA\arma3server.exe
  11. set path_to_server_executable=D:\ServerData\SteamCMD\steamapps\common\Arma3Server\arma3server_x64.exe
  12. :: Name of executable
  13. :: Default 32bit is arma3server.exe, default 64bit is arma3server_x64.exe
  14. set exe_name=arma3server_x64.exe
  15. :: set the port number of the ARMA server, default ARMA is 2302
  16. set server_port_number=2302
  17. :: Name of server profile
  18. set profile_name=TSG
  19. :: List of server side mods, Add the mod to modlist for example adding Mod3 to set modlist=@Mod1; @Mod2;
  20. :: You would do: set modlist=@Mod1; @Mod2; @Mod3;
  21. set modlist=@ExileMod;@CBA_A3;@RyanZombies;@CUPTerrainsMaps;@CUPTerrainsCore;@CUPUnits;@CUPVehicles;@CUPWeapons;@ExtendedSurvivalPack;@ExtendedBaseMod;@VcomAI;@ZombiesandDemons
  22. :: List of server side mods, Add the mod to servermodlist for example adding ServerMod3 to set servermodlist=@ServerMod1; @ServerMod2;
  23. :: You would do: set servermodlist=@ServerMod1; @ServerMod2; @ServerMod3;
  24. set servermodlist=@ExileServer;@infiSTAR_Exile;
  25. :: basic.cfg location, for example C:ARMA\basic.cfg
  26. set path_to_basic_cfg=D:\ServerData\SteamCMD\steamapps\common\Arma3Server\@ExileServer\basic.cfg
  27. :: server.cfg/config.cfg location, for example C:ARMA\server.cfg
  28. set path_to_server_cfg=D:\ServerData\SteamCMD\steamapps\common\Arma3Server\@ExileServer\config.cfg
  29. :: Path to the ARMA directory, for example C:ARMA\
  30. set path_to_arma_directory=D:\ServerData\SteamCMD\steamapps\common\Arma3Server\
  31. :: Default is tbb4malloc_bi
  32. set malloc_name=tbbmalloc_x64
  33. :: If you are using the SteamCMD updater:
  34. :: set use_steam_updater=true
  35. :: Default is false
  36. set use_steam_updater=false
  37. :: set the path to the SteamCMD executable
  38. set path_to_steamcmd_executable=D:\ServerData\SteamCMD\steamcmd.exe
  39. :: set the Steam account name that you want to use to update the server
  40. set account_name=
  41. :: set the above Steam account password
  42. set account_password=
  43. ::
  44. :: DO NOT CHANGE ANYTHING BELOW THIS POINT
  45. :: UNLESS YOU KNOW WHAT YOU ARE DOING
  46. ::
  47. set error=""
  48.  
  49. echo.
  50. echo Starting vars checks
  51. title %server_name%
  52.  
  53. if "%path_to_server_executable%" == "changeme" (
  54.     set error=path_to_server_executable
  55.     goto error
  56. )
  57. if "%server_port_number%" == "0" (
  58.     set error=server_port_number
  59.     goto error
  60. )
  61. if "%profile_name%" == "changeme" (
  62.     set error=profile_name
  63.     goto error
  64. )
  65. if "%modlist%" == "@Mod1; @Mod2; @Mod3;" (
  66.     set error=modlist
  67.     goto error
  68. )
  69. if "%servermodlist%" == "@ServerMod1; @ServerMod2; @ServerMod3;" (
  70.     set error=servermodlist=
  71.     goto error
  72. )
  73. if "%path_to_basic_cfg%" == "changeme" (
  74.     set error=path_to_basic_cfg
  75.     goto error
  76. )
  77. if "%path_to_server_cfg%" == "changeme" (
  78.     set error=path_to_server_cfg
  79.     goto error
  80. )
  81. if "%path_to_arma_directory%" == "changeme" (
  82.     set error=path_to_arma_directory
  83.     goto error
  84. )
  85. if "%use_steam_updater%" == "true" (
  86.     if "%path_to_steamcmd_executable%" == "changeme" (
  87.         set error=path_to_steamcmd_executable
  88.         goto error
  89.     )
  90.     if "%account_name%" == "changeme" (
  91.         set error=account_name
  92.         goto error
  93.     )
  94.     if "%account_password%" == "changeme" (
  95.         set error=account_password
  96.         goto error
  97.     )
  98. )
  99. set tasklist_name=IMAGENAME eq %exe_name%
  100.  
  101. echo.
  102. echo Variable checks completed!
  103. echo.
  104. set loops=0
  105.  
  106. :loop
  107. tasklist /FI "%tasklist_name%" 2>NUL | find /I /N "%exe_name%">NUL
  108. if "%ERRORLEVEL%" == "0" goto loop
  109.  
  110. :: Steam automatic update for the server files
  111. :: Get from here https://developer.valvesoftware.com/wiki/SteamCMD
  112. if "%use_steam_updater%" == "true" (
  113.     echo Steam Automatic Update Starting
  114.     start /wait %path_to_steamcmd_executable% +login %account_name% %account_password% +force_install_dir %path_to_arma_directory% +app_update 233780 validate +quit
  115.     echo Steam Automatic Update Completed
  116. )
  117.  
  118. echo.
  119. echo Pre startup complete!
  120. echo.
  121. echo Starting server at: %date%,%time%
  122. if "%loops%" NEQ "0" (
  123.     echo Restarts: %loops%
  124. )
  125.  
  126. :: Start the ARMA Server
  127. cd %path_to_server_executable%
  128. start "%profile_name%" /min /wait %exe_name% "-mod=%modlist%" "-config=%path_to_server_cfg%" -port=%server_port_number% "-profiles=%profile_name%" "-cfg=%path_to_basic_cfg%" "-bepath=D:\ServerData\SteamCMD\steamapps\common\Arma3Server\TSG\BattlEye" -name=%profile_name% -autoinit -enableHT -loadMissionToMemory -hugepages -malloc=%malloc_name% -serverMod=%servermodlist%
  129.  
  130. echo To stop the server, close %~nx0 then the other tasks, otherwise it will restart
  131. echo.
  132. goto looping
  133.  
  134. :loop
  135. :: Monitoring Loop
  136. echo Server is already running, running monitoring loop
  137.  
  138. :looping
  139. :: Restart/Crash Handler
  140. set /A loops+=1
  141. timeout /t 5
  142. tasklist /FI "%tasklist_name%" 2>NUL | find /I /N "%server_port_number%">NUL
  143. if "%mission_prefetch%"=="true" (
  144.     taskkill /F /IM %mission_prefetch_exe_name%
  145. )
  146. if "%ERRORLEVEL%"=="0" goto loop
  147. goto loop
  148.  
  149. :error
  150. :: Generic error catching
  151. color C
  152. echo ERROR: %error% not set correctly, please check the config
  153. pause
  154. color F
RAW Paste Data