PHP check info about a samp server
#1

Hi!
Before starting, i must tell you i'm french, so i've a bad (very bad..) english ...
So, i've download this: https://sampforum.blast.hk/showthread.php?tid=355574
And i added this:
PHP код:
    public function getServerPassword()
    {
        @
fwrite($this->sock$this->assemblePacket("i"));
        
        
fread($this->sock11);
        
        
$serverInfo = array();
        
$serverInfo['password'] = (integer) ord(fread($this->sock1));
        
        return 
$serverInfo['password'];
    } 
But the website tell me:
Warning: fread(): Length parameter must be greater than 0 in C:\xampp\htdocs\SampQuery.class.php on line 112

The script:
PHP код:
    public function getBasicPlayers() {
        @
fwrite($this->sock$this->assemblePacket("c"));
        
fread($this->sock11);
        
$playerCount ord(fread($this->sock2));
        
$players = array();
        if(
$playerCount 0) {
            for(
$i 0$i $playerCount; ++$i) {
                
$strLen ord(fread($this->sock1));
                if(!
$strLen) { echo "Problиme"; } // I've added it, and it appears correctly
                
$players[$i] = array
                (
                    
"name" => (string) fread($this->sock$strLen), // Lign 112
                    
"score" => (integer) $this->toInt(fread($this->sock4))
                );
            }
        }
        return 
$players;
    } 
The do the test on my computer (local) with XAMPP (yes, i've windows..)
If you must more information for help me, tell me it

Thank you in advance, and i hope you understand me!
Bye!

(Move this post if wrong section)
Reply
#2

Why not use the default function in the package called getInfo?
Reply
#3

Because i don't know how get only password value.
I'm newbie about PHP I learn it but i don't understand all ^^
I test different script, and i search eventually errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)