Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 General (https://postpacific.mmorpg-game.online/forumdisplay.php?f=31)
-   -   C4 CacheD, 2012 port commands (https://postpacific.mmorpg-game.online/showthread.php?t=5371)

Kenjiro 22.09.2006 06:20

Any lin2error.txt? Or anything in '/err' log?

FidoW 22.09.2006 13:49

-- Deleted --

dinesat4 11.10.2006 19:15

Any idea from Telnet?

Stazis 12.10.2006 10:51

CLog::Add -> CLog::AddV -> Log::AddV - vswprintf_s
hm - it could not make log record into console ...

Ollisso 22.10.2006 20:17

Does anybody know what is packet format for:
- change subjob ?
- move character to different account ?

Which data should I give to CacheD ?
(just order of them :)

Namenlos 25.10.2006 22:23

$buf .= tounicode("Web1"); //who


Please explain what is TOUNICODE function? Your own? If it is your own please share this code!

Also if anyone can help with PHP coding of commands CacheD... we neeeed it =)

m4rk 25.10.2006 22:36

it's in the first example post Namenlos...

Code:

function tounicode($string) {
    $rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
    return($rs.chr(0).chr(0));
}


Elsir 26.10.2006 06:50

Please help with adding a builder rights to a existing player account.
#3 SetBuilderCharacterPacket("ddS")
The third argument is any string in unicode?
Must I add '1' at the end of the packet as in the AddItem packet?

Mark20 26.10.2006 08:25

PHP Code:

<?
function SetBuilderCharacterPacket($char_id, $builder_level) {
    
$fp = fsockopen("127.0.0.1", "2012", $errno, $errstr, 5); $rs = "x";
    if (!
$fp) die("<script>alert('Error connecting to cached: $errstr
[server down??]')</script>"
);

    
$buf = pack("c", 3); // 3 = SetBuilderCharacterPacket();
    
$buf .= pack("i", $char_id);
    
$buf .= pack("i", $builder_level);

    
fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
    
$len = unpack("v", 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);
}
?>


sct 27.10.2006 04:19

Gah, I can get EVERY function to work besides additem2... it isn't reporting any errors. I did the adminid thing... just no errors now. it connects to the cache and disconnects and no item is created.

Kenjiro 27.10.2006 07:09

Make sure You have working itemdata.txt in your CachedScript directory. My additem2 php code:

$cached_op = pack ( "cVVVVVVVVVV", 55, $char_id, $warehouse, $item_type, $amount, $enchant, $eroded, $bless, $ident, $wished, 1 );
$cached_op .= ansi2unicode ( "yourwebuserorwhatever" );
$ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );

It works.

Majesty 27.10.2006 09:10

What about 67 AddSkillsPacket("dSd") ?
When trying to add all skills, nothing happens. Also, no errors in CacheD.
CacheD returns "1".

Code:

function cached_new($buf){
global $cached_ip,$cached_port;
$fp = fsockopen($cached_ip, $cached_port, $errno, $errstr, 5); $rs = "x";
if(!$fp)return 0;
        else{
                fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
    $len = unpack("v", 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]; }
    stream_set_timeout($fp, 2);
    $answ=$rs;
    fclose($fp);
    return "$answ";
  }
 }

Code:

function set_skill_all_char($id,$char_name){
 
  kick_char($id);
 
  $buf = pack("c", 67); // 67 = AddSkillsPacket("dSd");
  $buf .= pack("i", $id); //char_id
        $buf .= tounicode ( "GM" );
        $buf .= pack("i", 0);
 
  $answ=cached_new($buf); 
  if($answ==="x1")return "<font class=log_number>$char_name</font> successfully got all skills.";
  else return "<font color=red>Error:</font><font class=log_text>$answ</font> giving all skills to <font class=log_number>$char_name</font>.";
}


sct 27.10.2006 14:49

Quote:

Originally Posted by Kenjiro (Post 70771)
Make sure You have working itemdata.txt in your CachedScript directory. My additem2 php code:

$cached_op = pack ( "cVVVVVVVVVV", 55, $char_id, $warehouse, $item_type, $amount, $enchant, $eroded, $bless, $ident, $wished, 1 );
$cached_op .= ansi2unicode ( "yourwebuserorwhatever" );
$ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );

It works.

Yeah I am pretty confident there is nothing wrong with my code. It has to be something on the cache side but I cant figure out what. Cache still reports no error... so I dont know what to do xD

Kenster 27.10.2006 15:16

When trying the code, no error is reported but it doesn't work. Simply to load the itemdata just put in the folder and your good to go right? I have itemname-e.txt itemdata.txt and itemcache.txt all in there, but no item is loaded with the PHP your provided. I do get recognition of it attempting in the CACHE

Namenlos 28.10.2006 20:56

What about Char Ban?
This script can not do that. Please help!


Quote:

$name = "charname"; //charname
$hour = "24"; // ban hours
function ban_char($name, $hour) {
$fp = fsockopen("127.0.0.1", "2012", $errno, $errstr, 5); $rs = "x";
if (!$fp) die("<script>alert('Error connecting to cached: $errstr
[server down??]')</script>");

$buf = pack("c", 39);
$buf .= pack("i", $char_id);
$buf .= pack("i", $name);
$buf .= tounicode("GM1");

fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
$len = unpack("v", 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);
}

hel 28.10.2006 21:49

Namenlos:
Your php-script invalid...

Where is a function calling?
-> echo (ban_char($name, $hour));

Where $char_id variable defined?
-> is there must be name or char_id?
-> if $name, then you must convert it to unicode tounicode($name);
-> if $char_id, then you have error in function arguments...

You have error in a packet data... Because you're using packet for ChangeCharNamePacket.
-> you must know right packet structure (with all parameters, which sended to cached)
-> function ban_char($name, $hour)
-> $buf = pack("c", 39);
-> $buf .= pack("i", $char_id);
-> $buf .= pack("i", $name);
-> $buf .= tounicode("GM1");
-> it's what you must edit... I can't help with structure, because I can't understand, which parameters used for that function...

Namenlos 28.10.2006 22:41

Quote:

Originally Posted by hel (Post 70890)
Where is a function calling?
-> echo (ban_char($name, $hour));

after this script. Didn't post it here.

Quote:

Originally Posted by hel (Post 70890)
Where $char_id variable defined?
-> is there must be name or char_id?
-> if $name, then you must convert it to unicode tounicode($name);
-> if $char_id, then you have error in function arguments...

I sent charname as $char_id variable. I try to convert. Its converted but still not work.
I POSTED WRONG CODE. I mean

$buf = pack("c", 39);
$name = tounicode($name);
$buf .= pack("i", $name);
$buf .= pack("i", $hour);


39 is the packet for BanChar, look at the first post. Changing name is 4th packet.

Namenlos 29.10.2006 02:03

I am sorry for my posts.
This is right code.

Code:


$hour = 48; //ban hour
$char_id = 123; // ID OF CHAR

function ban_char($char_id, $hour) {
$fp = fsockopen("127.0.0.1", "2012", $errno, $errstr, 5); $rs = "x";
if (!$fp) die("<script>alert('Error connecting to cached: $errstr
[server down??]')</script>");

    $buf = pack("c", 39); // packet for character ban
        $buf .= pack("i", $char_id); //char_id
        $buf .= pack("i", $hour); //hours of ban

    fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
    $len = unpack("v", 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);
}


Kenster 30.10.2006 04:34

For anyone reading this thread, AddItem2 doesn't work, so don't waste your time. Everything is ok, ban char check online status, ect.

Just wanted to make an update so you dont waste your time like I did.

Majesty 30.10.2006 04:42

Quote:

Originally Posted by Kenster (Post 70986)
For anyone reading this thread, AddItem2 doesn't work, so don't waste your time.

Why? Works good for me.

Quote:

function add_item_to_char($id,$item_type,$amount,$enchant,$ char_name){

kick_char($id);

$buf = pack("c", 55); // 55 = AddItem2Packet();
$buf .= pack("i", $id); //char_id
$buf .= pack("i", 0);
$buf .= pack("i", $item_type); //item_type
$buf .= pack("i", $amount); //item_amount
$buf .= pack("i", $enchant); //enchant
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 1);
$buf .= tounicode ( "GM" );

$answ=cached_new($buf);

if($answ==="x1")return "<font class=log_number>$char_name</font> successfully got an item.";
else return "<font color=red>Error:</font><font class=log_text></font> giving item to <font class=log_number>$char_name</font>.";
}

Kenjiro 30.10.2006 08:05

Quote:

Originally Posted by Kenster (Post 70986)
For anyone reading this thread, AddItem2 doesn't work, so don't waste your time. Everything is ok, ban char check online status, ect.

Just wanted to make an update so you dont waste your time like I did.

Do not tell lies, it works as hell:
PHP Code:

function l2_additem2 ( $char_id, $warehouse, $item_type, $amount, $enchant, $eroded, $bless, $ident, $wished ) {
  
// 55 - AddItem2, char_id, warehouse, item_type, amount, enchant, eroded, bless, ident, wished
  
$cached_op = pack ( "cVVVVVVVVVV", 55, $char_id, $warehouse, $item_type, $amount, $enchant, $eroded, $bless, $ident, $wished, 1 );
  
$cached_op .= ansi2unicode ( "webadmin" );
  
$ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
  return ( 
$ret_string );
} 


AHTUKULLEP 30.10.2006 08:36

//ENG
PLZ help me, what the need packet for stopsay(BanChat) player???

//RUS
Какой пакет нужен чтобы банить чат у игрока ???

hel 30.10.2006 08:57

PunishCharPacket

AHTUKULLEP 30.10.2006 11:15

tnx
:)
//RUS
Большое спасибо!

Stinker 30.10.2006 12:25

help whis pakets to set_noobless and set_hero

#106 SetNoblessPacket("ddS")
#107 SetHeroPacket("ddS")
not work


All times are GMT. The time now is 17:00.