Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detecting tv_autorecord at game start #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/eBot/Match/Match.php
Original file line number Diff line number Diff line change
Expand Up @@ -2485,12 +2485,18 @@ private function processRoundStart(\eBot\Message\Type\RoundStart $message)

if ($this->waitRoundStartRecord) {
$record_name = $this->match_id . "_" . \eTools\Utils\Slugify::cleanTeamName($this->teamAName) . "-" . \eTools\Utils\Slugify::cleanTeamName($this->teamBName) . "_" . $this->currentMap->getMapName();

// Disable running autorecord to use eBots version.
$text = $this->rcon->send("tv_autorecord");
if (preg_match('!"tv_autorecord" = "(?<value>.*)"!', $text, $match)) {
if ($match["value"] == 1) {
Logger::log("Stopping running records (tv_autorecord).");
$this->rcon->send("tv_autorecord 0; tv_stoprecord");
}
Logger::log("Checking for tv_autorecord: " . $text);
// Check if $text contains the desired format
if (strpos($text, "true") !== false) {
// Log a message and stop running records
Logger::log("Stopping running records (tv_autorecord).");
$this->rcon->send("tv_autorecord 0; tv_stoprecord");
}
else {
Logger::log("Could not detect a running tv_autorecord.");
}

Logger::log("Launching record $record_name");
Expand Down