Advertisement
TimScothernOfficial

DayZ Launcher

Dec 12th, 2019
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.81 KB | None | 0 0
  1. @echo off
  2. TITLE DayZ SA Server - Status
  3. COLOR 0A
  4.     :: DEFINE the following variables where applicable to your install
  5.     SET SteamCMDPath="C:\Games\SteamCMD"
  6.     SET STEAM_WORKSHOP=C:\Games\SteamCMD\steamapps\workshop\content\221100\
  7.     SET SteamLogin=[user] [password]
  8.     set STEAMCMD_DEL=5
  9.     SET DayZBranch=223350
  10.     SET DayZGameBranch=221100
  11.     SET DayZServerPath="C:\Games\DayzServer"
  12.     SET BECPath=C:\Games\DayzServer\ServerProfile\BattlEye\BEC
  13.    
  14.     set BEpath="C:\Games\DayzServer\battleye"
  15.     set serverName="server name"
  16.     set profile="C:\Games\DayzServer\ServerProfile"
  17.     set IP=[server ip]]
  18.     set serverPort=[game port]]
  19.     set serverConfig=serverDZ.cfg
  20.     set serverCPU=2
  21.    :: each MOD_LIST file line contains: modID,DayZ_folder_name
  22.     set MOD_LIST=(C:\Games\DayzServer\modlist.txt)
  23.     SET /A modupate=0
  24.     SETLOCAL EnableDelayedExpansion
  25.     :: _______________________________________________________________
  26.  
  27. goto checkServer
  28. pause
  29.  
  30. :checkServer
  31. tasklist /fi "imagename eq DayZServer_x64.exe" 2>NUL | find /i /n "DayZServer_x64.exe">NUL
  32. if "%ERRORLEVEL%"=="0" goto checkBEC
  33. rem cls
  34. echo Server is not running, taking care of it..
  35. goto killServer
  36.  
  37. :checkBEC
  38. tasklist /fi "imagename eq BEC.exe" 2>NUL | find /i /n "BEC.exe">NUL
  39. if "%ERRORLEVEL%"=="0" goto loopServer
  40. rem cls
  41. echo Bec is not running, taking care of it..
  42. goto startBEC
  43.  
  44. :loopServer
  45. FOR /L %%s IN (30,-1,0) DO (
  46.     rem cls
  47.     echo Server is running. Checking again in %%s seconds..
  48.     timeout 1 >nul
  49. )
  50. IF /I "%modupate%" GEQ "30" (
  51.     SET /A modupdate=0
  52.     goto updateMods
  53. )
  54. SET /A modupate+=1
  55. goto checkServer
  56.  
  57. :killServer
  58. taskkill /f /im Bec.exe
  59. taskkill /f /im DayZServer_x64.exe
  60. goto updateServer
  61.  
  62. :updateMods
  63. echo Reading in configurations/variables set in this batch and MOD_LIST. Updating Steam Workshop mods...
  64. cd %SteamCMDPath%
  65. @ timeout 1 >nul
  66. for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do steamcmd.exe +login %SteamLogin% +workshop_download_item 221100 "%%g" +quit +cls
  67. echo Steam Workshop files up to date!
  68. rem cls
  69. goto checkServer
  70.  
  71. :updateServer
  72. rem cls
  73. FOR /L %%s IN (%STEAMCMD_DEL%,-1,0) DO (
  74.     rem cls
  75.     echo Checking for mod updates in %%s seconds..
  76.     timeout 1 >nul
  77. )
  78. echo Updating DayZ server...
  79. cd %SteamCMDPath%
  80. steamcmd.exe +login %SteamLogin% +force_install_dir %DayZServerPath% +"app_update %DayZBranch%" +quit
  81. rem cls
  82. echo Syncing Workbench source with server destination...
  83. @ timeout 2 >nul
  84. @ for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do robocopy "%STEAM_WORKSHOP%\%%g" "%DayZServerPath%\%%h" *.* /mir
  85. @ for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do forfiles /p "%DayZServerPath%\%%h" /m *.bikey /s /c "cmd /c copy @path %DayZServerPath%\keys"
  86. rem cls
  87. echo Sync complete! If sync not completed correctly, verify configuration file.
  88. @ timeout 3 >nul
  89. rem cls
  90. set "MODS_TO_LOAD="
  91. for /f "tokens=1,2 delims=," %%g in %MOD_LIST% do (
  92. set "MODS_TO_LOAD=!MODS_TO_LOAD!%%h;"
  93. )
  94. set "MODS_TO_LOAD=!MODS_TO_LOAD:~0,-1!"
  95. ECHO Will start DayZ with the following mods: !MODS_TO_LOAD!%
  96. @ timeout 3 >nul
  97. goto startServer
  98.  
  99. :startServer
  100. rem cls
  101. echo Starting DayZ SA Server.
  102. timeout 1 >nul
  103. rem cls
  104. echo Starting DayZ SA Server..
  105. timeout 1 >nul
  106. rem cls
  107. echo Starting DayZ SA Server...
  108. cd "%DayZServerPath%"
  109. start DZSALModServer.exe -config=%serverConfig% -ip=%IP% -port=%serverPort% -cpuCount=%serverCPU% -dologs -adminlog -netlog -freezecheck -scrAllowFileWrite -profiles=%profile% -BEPath=%BEpath% "-mod=!MODS_TO_LOAD!%"
  110. FOR /l %%s IN (45,-1,0) DO (
  111.     rem cls
  112.     echo Initializing server, wait %%s seconds to initialize BEC..
  113.     timeout 1 >nul
  114. )
  115. goto startBEC
  116.  
  117. :startBEC
  118. rem cls
  119. echo Starting BEC.
  120. timeout 1 >nul
  121. rem cls
  122. echo Starting BEC..
  123. timeout 1 >nul
  124. rem cls
  125. echo Starting BEC...
  126. timeout 1 >nul
  127. cd "%BECPath%"
  128. start Bec.exe -f Config.cfg --dsc
  129. goto checkServer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement