Php Command
#1

Hi everybody, i just have a php script to send Rcon commands to the server.

The thing is, if i send "say lalala", players see the command, but it's not printed in the console.

The code is this:

PHP код:
<?
 set_time_limit 
(30) ;
 
$ip = $_POST['ip']; if (!$ip) die();
 
$port = $_POST['port']; if (!$port) die();

 
$pass = $_POST['pass']; if (!$pass) die();
 
$passlen = strlen($pass);
 
$cmd = $_POST['cmd']; if (!$cmd) die();
 
$cmdlen = strlen($cmd);

 
$packet = 'SAMP';
 
$packet .= chr(strtok($ip, '.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));
 
$packet .= chr($port & 0xFF).chr($port >> 8 & 0xFF);
 
$packet .= "x";
 
$packet .= chr($passlen & 0xFF).chr($passlen >> 8 & 0xFF).$pass;
 
$packet .= chr($cmdlen & 0xFF).chr($cmdlen >> 8 & 0xFF).$cmd;

 
$fp =fsockopen('udp://' . $ip, $port, $errno, $errstr);
 
fwrite($fp, $packet);
 while(!
feof($fp)) {
  
$str=fread($fp,128);
  
$str=substr($str,13,strlen($str)-13);
  if (!
$str) break;
  echo 
$str."<br>";
  }
 
fclose($fp);
?>
So how could i manage to print those messages?

Thanks to all.

Cheers.
---
Web
Reply
#2

I didn't understand your Question, mate.
Reply
#3

I can't help but;

He has a command that makes him able to
execute RCON-commands on a PHP-website.

The command works, but It doesn't save the command in the logs (with other words, It doesn't do what
Код:
printf("");
would do in PAWN.
Reply
#4

public OnRconCommand(cmd[])
{
printf(cmd);
return 1;
}
Reply
#5

mmm? Just use the site http://sa-mp.mobi

It also works for Computers, and mobiles
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)