mommytellme Posted June 20, 2014 Share Posted June 20, 2014 I welcome! I have a problem with GameQ on my side; I want to charge the number of players on the server and amount of slots. It is my code: <?php include("head.php"); require_once 'GameQ.php'; $servers['Polski Realny Serwer'] = array('mtasa', '178.19.106.171', '22106 +123'); // dodajemy serwer //inicjalizajca $gq = new GameQ; //dodawanie zdefiniowanych serwerów $gq->addServers($servers); //proszenie o dane i wypisywanie ich try { $data = $gq->requestData(); } //wyłapywanie błędów catch (GameQ_Exception $e) { echo 'ZNALEZIONO BŁĄD W KODZIE!'; } // ?> <body> <div style="text-align: center;"> <div class="page-header"> <h1>Wybierz serwer </h1> <br> </div> <div class="alert alert-success">Muzyka: Bingo Players ft. Far East Movement - Get Up</div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <button type="button" onclick="document.location.href='prs.php'" class="btn btn-default"><h1>Polski Realny Serwer</h1><br><h2>Graczy online: <?php echo ($data["num_players"] ."/". $data["max_players"]);?></h2></button> </div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <button type="button" onclick="document.location.href='ts.php'" class="btn btn-default"><h1>TeamSpeak 3</h1><br><h2>Graczy online: x/10</h2></button> <EMBED src="song.mp3" width="0" height="0" loop="4"> </EMBED> </div> </div> </body> </html> Errors: http://zapodaj.net/199408dbbbe24.png.html (It is line 45) Please, help me Link to comment
Mr.unpredictable. Posted June 20, 2014 Share Posted June 20, 2014 (edited) I welcome! I have a problem with GameQ on my side; I want to charge the number of players on the server and amount of slots. It is my code: <?php include("head.php"); require_once 'GameQ.php'; $servers['Polski Realny Serwer'] = array('mtasa', '178.19.106.171', '22106 +123'); // dodajemy serwer //inicjalizajca $gq = new GameQ; //dodawanie zdefiniowanych serwerów $gq->addServers($servers); //proszenie o dane i wypisywanie ich try { $data = $gq->requestData(); } //wyłapywanie błędów catch (GameQ_Exception $e) { echo 'ZNALEZIONO BŁĄD W KODZIE!'; } // ?> <body> <div style="text-align: center;"> <div class="page-header"> <h1>Wybierz serwer </h1> <br> </div> <div class="alert alert-success">Muzyka: Bingo Players ft. Far East Movement - Get Up</div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <button type="button" onclick="document.location.href='prs.php'" class="btn btn-default"><h1>Polski Realny Serwer</h1><br><h2>Graczy online: <?php echo ($data["num_players"] ."/". $data["max_players"]);?></h2></button> </div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <button type="button" onclick="document.location.href='ts.php'" class="btn btn-default"><h1>TeamSpeak 3</h1><br><h2>Graczy online: x/10</h2></button> <EMBED src="song.mp3" width="0" height="0" loop="4"> </EMBED> </div> </div> </body> </html> Errors: http://zapodaj.net/199408dbbbe24.png.html (It is line 45) Please, help me character "a" not allowed in prolog Edited June 20, 2014 by Guest Link to comment
Mr.unpredictable. Posted June 20, 2014 Share Posted June 20, 2014 The same mistake send me the whole html from till in pm i willl check for errors Link to comment
Mr.unpredictable. Posted June 20, 2014 Share Posted June 20, 2014 this is going through my head the only minor error i can see in this html is <div style="text-align: center;"> <div class="page-header"> <h1>Wybierz serwer </h1> <br> </div> line 35 to 39 you opened div tag twice but closed it only once, but it's minor error it shoul'nt create that problem which you are getting, maybe someother error which i'm not getting. also replace 45 line with this and try <body> <button type="button" onclick="document.location.href='prs.php'" class= "btn btn-default"> <h1>Polski Realny Serwer</h1><br /> <h2>Graczy online: <?php echo ($data["num_players"] ."/". $data["max_players"]);?></h2></button> Link to comment
mommytellme Posted June 20, 2014 Author Share Posted June 20, 2014 Next error This is the new code: <?php include("head.php"); require_once 'GameQ.php'; $server = $_GET['server']; $game = $_GET['game']; // Jesli nie podano ip lub gry if (isset($server) && !empty($server) && isset($game) && !empty($game)) { // podzielenie adresu na ip oraz port list($ip, $port) = explode(":", $server); } list($ip, $port) = explode(":", $server); $gq = new GameQ(); $gq->addServer('serwer', array('mtasa', '178.19.106.171', '22106')); $gq->setOption('timeout', 200); $gq->setFilter('normalise'); $gq->setFilter('sortplayers', 'gq_ping'); $results = $gq->requestData(); if($results['serwer']['gq_hostname']=="") { $hostname = "Serwer OFFLINE"; $players = "x"; $playersmax = "x"; $map = "Offline"; } else { $hostname = $results['serwer']['gq_hostname']; $players = $results['serwer']['gq_numplayers']; $playersmax = $results['serwer']['gq_maxplayers']; $map = $results['serwer']['gq_mapname']; } $players = ($results['serwer']['gq_numplayers'] == '') ? 0 : $results['serwer']['gq_numplayers']; ?> <body> <div style="text-align: center;"> <div class="page-header"> <h1>Wybierz serwer </h1> <br> </div> <div class="alert alert-success">Muzyka: Bingo Players ft. Far East Movement - Get Up</div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <body> <button type="button" onclick="document.location.href='prs.php'" class= "btn btn-default"> <h1>Polski Realny Serwer</h1><br /> <h2>Graczy online: <?php echo ($data["num_players"] ."/". $data["max_players"]);?></h2></button> </div> <div class="btn-group btn-group-justified"> <div class="btn-group"> <button type="button" onclick="document.location.href='ts.php'" class="btn btn-default"><h1>TeamSpeak 3</h1><br><h2>Graczy online: x/10</h2></button> <EMBED src="song.mp3" width="0" height="0" loop="4"> </EMBED> <!-- Ahh te moje umiejetnosci programowania w HTML ;p (+ rolora ) --> </div> </div> </body> </html> Errors: Notice: Undefined index: server in D:\xampp\htdocs\index.php on line 5 Notice: Undefined index: game in D:\xampp\htdocs\index.php on line 6 Notice: Undefined offset: 1 in D:\xampp\htdocs\index.php on line 15 Link to comment
Mr.unpredictable. Posted June 20, 2014 Share Posted June 20, 2014 (edited) Errors: Notice: Undefined index: server in D:\xampp\htdocs\index.php on line 5 Notice: Undefined index: game in D:\xampp\htdocs\index.php on line 6 Notice: Undefined offset: 1 in D:\xampp\htdocs\index.php on line 15 these errors only appears when your variable is not properly set, it's because of your PHP error reporting settings, sorry i can't fix it Edited June 20, 2014 by Guest Link to comment
mommytellme Posted June 20, 2014 Author Share Posted June 20, 2014 My friend is helping me to fix it, at the moment is going well but is showing that he is 0 / 16 and is 10 / 16 ;p Thanks for help Link to comment
mommytellme Posted June 20, 2014 Author Share Posted June 20, 2014 He is already acting, is thanking for help!: D Link to comment
Spajk Posted June 21, 2014 Share Posted June 21, 2014 https://www.mediafire.com/?apcpl89q2aw22rw This is a little script for getting server stats, extracted right from the GameQ. To use it simply include it and use the function "scan_server($ip, $port)". Note: For port, use the ASE port number. 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