Half of the funcions you say you use you dont even put up here. Thats why it doesn't work I guess. l2_cached_push ect. Please include these funcions.
Code:
function additem($p0) {
$fp = fsockopen("XXXXX", "2012", $errno, $errstr, 5);
$rs = "x";
if (!$fp) die("Error connecting to cached: $errstr");
$buf = pack("c", 55); // 55 = AddItem2Packet();
$buf .= pack("i", $p0); //char_id
$buf .= pack("i", 0);
$buf .= pack("i", 1); //item_type
$buf .= pack("i", 1); //item_amount
$buf .= pack("i", 0); //enchant
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 1);
$buf .= tounicode("web1"); // remember to add function
fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
$len = unpack("i", fread($fp, 2));
$rid = unpack("c", fread($fp, 1));
for ($i = 0; $i < (($len[1]-4) / 4); $i++)
{
$read = unpack("i", fread($fp, 4));
$rs .= $read[1];
}
fclose($fp);
return($rs);
}
This doesnt work.