q3rcon-ps/examples/commands.ps1
2023-12-09 12:20:33 +00:00

27 lines
508 B
PowerShell

[cmdletbinding()]
param()
Import-Module ../lib/Q3Rcon.psm1
Function Get-ConnFromPSD1 {
$configpath = Join-Path $PSScriptRoot "config.psd1"
return Import-PowerShellDataFile -Path $configpath
}
try {
$conn = Get-ConnFromPSD1
$rcon = Connect-Rcon -hostname $conn.host -port $conn.port -passwd $conn.passwd
$rcon.Map()
"Rotating the map..."
$rcon.MapRotate()
Start-Sleep -Seconds 3 # wait for map to rotate
$rcon.Map()
}
finally {
Disconnect-Rcon -rcon $rcon
}