View Single Post
Old 06.07.2005, 19:52   #7
supplier
Архивный участник
 
Join Date: Jul 2005
Posts: 11
Default

I've got working example, but the thing is - works almost everything except add_item.
What's wrong with it?
Deleting items, adding skills, name change, ban and etc works perfectly, but add_item doesn't work.
If the character is online there is error - 07, if it's offline then cached says- 01, but there item is not added

I'm using simple php-function:

[php:1:e3085bb60d]
<?

$char_name = "probe";
$ownerId = 24;

// $out = "5"."\t".$char_name."\t"."\r\n"; // kick
// $out = "5\t{$char_name}\t\r\n"; // kick
// $out = "6\t{$char_name}\t5\t5\t\r\n"; // skill add
// $out = "4\tprobe2\tprobe\t\r\n"; // CHANGE_CHARACTER_NAME
// $out = "39\ttester\t1\t\r\n"; // BAN_CHAR
// $out = "50\tasd\ttester\t1\t1\t\t\t\t\r\n"; // MAN_ANNOUNCE ?
// $out = "45\tprobe\t\t\r\n"; // SEND_HOME ?
// $out = "12\tprobe\t0\t57\t10\t0\t0\t0\t0\t0\t\t\r\n"; // ADD_ITEM
// $out = "12\tprobe\t0\t1148\t1\t0\t0\t0\t0\t0\t\t\r\n" ; // ADD_ITEM
// $out = "12\tprobe\t0\t4189\t1\t0\t0\t0\t0\t0\ttester\t\r\ n"; // ADD_ITEM
$out = "12\tprobe\t0\t57\t10\t0\t0\t0\t0\t0\ttester\r \n"; // ADD_ITEM



cached_query ( $out );


function cached_query( $out )
{
$fp = fsockopen("xx.xx.10.0", 2009, $errno, $errstr);

if (!$fp)
{
echo "$errstr ($errno)
\n";
} else
{
fwrite($fp, $out);
stream_set_timeout($fp, 5);
$answ = fgets($fp,8);

if ( $answ == 1)
{
print"
Success Answer = {$answ}
";
} else
{
print"
Error Answer = {$answ}
";
}
}

fclose($fp);
echo $out;

}
?>
[/php:1:e3085bb60d]


Maybe the problem with wrong format of add_item $out string?
Has anyone example with 100% working string?
supplier is offline