Compare commits

...

8 Commits

Author SHA1 Message Date
010aecde5f Delete README.md 2025-01-20 13:43:59 +03:00
306c1c4f37 Fix. 2025-01-19 16:17:05 +03:00
3d3414f01b Fix. 2025-01-17 16:21:31 +03:00
6f6d415a65 Fix. 2025-01-16 16:06:43 +03:00
1fdce8dbaa Added creating BE's config.
Added creating BattlEye's BEServer_x64.cfg file if it doesn't exist.
And some fixes.
2025-01-16 16:02:51 +03:00
fab00eecdb Added AntiRaid mod to ServerMods list. 2025-01-16 13:30:45 +03:00
7ff8e74f24 Added "Init" function.
+ some fixes.
2024-12-26 17:06:52 +03:00
d7e02e4afb Fixed calling PS script with two args. 2024-12-26 14:39:26 +03:00
4 changed files with 50 additions and 45 deletions

View File

@@ -1,19 +0,0 @@
# wDayzManager
1. Скачайте SteamCMD (https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip) и распакуйте архив в нужную папку. Например `Z:\SteamCMD`.
1.1 Запустите `steamcmd.exe`.
1.2 После обновления себя и появления приглашения `Steam>` ввести команду `login <имя_пользователя>`.
1.3 Затем введите свой пароль. Если Steam Guard активирован на учетной записи пользователя, проверьте свой адрес электронной почты на наличие кода доступа Steam Guard и введите его. Это требуется только при первом входе в систему. Вы должны увидеть сообщение о том, что вы успешно вошли в систему с помощью своей учетной записи.
2. Если вы будете использовать `BEC` (Battleye Extended Control) - скачайте его (https://github.com/TheGamingChief/BattlEye-Extended-Controls) и распакуйте в нужную папку.
3. Скачайте wDayzManager () и распакуйте архив в нужную папку. Например `Z:\Servers\wDayzManager`.
3.1 Запустите командную строку от имени администратора. Для этого в Windows 10 нажмите правой кнопкой мыши на меню Пуск и выберите пункт "Командная строка (администратор)".
3.2 Перейдите в папку в которую вы распаковали wDayzManager (`cd /d Z:\Servers\wDayzManager`) и запустите файл `Start.bat`.
3.3 У вас должна появиться подпапка Logs в которой будет находиться log-файл с сообщением о том, что файл `wDayzManager.ini` не найден и был создан новый.
3.4 Откройте файл wDayzManager.ini в любом текстовом редакторе (но не Microsoft Word и ему подобных!) и отредактируйте его как вам необходимо. Описание настроек будет ниже.
3.5 Ещё раз запустите файл `Start.bat`, но уже с параметром `/u`. (`Start.bat /u`).
3.6 Дождитесь окончания скачивания файлов сервера и модов, после чего проверьте log-файл wDayzManager на наличие ошибок или предупреждений.
3.7 Отредактируйте конфигурационные файлы серверов (по-умолчанию `serverDZ.cfg`).
3.8 Если вы будете использовать `BEC` (Battleye Extended Control), то отредактируйте его конфигурационные файлы.
3.9 Если вы будете использовать какие-либо инструменты администратора (`CommunityOnlineTools` или `VPPAdminTools` или подобные) не забудьте также настроить и их.

View File

@@ -24,8 +24,8 @@ if not exist "Logs\" mkdir "Logs"
set init=0 set init=0
set update=0 set update=0
for %%a in (%*) do if /i "%%~a" equ "/I" set init=1 if /i "%1" equ "/I" set init=1
for %%a in (%*) do if /i "%%~a" equ "/U" set update=1 if /i "%1" equ "/U" set update=1
@REM powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update% @REM powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update%
powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update% > Logs\%filename% powershell -ExecutionPolicy RemoteSigned -File wDayzManager.ps1 -Init %init% -Update %update% > Logs\%filename%

View File

@@ -44,6 +44,7 @@ updateHour=0
@CnG_UAZ_31514=3160244059 @CnG_UAZ_31514=3160244059
[ServerMods] [ServerMods]
@AntiRaid=1750367340
@SurvivorMissions=1988925918 @SurvivorMissions=1988925918
[Server-1] [Server-1]

View File

@@ -1,4 +1,4 @@
# wDayzManager v0.7 # wDayzManager v0.9
# Copyright (c) 2024 Vladislav Salikov aka W0LF aka 'dreamforce' # Copyright (c) 2024 Vladislav Salikov aka W0LF aka 'dreamforce'
# https://github.com/dreamforceinc # https://github.com/dreamforceinc
# Required module: PSIni # Required module: PSIni
@@ -22,12 +22,19 @@ Param (
################################################################ [ !!! DON'T EDIT BELOW !!! ] ################################################################# ################################################################ [ !!! DON'T EDIT BELOW !!! ] #################################################################
[string]$myName = "wDayzManager" [string]$myName = "wDayzManager"
[string]$myVersion = "v0.7" [string]$myVersion = "v0.9"
[string]$steamScript = $myName + ".txt"
[string]$iniFile = $myName + ".ini" [string]$iniFile = $myName + ".ini"
if (-not (Test-Path -Path $iniFile)) { [string]$steamScript = $myName + ".txt"
Write-Warning "Can't find file '$iniFile', creating new..." $Error.Clear()
if (($init -eq $true) -and ($update -eq $true)) {
Write-Error "Only one parameter is accepted - either 'Init' or 'Update'."
Exit
}
function Init {
New-Item -ItemType File -Path $iniFile -Value "; $($iniFile)" | Out-Null New-Item -ItemType File -Path $iniFile -Value "; $($iniFile)" | Out-Null
if (!$?) { Exit }
$content = " $content = "
[Config] [Config]
serverLocation=Z:\Servers\DayzServer serverLocation=Z:\Servers\DayzServer
@@ -82,11 +89,17 @@ startupServerMods=
additionalParams= -name=Server -AdminLog -FilePatching additionalParams= -name=Server -AdminLog -FilePatching
namalskMission= namalskMission=
" "
Add-Content -Path $iniFile -Value $content -Encoding UTF8 Add-Content -Path $iniFile -Value $content -Encoding ASCII
$content = $null $content = $null
Exit Exit
} }
if ($init) { Init ; Exit }
if (-not (Test-Path -Path $iniFile)) {
Write-Warning "Can't find file '$iniFile'. You probably need to run the bat-script with the '/I' parameter."
Exit
}
$date = Get-Date $date = Get-Date
[int]$currentDayOfWeek = ([datetime]$date).DayOfWeek [int]$currentDayOfWeek = ([datetime]$date).DayOfWeek
[int]$currentDay = ([datetime]$date).Day [int]$currentDay = ([datetime]$date).Day
@@ -94,7 +107,6 @@ $date = Get-Date
$date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' } $date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' }
Write-Host "$($date2) Starting $($myName) $($myVersion) script" Write-Host "$($date2) Starting $($myName) $($myVersion) script"
Write-Host "init = $($init), update = $($update), noDelete = $($noDelete)"
$ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null $ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null
$modNI = $modNS = $namalskMission = $pathNamalskMission = $null $modNI = $modNS = $namalskMission = $pathNamalskMission = $null
@@ -121,14 +133,6 @@ $config = $ini.Config
[string]$updatePeriod = $config.updatePeriod [string]$updatePeriod = $config.updatePeriod
[bool]$rotateLogs = [int]$config.rotateLogs [bool]$rotateLogs = [int]$config.rotateLogs
function Init {
}
function Update {
}
$clientMods = New-Object 'Collections.Generic.List[Tuple[string,string]]' $clientMods = New-Object 'Collections.Generic.List[Tuple[string,string]]'
foreach ($mod in $ini.ClientMods.GetEnumerator()) { foreach ($mod in $ini.ClientMods.GetEnumerator()) {
if ($mod.Key -notlike "Comment*" ) { if ($mod.Key -notlike "Comment*" ) {
@@ -147,11 +151,13 @@ switch ($updatePeriod) {
D { if ($currentHour -eq $updateHour) { $update = $true } } D { if ($currentHour -eq $updateHour) { $update = $true } }
W { if (($currentDayOfWeek -eq $updateDay) -and ($currentHour -eq $updateHour)) { $update = $true } } W { if (($currentDayOfWeek -eq $updateDay) -and ($currentHour -eq $updateHour)) { $update = $true } }
M { if (($currentDay -eq $updateDay) -and ($currentHour -eq $updateHour)) { $update = $true } } M { if (($currentDay -eq $updateDay) -and ($currentHour -eq $updateHour)) { $update = $true } }
Default { $update = $param } default { $update = $false }
} }
Write-Host "Init = $($init), Update = $($update), noDelete = $($noDelete)"
if ($update) { if ($update) {
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!" Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
Exit Exit
} }
@@ -175,8 +181,8 @@ if ($update) {
$arr += "quit" $arr += "quit"
# Saving Steam script # Saving Steam script
"// $($steamScript) - Steam script" | Out-File -FilePath "$($currentPath)\$($steamScript)" -Encoding Ascii "// $($steamScript) - Steam script" | Out-File -FilePath "$($currentPath)\$($steamScript)" -Encoding ASCII
$arr | Out-File -FilePath "$($currentPath)\$($steamScript)" -Encoding Ascii -Append $arr | Out-File -FilePath "$($currentPath)\$($steamScript)" -Encoding ASCII -Append
# Run Steam script # Run Steam script
Write-Host "Run Steam script from `"$($currentPath)\$($steamScript)`"" Write-Host "Run Steam script from `"$($currentPath)\$($steamScript)`""
@@ -244,7 +250,7 @@ if ($rotateLogs) {
Write-Host "Removing old wDayzManager logs..." Write-Host "Removing old wDayzManager logs..."
$fileList = $null $fileList = $null
$fileList = Get-ChildItem -Path $currentPath\Logs\*.log -Recurse | Where-Object { $_.LastWriteTime.Date -lt $date.AddDays( -3) } $fileList = Get-ChildItem -Path $currentPath\Logs\*.log -Recurse | Where-Object { $_.LastWriteTime.Date -lt $date.AddDays( -2) }
# Write-Host $fileList -Separator "`n" # Write-Host $fileList -Separator "`n"
foreach ($file in $fileList) { foreach ($file in $fileList) {
Remove-Item -Path $file Remove-Item -Path $file
@@ -270,6 +276,7 @@ if (-not ([string]::IsNullOrEmpty($becLocation))) {
if (-not (Test-Path -Path "$($becLocation)\")) { if (-not (Test-Path -Path "$($becLocation)\")) {
New-Item -ItemType Directory -Path "$($becLocation)\" | Out-Null New-Item -ItemType Directory -Path "$($becLocation)\" | Out-Null
New-Item -ItemType Directory -Path "$($becLocation)\Config\" | Out-Null New-Item -ItemType Directory -Path "$($becLocation)\Config\" | Out-Null
New-Item -ItemType Directory -Path "$($becLocation)\Log\" | Out-Null
} }
} }
@@ -346,10 +353,26 @@ foreach ($srv in $servers) {
Exit Exit
} }
if (-not (Test-Path -Path "$($serverProfile)\BattlEye\")) {
Write-Host "Creating new folder: `"$($serverProfile)\BattlEye\`""
New-Item -ItemType Directory -Path "$($serverProfile)\BattlEye\" | Out-Null
}
if (-not (Test-Path -Path "$($serverProfile)\BattlEye\bans.txt")) { if (-not (Test-Path -Path "$($serverProfile)\BattlEye\bans.txt")) {
Write-Host "Copying file from `"$($serverLocation)\ban.txt`" to `"$($serverProfile)\BattlEye\bans.txt`""
Copy-Item -Path "$($serverLocation)\ban.txt" -Destination "$($serverProfile)\BattlEye\bans.txt" -ErrorAction Stop Copy-Item -Path "$($serverLocation)\ban.txt" -Destination "$($serverProfile)\BattlEye\bans.txt" -ErrorAction Stop
} }
if (-not (Test-Path -Path "$($serverProfile)\BattlEye\BEServer_x64*.cfg")) {
Write-Host "Creating new file: `"$($serverProfile)\BattlEye\BEServer_x64.cfg`""
New-Item -ItemType File -Path "$($serverProfile)\BattlEye\BEServer_x64.cfg" | Out-Null
if (!$?) { Exit }
[int]$rconPort = [int]$serverPort + 5
$content = "RConPassword ChangeMe123`r`nRConPort $($rconPort)`r`nRestrictRCon 0"
Add-Content -Path "$($serverProfile)\BattlEye\BEServer_x64.cfg" -Value $content -Encoding ASCII
$content = $null
}
$bec = "`"$($becLocation)\bec.exe`"" $bec = "`"$($becLocation)\bec.exe`""
$becArguments = "-f `"$($instance).cfg`" --dsc" $becArguments = "-f `"$($instance).cfg`" --dsc"
} }
@@ -370,14 +393,14 @@ foreach ($srv in $servers) {
$atLogsLocation += '\' + $logsName $atLogsLocation += '\' + $logsName
} }
If (!(Test-Path -PathType Container $rotatedLogsLocation)) { If (-not (Test-Path -PathType Container $rotatedLogsLocation)) {
New-Item -ItemType Directory -Path $rotatedLogsLocation | Out-Null New-Item -ItemType Directory -Path $rotatedLogsLocation | Out-Null
Write-Host "Created new folder: $($rotatedLogsLocation)" Write-Host "Created new folder: $($rotatedLogsLocation)"
} }
if ($noDelete) { if ($noDelete) {
$destDelDir = "$($rotatedLogsLocation)\DeletedLogs" $destDelDir = "$($rotatedLogsLocation)\DeletedLogs"
If (!(Test-Path -PathType Container $destDelDir)) { If (-not (Test-Path -PathType Container $destDelDir)) {
New-Item -ItemType Directory -Path $destDelDir | Out-Null New-Item -ItemType Directory -Path $destDelDir | Out-Null
Write-Host "Created new folder: $($destDelDir)" Write-Host "Created new folder: $($destDelDir)"
} }
@@ -418,7 +441,7 @@ foreach ($srv in $servers) {
if ($becLocation) { if ($becLocation) {
$becDestDir = "$($rotatedLogsLocation)\$($becFolderName)" $becDestDir = "$($rotatedLogsLocation)\$($becFolderName)"
If (!(Test-Path -PathType Container $becDestDir)) { If (-not (Test-Path -PathType Container $becDestDir)) {
New-Item -ItemType Directory -Path $becDestDir | Out-Null New-Item -ItemType Directory -Path $becDestDir | Out-Null
Write-Host "Created new folder: $($becDestDir)" Write-Host "Created new folder: $($becDestDir)"
} }
@@ -458,7 +481,7 @@ foreach ($srv in $servers) {
if ($atLogsLocation) { if ($atLogsLocation) {
$atDestDir = "$($rotatedLogsLocation)\$($atFolderName)" $atDestDir = "$($rotatedLogsLocation)\$($atFolderName)"
If (!(Test-Path -PathType Container $atDestDir)) { If (-not (Test-Path -PathType Container $atDestDir)) {
New-Item -ItemType Directory -Path $atDestDir | Out-Null New-Item -ItemType Directory -Path $atDestDir | Out-Null
Write-Host "Created new folder: $($atDestDir)" Write-Host "Created new folder: $($atDestDir)"
} }