xXMADEXx Posted December 16, 2013 Posted December 16, 2013 Hi guys. In PHP, is there a way to get the number of players and the server status, without any scripting on the server? Like how game-state.eu works. Thanks.
Cadu12 Posted December 16, 2013 Posted December 16, 2013 Edit: That's why you are in client, so how is possible getting players without server? Its not possible, you should have to make script.
MTA Team jhxp Posted December 16, 2013 MTA Team Posted December 16, 2013 You should be able to do that with GameQ: http://gameq.sourceforge.net
codeluaeveryday Posted December 16, 2013 Posted December 16, 2013 I've tried using GameQ, it didn't work when I used it, I'm pretty sure gameQ is outdated / depreciated.
xXMADEXx Posted December 16, 2013 Author Posted December 16, 2013 Edit: That's why you are in client, so how is possible getting players without server? Its not possible, you should have to make script. That's how I wonder how game-state.eu did it... Is there a function of some sort in the MTA PHP SDK? I've tried using GameQ, it didn't work when I used it, I'm pretty sure gameQ is outdated / depreciated. Yea, I tried it to, didn't work.
MTA Team jhxp Posted December 16, 2013 MTA Team Posted December 16, 2013 Okay, please try the newer GameQ fork then. You can download it by pressing the 'Download ZIP' button at the bottom of the right panel of this page: https://github.com/Austinb/GameQ Make sure that you use ASE port as the server port in your queries. It works fine for me as you can see in an example query below: http://www.jhxp.net/personal/abc/test-query.php (example query for the =PCP= Minigames server) http://www.jhxp.net/personal/abc/test-query.txt (source code)
codeluaeveryday Posted December 16, 2013 Posted December 16, 2013 I was using the ASE port at the time, I will test the forked version too.
MIKI785 Posted December 16, 2013 Posted December 16, 2013 GameQ does work... im using it on my web: http://mshost.cz so your php script is wrong then. There is no need for any Lua scripting at all.
xXMADEXx Posted December 16, 2013 Author Posted December 16, 2013 I tried the exact code you sent me: http://revolution-scripts.com/files/pag ... ervers.php but, it gives the error. I think it's the ASE port thing but I cannot be sure. Anyway to check it?
codeluaeveryday Posted December 16, 2013 Posted December 16, 2013 I'm with Xxmade, I get the same issue. Even the examples don't do it correctly, the examples all say that the server did not respond, I then added the mta server with the examples and still no result: $servers = array( array( 'id' => 'mtasa', 'type' => 'Mta', 'host' => '80.241.211.36:22123', ) ); -- original port was 22000, ase port = +123 == 22123. I don't have any issues with PHP, it's quite easy.
[M]ister Posted December 16, 2013 Posted December 16, 2013 Simple mode using the game-state.eu <?php //Script By:MaligNos $url = 'http://www.game-state.eu/94.23.251.227:22006/'; $site = file_get_contents($url); $name1 = explode('', $site); $name2 = explode('',$name1[1]); $name = $name2[0]; $data1 = explode('', $site); $data2 = explode('',$data1[1]); $data = $data2[0]; $cotacao1 = explode('', $site); $cotacao2 = explode('',$cotacao1[1]); $cotacao = $cotacao2[0]; print 'Server name: '.$name.' State: '.$data.' Players: '.$cotacao; ?> Edit: I always wanted to know how it prints the status of the game in a picture, anyone have any idea about this?
myonlake Posted December 16, 2013 Posted December 16, 2013 Edit: I always wanted to know how it prints the status of the game in a picture, anyone have any idea about this? It's made with PHP's image functions. http://www.php.net/manual/en/book.image.php
xXMADEXx Posted December 16, 2013 Author Posted December 16, 2013 Simple mode using the game-state.eu <?php //Script By:MaligNos $url = 'http://www.game-state.eu/94.23.251.227:22006/'; $site = file_get_contents($url); $name1 = explode('', $site); $name2 = explode('',$name1[1]); $name = $name2[0]; $data1 = explode('', $site); $data2 = explode('',$data1[1]); $data = $data2[0]; $cotacao1 = explode('', $site); $cotacao2 = explode('',$cotacao1[1]); $cotacao = $cotacao2[0]; print 'Server name: '.$name.' State: '.$data.' Players: '.$cotacao; ?> Edit: I always wanted to know how it prints the status of the game in a picture, anyone have any idea about this? I didn't want to use a remote server..
MTA Team jhxp Posted December 16, 2013 MTA Team Posted December 16, 2013 csmit195: I have just noticed that for some reason GameQ doesn't always retrieve the query data from the server correctly. Try refreshing the page a few times or increase the 'timeout' parameter. Also, if you have an outdated server you might want to update it to the latest 1.3.4 build (R3 (build 5927) - Updated 14th October 2013 @ http://linux.multitheftauto.com/ or the latest version from the main page for windows servers).
[M]ister Posted December 16, 2013 Posted December 16, 2013 It's made with PHP's image functions. http://www.php.net/manual/en/book.image.php Thanks friend.
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