AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   RCON Player Info (https://forums.alliedmods.net/showthread.php?t=320687)

xRENN1Ex 01-04-2020 06:48

RCON Player Info
 
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' ] = ?

fysiks 01-05-2020 01:46

Re: RCON Player Info
 
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.

xRENN1Ex 01-06-2020 01:05

Re: RCON Player Info
 
OK! Sorry...


All times are GMT -4. The time now is 17:58.

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