Jump to content

Get players with PHP?


xXMADEXx

Recommended Posts

Posted

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.

Posted
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
Posted

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)

Posted

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.

Posted

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?

Posted
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
Posted

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).

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...