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. The Ultimate Lua Tutorial! | MTA PHP SDK
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. Ingame nick: Cadu12
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 One of the [VCP] leaders // honorary member of the =PCP= gang. Do not PM me your MTA:SA Client / Server support questions, Lua scripting questions, unban requests or server toplist concerns - please ask them here: MTA:SA Support subforum, here: Scripting subforum, here: Ban appeals or here: Servers instead. For other inquiries - please expect delays in replies when messaging me.
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. Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
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. The Ultimate Lua Tutorial! | MTA PHP SDK
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) One of the [VCP] leaders // honorary member of the =PCP= gang. Do not PM me your MTA:SA Client / Server support questions, Lua scripting questions, unban requests or server toplist concerns - please ask them here: MTA:SA Support subforum, here: Scripting subforum, here: Ban appeals or here: Servers instead. For other inquiries - please expect delays in replies when messaging me.
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. Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
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. Lua Scripter Owner of mshost.cz MTA portal.
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? The Ultimate Lua Tutorial! | MTA PHP SDK
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. Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
[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 If I helped you, please click the like button on the right Thanks!
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.. The Ultimate Lua Tutorial! | MTA PHP SDK
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). One of the [VCP] leaders // honorary member of the =PCP= gang. Do not PM me your MTA:SA Client / Server support questions, Lua scripting questions, unban requests or server toplist concerns - please ask them here: MTA:SA Support subforum, here: Scripting subforum, here: Ban appeals or here: Servers instead. For other inquiries - please expect delays in replies when messaging me.
[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