Ei,
Acabei de fazer isso, é um dos arquivos em lote que irá reiniciar automaticamente um servidor local da arma 3 a cada 4 horas.
1. faça um arquivo .bat na sua pasta base da arma 3
2. crie um atalho para a sua área de trabalho a partir do arquivo .bat
3. Copie o abaixo no arquivo created.bat.
4. Adicione sua opção de configuração de servidor diferente na: peça SelectServerType incrementando cada número de configuração
5. Agora adicione suas opções de linha de comando do servidor real na parte: StartArma3Server novamente
combinando o número com a opção acima.
6. salve e feche o arquivo.
7. para ganhar, clique duas vezes no atalho na área de trabalho e selecione a configuração do servidor que deseja usar.
seu servidor será reiniciado completamente a cada 4 horas a partir do momento em que foi iniciado. usando a configuração que você selecionou no início.
Se você gostaria de reiniciar o servidor em períodos de tempo mais curtos ou mais longos,
o 240 abaixo para a quantidade de MINUTOS que você deseja. (4hr = 240 minutos)
As opções de linha de comando que eu adicionei abaixo são exemplos de como suas linhas de comando devem ser, você pode removê-las e adicionar suas próprias opções.
cada vez que o servidor reiniciar, a janela de comando será atualizada informando algumas informações,
como a hora em que o servidor iniciou, quando vai reiniciar o próximo e o total reinicia esta sessão.
- Código:
-
@echo off
COLOR 0B
TITLE Arma 3 server auto restarter
SETLOCAL EnableExtensions enabledelayedexpansion
set EXE=arma3server.exe
set /A restartCounter=0
rem Change this to the amount of Minutes you want the server to restart each time.
Set secondsToRestart=240
goto SelectServerType
:SelectServerType
cls
echo Arma 3 Server Launcher.
echo.
echo 1 - Default Server (No Mods).
echo 2 - Cup Server (Cup Mods).
echo 3 - Task Force Radio Server.
echo.
set /P mod=Select Server Number:
if "%mod%"=="1" goto SetRestartTime
if "%mod%"=="2" goto SetRestartTime
if "%mod%"=="3" goto SetRestartTime
goto Server_Error
:Server_Error
cls
echo.
echo Invalid Server Code, Press Any Key To Enter Another One...
pause > NUL
goto SelectServerType
:SetRestartTime
cls
for /F "tokens=1-3 delims=:." %%a in ("%time%") do (
set timeHour=%%a
set timeMinute=%%b
set timeSeconds=%%c
)
set cTime=%timeHour%:%timeMinute%:%timeSeconds%
set /A newTime=timeHour*60 + timeMinute + %secondsToRestart%
set /A timeHour=newTime/60, timeMinute=newTime%%60
if %timeHour% gtr 23 set timeHour=0
if %timeHour% lss 10 set timeHour=0%timeHour%
if %timeMinute% lss 10 set timeMinute=0%timeMinute%
set restartTime=%timeHour%:%timeMinute%:%timeSeconds%
echo The server was started at %cTime% and will auto restart at %restartTime%.
goto StartArma3Server
:StartArma3Server
echo Starting Arma 3 Server, The server has been restarted %restartCounter% times.
if "%mod%"=="1" start /b arma3server.exe -port=2302 "-config=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_config.cfg" "-cfg=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_basic.cfg" "-profiles=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default" -name=default -filePatching "-mod=Heli;Kart;Mark"
if "%mod%"=="2" start /b arma3server.exe -port=2302 "-config=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_config.cfg" "-cfg=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_basic.cfg" "-profiles=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default" -name=default -filePatching "-mod=Heli;Kart;Mark;@CUP Vehicles;@CUP Weapons;@CUP Units;@CBA_A3"
if "%mod%"=="3" start /b arma3server.exe -port=2302 "-config=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_config.cfg" "-cfg=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default\TADST_basic.cfg" "-profiles=E:\Games\Steam\SteamApps\common\Arma 3\my_server_config\default" -name=default -filePatching "-mod=Heli;Kart;Mark;@CBA_A3;@task_force_radio"
timeout 10 >nul
goto CheckServerRunning
:CheckServerRunning
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto ServerFound
goto ServerNotFound
:ServerFound
for /F "tokens=1-3 delims=:." %%a in ("%time%") do (
set timeHour=%%a
set timeMinute=%%b
set timeSeconds=%%c
)
set /A newTime=timeHour*60 + timeMinute
set /A timeHour=newTime/60, timeMinute=newTime%%60
if %timeHour% gtr 23 set timeHour=0
if %timeHour% lss 10 set timeHour=0%timeHour%
if %timeMinute% lss 10 set timeMinute=0%timeMinute%
set theCurrentTime=%timeHour%:%timeMinute%:%timeSeconds%
if %restartTime% LSS %theCurrentTime% goto KillRestartServer
timeout 10 >nul
goto CheckServerRunning
:ServerNotFound
echo server not found
timeout 5 >nul
goto SetRestartTime
:KillRestartServer
set /A restartCounter+=1
echo Please wait while the server is restarted.
timeout 1 >nul
taskkill /F /IM %EXE% >nul
timeout 15 >nul
goto SetRestartTime