Raised This Month: $ Target: $400
 0% 

Connect to server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-25-2010 , 05:37   Re: Connect to server
Reply With Quote #1

Quote:
Originally Posted by platzpatrone View Post
PHP Code:
 <?php

include ("../settings.php");
include (
"rcon_hl_net.inc");

function 
com_server$server_ip$server_port$server_rcon ) {

    
$server = new Rcon();
    
$server->Connect($server_ip$server_port$server_rcon);

    
$infos $server->Info();
    if( 
$infos ) {
        
$players $server->Players();
    }

    
$result = array(
        
"cur_players"    => $infos[activeplayers], 
        
"max_players"    => $infos[maxplayers],
        
"players"    => ""
    
);

    
$server->disconnect();

    return 
$result;

}

$server_info com_server($server_ip$server_port$server_rcon);

echo 
"<pre>";
print_r($server_info);
echo 
"</pre>";
echo 
"<br>";
echo 
"<br>";
echo 
"My active players: ".$server_info['cur_players'];
echo 
"<br>";
echo 
"My max players: ".$server_info['max_players'];
 

?>
;)

for such information u didnt need rcon, but i dont know how ur class works so i cant tell
u if u need it with it or not
rcon_hl_net from amxbans but still doesn`t work. For you this code work without rcon_hl_net.inc?

With rcon_hl_net.inc :
[IMG]http://img828.**************/img828/1559/72373760.png[/IMG]

Last edited by Debesėlis; 10-25-2010 at 05:45.
Debesėlis is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 10-25-2010 , 05:51   Re: Connect to server
Reply With Quote #2

it works as u showed it on the screenshot.

ur server has maxplayers of 32 but there isnt anyone connected yet, so the current players is 0

just join to your server and run the script again u will see there is

current players 1
and
max players 32
platzpatrone is offline
8088
Veteran Member
Join Date: Jan 2008
Old 10-24-2010 , 21:24   Re: Connect to server
Reply With Quote #3

Quote:
Originally Posted by Debesėlis View Post
I think this code wrong...
That's hard to judge since we can't see the contents of the included files.

But anyway, you don't need rcon to display the amount of current and maximum players. Here's a start: http://developer.valvesoftware.com/wiki/Server_queries
If that doesn't work for you, try something like lgsl, phgstats or GameQ.
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-25-2010 , 05:56   Re: Connect to server
Reply With Quote #4

Yes with rcon works. Thank you

Last edited by Debesėlis; 10-25-2010 at 07:37.
Debesėlis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode