diff --git a/src/GameQ/Protocols/Cfx.php b/src/GameQ/Protocols/Cfx.php index 0aa92659..957f4f64 100644 --- a/src/GameQ/Protocols/Cfx.php +++ b/src/GameQ/Protocols/Cfx.php @@ -115,9 +115,10 @@ public function beforeSend(Server $server) $GameQ->addServer([ 'type' => 'cfxplayers', 'host' => "$server->ip:$server->port_query", + 'id' => 1, ]); $results = $GameQ->process(); - $this->PlayerList = isset($results[0]) && isset($results[0][0]) ? $results[0][0] : []; + $this->PlayerList = isset($results[1]) && isset($results[1]['players']) ? $results[1]['players'] : []; } /** diff --git a/src/GameQ/Protocols/Cfxplayers.php b/src/GameQ/Protocols/Cfxplayers.php index 02897c38..ed5cb4b1 100644 --- a/src/GameQ/Protocols/Cfxplayers.php +++ b/src/GameQ/Protocols/Cfxplayers.php @@ -95,7 +95,7 @@ public function processResponse() } // Implode and rip out the JSON - preg_match('/\{(.*)\}/ms', implode('', $this->packets_response), $matches); + preg_match('/\[\{(.*)\}\]/ms', implode('', $this->packets_response), $matches); // Return should be JSON, let's validate if (!isset($matches[0]) || ($json = json_decode($matches[0], true)) === null) {