Added creating BE's config.

Added creating BattlEye's BEServer_x64.cfg file if it doesn't exist.
And some fixes.
This commit is contained in:
2025-01-16 16:02:51 +03:00
parent fab00eecdb
commit 1fdce8dbaa

View File

@@ -25,6 +25,7 @@ Param (
[string]$myVersion = "v0.8"
[string]$iniFile = $myName + ".ini"
[string]$steamScript = $myName + ".txt"
$Error.Clear()
if (($init -eq $true) -and ($update -eq $true)) {
Write-Error "Only one parameter is accepted - either 'Init' or 'Update'."
@@ -106,7 +107,7 @@ $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)"
Write-Host "Init = $($init), Update = $($update), noDelete = $($noDelete)"
$ini = $config = $servers = $clientMods = $serverMods = $steamProcess = $null
$modNI = $modNS = $namalskMission = $pathNamalskMission = $null
@@ -278,6 +279,7 @@ if (-not ([string]::IsNullOrEmpty($becLocation))) {
if (-not (Test-Path -Path "$($becLocation)\")) {
New-Item -ItemType Directory -Path "$($becLocation)\" | Out-Null
New-Item -ItemType Directory -Path "$($becLocation)\Config\" | Out-Null
New-Item -ItemType Directory -Path "$($becLocation)\Log\" | Out-Null
}
}
@@ -354,10 +356,26 @@ foreach ($srv in $servers) {
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")) {
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
}
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 + 3
$content = "RConPassword ChangeMe123`r`nRConPort $($rconPort)`r`nRestrictRCon 0"
Add-Content -Path "$($serverProfile)\BattlEye\BEServer_x64.cfg" -Value $content -Encoding ASCII
$content = $null
}
EXIT
$bec = "`"$($becLocation)\bec.exe`""
$becArguments = "-f `"$($instance).cfg`" --dsc"
}