This commit is contained in:
2025-01-17 16:21:31 +03:00
parent 6f6d415a65
commit 3d3414f01b

View File

@@ -107,7 +107,6 @@ $date = Get-Date
$date2 = Get-Date -Format 's' | ForEach-Object { $_ -replace 'T', ' ' }
Write-Host "$($date2) Starting $($myName) $($myVersion) script"
Write-Host "Init = $($init), Update = $($update), noDelete = $($noDelete)"
$ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null
$modNI = $modNS = $namalskMission = $pathNamalskMission = $null
@@ -148,10 +147,6 @@ foreach ($mod in $ini.ServerMods.GetEnumerator()) {
}
}
function Update {
}
switch ($updatePeriod) {
D { if ($currentHour -eq $updateHour) { $update = $true } }
W { if (($currentDayOfWeek -eq $updateDay) -and ($currentHour -eq $updateHour)) { $update = $true } }
@@ -159,6 +154,8 @@ switch ($updatePeriod) {
default { $update = $false }
}
Write-Host "Init = $($init), Update = $($update), noDelete = $($noDelete)"
if ($update) {
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!"
@@ -370,7 +367,7 @@ foreach ($srv in $servers) {
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 + 3
[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