Raised This Month: $105 Target: $400
 26% 

RCON Player Info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xRENN1Ex
Junior Member
Join Date: Dec 2019
Old 01-04-2020 , 07:48   RCON Player Info
Reply With Quote #1

Code:
		public function GetPlayers( )
		{
			if( !$this->Connected )
			{
				throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
			}
			
			$this->GetChallenge( self::A2S_PLAYER, self::S2A_PLAYER );
			
			$this->Socket->Write( self::A2S_PLAYER, $this->Challenge );
			$Buffer = $this->Socket->Read( 14000 ); // Moronic Arma 3 developers do not split their packets, so we have to read more data
			// This violates the protocol spec, and they probably should fix it: https://developer.valvesoftware.com/wiki/Server_queries#Protocol
			
			$Type = $Buffer->GetByte( );
			
			if( $Type !== self::S2A_PLAYER )
			{
				throw new InvalidPacketException( 'GetPlayers: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
			}
			
			$Players = [];
			$Count   = $Buffer->GetByte( );
			
			while( $Count-- > 0 && $Buffer->Remaining( ) > 0 )
			{
				$Player[ 'Id' ]      = $Buffer->GetByte( ); // PlayerID, is it just always 0?
				$Player[ 'Name' ]    = $Buffer->GetString( );
				$Player[ 'Frags' ]   = $Buffer->GetLong( );
				$Player[ 'Time' ]    = (int)$Buffer->GetFloat( );
				$Player[ 'TimeF' ]   = GMDate( ( $Player[ 'Time' ] > 3600 ? "H:i:s" : "i:s" ), $Player[ 'Time' ] );
				
				$Players[ ] = $Player;
			}
			
			return $Players;
		}


health, deaths, weapons How do I add?


$Player[ 'Health' ] = ?
$Player[ 'Deaths' ] = ?
$Player[ 'Weapon' ] = ?
xRENN1Ex is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-05-2020 , 02:46   Re: RCON Player Info
Reply With Quote #2

That looks like PHP. This forum is for requesting AMX Mod X plugins. It's probably more appropriate to post in the off-topic section or maybe the HLDS subforum if you're actually messing with the server communication protocol.
__________________
fysiks is offline
xRENN1Ex
Junior Member
Join Date: Dec 2019
Old 01-06-2020 , 02:05   Re: RCON Player Info
Reply With Quote #3

OK! Sorry...
xRENN1Ex is offline
Reply


Thread Tools
Display Modes

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 21:57.


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