Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Start Logging - Log @ path below.
  2.     Start-Transcript -Path 'C:\Program Files\Steam\steamapps\arma3server\arma3server-primaryscript.log' -Append
  3.  
  4. <#
  5.     Arma 3 Server Configuration
  6.     # = Comment! Copy, paste, comment! Run your own lines!
  7.  
  8.     IF YOU BREAK THE SERVER, PLEASE DO NOT LEAVE IT BROKEN! COMMENT OUT YOUR NEW LINES!
  9.  
  10. #>
  11.  
  12. ## DEFAULT MODS
  13. #Mod Command Line
  14.  
  15.     #Ensure mod command line is cleared. (Mostly for testing)
  16.             $mod = ""
  17.             $modNameList = ""
  18.             $modIDList = ""
  19.     #Mod By Load Order
  20.             #Mod Dependancies
  21.             $mod = [pscustomobject]@(@{ModName="@CBA_A3";ModID="450814997"})
  22.             $mod += [pscustomobject]@(@{ModName="@ace";ModID="463939057"})
  23.             $mod += [pscustomobject]@(@{ModName="@ACEX";ModID="708250744"})
  24.             $mod += [pscustomobject]@(@{ModName="@CUPTerrains_C";ModID="583496184"})
  25.             $mod += [pscustomobject]@(@{ModName="@RHSAFRF";ModID="843425103"})
  26.             $mod += [pscustomobject]@(@{ModName="@RHSUSAF";ModID="843577117"})
  27.             $mod += [pscustomobject]@(@{ModName="@RHSGREF";ModID="843593391"})
  28.             $mod += [pscustomobject]@(@{ModName="@tfar_beta";ModID="894678801"})
  29.  
  30.             $mod += [pscustomobject]@(@{ModName="@ACEC-USAF";ModID="773125288"})
  31.             $mod += [pscustomobject]@(@{ModName="@ACEC-AFRF";ModID="773131200"})
  32.             $mod += [pscustomobject]@(@{ModName="@ACEC-GREF";ModID="884966711"})
  33.  
  34.             $mod += [pscustomobject]@(@{ModName="@CUPTerrains_M";ModID="583544987"})
  35.             $mod += [pscustomobject]@(@{ModName="@Anizay";ModID="1537973181"})
  36.             $mod += [pscustomobject]@(@{ModName="@Leskovets";ModID="855464203"})
  37.             $mod += [pscustomobject]@(@{ModName="@Reshmaan";ModID="843362862"})
  38.             $mod += [pscustomobject]@(@{ModName="@Kunduz";ModID="421620913"})
  39.  
  40.             $mod += [pscustomobject]@(@{ModName="@MELB";ModID="561177050"})
  41.             $mod += [pscustomobject]@(@{ModName="@FA18";ModID="743099837"})
  42.             $mod += [pscustomobject]@(@{ModName="@6X6";ModID="1190934425"})
  43.  
  44.             $mod += [pscustomobject]@(@{ModName="@ITC";ModID="1321663083"})
  45.             $mod += [pscustomobject]@(@{ModName="@ITCLand";ModID="1388192893"})
  46.             $mod += [pscustomobject]@(@{ModName="@ITC-RHSUSAFCompat";ModID="1501132392"})
  47.             $mod += [pscustomobject]@(@{ModName="@ITCLand-USAFCompat";ModID="1393769392"})
  48.  
  49.             $mod += [pscustomobject]@(@{ModName="@tfw_radios";ModID="873999690"})
  50.             $mod += [pscustomobject]@(@{ModName="@MLO";ModID="823636749"})
  51.             $mod += [pscustomobject]@(@{ModName="@SMA";ModID="699630614"})
  52.  
  53.             $mod += [pscustomobject]@(@{ModName="@ProjectOPFOR";ModID="735566597"})
  54.             $mod += [pscustomobject]@(@{ModName="@EMove";ModID="333310405"})
  55.             $mod += [pscustomobject]@(@{ModName="@DUI";ModID="1638341685"})
  56.  
  57.             $mod += [pscustomobject]@(@{ModName="@16thJSOC";ModID="1609947849"})
  58.  
  59.             foreach ($i in $mod) {
  60.                 $modNameList += $i.ModName + "; "
  61.             }
  62.  
  63. ## TEST MODS
  64.     #Replaces Mod Line Above
  65.         # $mod='""'
  66.  
  67.     #Server Only Mods
  68.         #$serveronlymod='@RHSSAF;@VCOM;'
  69.         #1645358402
  70.         $serveronlymod='@VCOM;'
  71.  
  72.  
  73. #SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE
  74. #SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE
  75. #SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE - SERVER SHIT BELOW THIS LINE
  76.  
  77. ## STOP RUNNING SERVER
  78.     Stop-Process -Name arma3server* -Force  #We need to start doing this by process ID. -T
  79.  
  80. #Let's update Arma 3!
  81. # http://media.steampowered.com/installer/steamcmd.zip
  82. #SETLOCAL ENABLEDELAYEDEXPANSION
  83.  
  84.     $SteamLogin=""
  85.     $SteamPass=""
  86.     $ServerBRANCH="233780 -beta"
  87.         # For stable use 233780 -beta
  88.         # For Dev use 233780 -beta development
  89.                 # Note, the missing qotation marks, these need to be wrapped around the entire "+app_data......"
  90.                 # There is no DEV branch data yet for Arma 3 Dedicated Server package !!!
  91.  
  92.     $ServerPath="C:\Program Files\Steam\steamapps\Arma3Server"
  93.     $SteamPath="C:\Program Files\Steam"
  94.  
  95. & $SteamPath\steamcmd.exe +login $SteamLogin $SteamPass +force_install_dir $ServerPath +"app_update $ServerBRANCH" validate +quit
  96.  
  97. #Let's update mods!
  98. foreach ($i in $mod) {
  99.     $WorkshopDownloadItem = '+workshop_download_item "107410 ' + $i.ModID + '"'
  100.     & $SteamPath\steamcmd.exe +login $STEAMLOGIN $Steampass $WorkshopDownloadItem +quit
  101.     Write-Host "Errorlevel: "$LASTEXITCODE
  102.     if ($LASTEXITCODE -eq 0) {
  103.         $ModName = $i.ModName
  104.         $ModID = $i.ModID
  105.         Remove-Item $ModName -ErrorAction SilentlyContinue
  106.         if (-not (test-path "$ServerPath\$ModName")) {
  107.             md "$ServerPath\$ModName"
  108.         }
  109.         Write-Host 'Copying '$Modname' to arma directory.'
  110.         Copy-Item "$SteamPath\steamapps\workshop\content\107410\$ModID\*" "$ServerPath\$ModName" -Force
  111.     } else {
  112.         Write-Host "ERROR DOWNLOADING: "$i.ModName
  113.     }
  114. }
  115.  
  116. #Check for Mod Length Too Long
  117. #Fail @ 328, works at 324, need to narrow. -T
  118.     <#$maxmodlength = 335
  119.     if ($mod.Length -gt $maxmodlength) {
  120.         Write-Output ((Get-Date -Format g) + ' ERROR: Fuck you mod string too long! Shorten your shit! -Yours Truly, Bohemia - Length is ' + $mod.Length + ' maximum is ' + $maxmodlength)
  121.         Exit
  122.     }#>
  123.  
  124. ## SERVER COMMAND LINE
  125.     $servermodcmd = ('"' + $mod + '"') #Wrap above mods in quotes so we don't confuse Bohemia.
  126.     $serveronlymodcmd = ('"' + $serveronlymod + '"') #Wrap above mods in quotes so we don't confuse Bohemia.
  127.     CD "C:\Program Files\Steam\steamapps\arma3server\"
  128. #Test with -netlog ensure all proper logging still happens.
  129.     Write-Host "Staring Arma 3 server..."
  130.     C:\Progra~1\Steam\steamapps\arma3server\arma3server_x64.exe "-profiles=C:\Progra~1\Steam\steamapps\arma3server\" -filepatching -port=2302 -config="server.cfg" -mod="$servermodcmd" -serverMod="$serveronlymodcmd"
  131.  
  132. #Wait for server startup.
  133.     Start-Sleep -s 60
  134.  
  135. #Start headless client.
  136.     #$headlessmodcmd = ('"' + $mod + $serveronlymod + '"') #Wrap above mods in quotes so we don't confuse Bohemia.
  137.     #C:\Progra~1\Steam\steamapps\arma3server\arma3server_x64.exe "-profiles=C:\Progra~1\Steam\steamapps\arma3server\" -client -nosound -connect="127.0.0.1:2302" -mod="$headlessmodcmd"
  138.  
  139. #Wait for headless startup.
  140.     #Start-Sleep -s 60
  141.  
  142. #Set Arma 3 Server Process to HIGH priority.
  143.     Write-Host "Setting process to high priority..."
  144.     $arma3process = (Get-Process Arma3Server_x64) #We need to do this by process ID. -T
  145.  
  146.     foreach ($process in $arma3process) {
  147.         $process.PriorityClass = "High"
  148.     }
  149.  
  150. #Stop Logging
  151. Write-Host "Startup complete."    
  152. Stop-Transcript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement