trux_yt Posted December 26, 2021 Share Posted December 26, 2021 Hi, I need to know some code for PHP with gameQ and get a value from online players for an MTA server, does anyone have an idea? Thanks Link to comment
gubi Posted December 26, 2021 Share Posted December 26, 2021 (edited) You can just take the example from their GitHub page, the only thing that you need to know is to set query port ASE, you do that by adding 123 to server port, default server port is 22003, then query port will be 22126. $GameQ = new \GameQ\GameQ(); $GameQ->addServer([ 'type' => 'mta', 'host' => '51.83.184.65:22003', 'options' => [ 'query_port' => 22126, // SERVER PORT + 123 !IMPORTANT ], ]); $results = $GameQ->process(); //print_r($results); // will return all data recieved thru query print_r($results["51.83.184.65:22003"]["gq_numplayers"]); // will return only "gq_numplayers" which is player count, uncomment line above to see more stuff u can put here Feel free to ping me if you need any help Edited December 26, 2021 by gubi Link to comment
trux_yt Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) 4 hours ago, gubi said: You can just take the example from their GitHub page, the only thing that you need to know is to set query port ASE, you do that by adding 123 to server port, default server port is 22003, then query port will be 22126. $GameQ = new \GameQ\GameQ(); $GameQ->addServer([ 'type' => 'mta', 'host' => '51.83.184.65:22003', 'options' => [ 'query_port' => 22126, // SERVER PORT + 123 !IMPORTANT ], ]); $results = $GameQ->process(); //print_r($results); // will return all data recieved thru query print_r($results["51.83.184.65:22003"]["gq_numplayers"]); // will return only "gq_numplayers" which is player count, uncomment line above to see more stuff u can put here Feel free to ping me if you need any help i have this error in the php and i have the folder from GameQ in the directory Fatal error: Uncaught Error: Class 'GameQ\GameQ' not found in C:\xampp\htdocs\asd.php:2 Stack trace: #0 {main} thrown in C:\xampp\htdocs\asd.php on line 2 Edited December 26, 2021 by trux_yt Link to comment
trux_yt Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) (IN THIS FOLDER IS THE PHP FILE) Edited December 26, 2021 by trux_yt Link to comment
gubi Posted December 27, 2021 Share Posted December 27, 2021 (edited) you need to define it at the top of your .php file require_once(__DIR__ . '/Autoloader.php'); Edited December 27, 2021 by gubi Link to comment
trux_yt Posted December 27, 2021 Author Share Posted December 27, 2021 4 hours ago, gubi said: you need to define it at the top of your .php file require_once(__DIR__ . '/Autoloader.php'); thx! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now