View Full Version : C4 CacheD, 2012 port commands
Who knows something about it? :)
Not sure yet, by exploring cached i think commans must be sent as "packet" not string.
Packet can contain only hex numbers, and appear to be that 1st or 2 first bytes is length of "packet". Need more time for exploring.
[cSS] 0x49 -> announce, as far as i remember :D
fairly easy.
you send packets assembled like the standard L2 Format.
open cached in OllyDbg, search for referenced strings, and you'll have everything you need.
gonna give you a short example:
You get this referenced string:
0040FDCA . 68 40805000 PUSH Cached4p.00508040 ; UNICODE "static bool SendHomePacket(CAdminSocket* pSocket, const unsigned char* packet)"
now you scroll down a bit until you get to a call to the disassemble function,
0040FE73 . E8 D8F50200 CALL Cached4p.0043F450
now you look a bit up and find the formatter (it's the second argument to the function),
0040FE6D . 68 645C5000 PUSH Cached4p.00505C64 ; ASCII "dS"
packet formatter 'd' are 4 bytes, assembled to a 32 byte SIGNED integer.
packet formatter 'S' is a sort of PASCAL string. first 2 bytes (or 1 byte, don't remember now...) are the LENGTH (not the size as it is unicode!) of the string, the following bytes are the UNICODE string itself WITHOUT the typical c-string NULL end.
Edit: woop, forgot to say that the complete packet format is not only for example dS, but cdS, c being the packet ID.
Mayii, can you post a sample of formed packet in hex please.
i made 2 funtions for u, make the rest yourself..., cya...
<?php
###############################################
# id | Function Name(Function parms) #
###############################################
#d = int (4 bytes, little endian)
#S = unicode String ending with \0
#f = float
#1 CheckCharacterPacket("dS")
#2 SetCharacterLocationPacket("dddddS")
#3 SetBuilderCharacterPacket("ddS")
#4 ChangeCharacterNamePacket("dSS")
#5 KickCharacterPacket("dS")
#6 AddSkillPacket("dddS")
#7 DelSkillPacket("ddS")
#8 ModSkillPacket("dddS")
#9 SetOnetimeQuestPacket("dddS")
#10 SetQuestPacket("ddd")
#11 DelQuestPacket("ddS")
#12 AddItemPacket()
#13 DelItemPacket("ddddS")
#14 ModItemPacket("ddddddddddS")
#15 ModCharPacket("dddddddS")
#16 ModChar2Packet("dddddddS")
#17 ModCharPledgePacket("dSS")
#18 PunishCharPacket("ddd")
#19 SetBuilderAccountPacket("SdS")
#20 DisableCharacterPacket("ddS")
#21 EnableCharacterPacket("ddS")
#22 GetCharactersPacket()
#23 SetBookMarkPacket("dSddddS")
#24 DelBookMarkPacket("dSS")
#25 DelPledgeCrestPacket("dS")
#26 ModPledgeNamePacket("dSS")
#27 SetProhibitedPacket("dSS")
#28 SeizeItemPacket("ddddS")
#29 ModChar3Packet("dddddddS")
#30 MoveItemPacket("ddddd")
#31 MoveCharacterPacket("ddSS")
#32 CommentWritePacket("dSSS")
#33 CommentDeletePacket("ddS")
#34 DeleteCharPacket("dS")
#35 RestoreCharPacket("ddSS")
#36 PledgeOustPacket("dS")
#37 PledgeChangeOwnerPacket("ddS")
#38 PledgeDeletePacket()
#39 BanCharPacket("ddS")
#40 MoveItem2Packet("ddddS")
#41 PrintAllAccountData()
#42 PrintAllItemData()
#43 CopyCharPacket("dSdSS")
#44 CreatePetPacket("dddS")
#45 SendHomePacket("dS")
#46 ChangePledgeLevelPacket("ddS")
#47 CreatePledgePacket("SdS")
#48 SetSkillAllPacket("dS")
#49 RestoreChar2Packet("dSdSS")
#50 ManAnnouncePacket("ddSS")
#51 ManIntAnnouncePacket("dddSS")
#52 ModWeekPlayPacket("dddS")
#53 SeizeItem2Packet("ddS")
#54 DelItem2Packet("ddS")
#55 AddItem2Packet("dddddddddS")
#56 GetCharacters2Packet("dS")
#57 DelMacroPacket("ddS")
#58 DelMonRaceTicketPacket("dddS")
#59 DelRecipePacket("ddS")
#60 DelLottoPacket()
#61 ModifyPledgePowerPacket("ddSS")
#62 EventPointPacket("df")
#63 GetPledgePacket("dS")
#64 EventPointPacket("df")
#65 CreateCharacterPacket("SSddddddddffddddddddddS")
#66 AddItemsPacket("dSd")
#67 AddSkillsPacket("dSd")
#68 GetCharacters3Packet("dS")
#69 SetSociality("ddS")
#70 SetInstantAnnouncePacket("SS" or "cdS") (??)
#71 DelHennaPacket("ddS")
#72 AddHennaPacket("ddS")
#73 AddHennaPacket("dSddS")
#74 AddHennasPacket("dSd")
#75 GetCastleListPacket("ddSdSdSddd")
#76 ModifyCharPropertyPacket("ddddddddS")
#77 ModifyCharAbilityDeltaPacket("ddddddddS")
#78 ModifyCharAbilityDeltaPacket("ddddddddS")
#79 DelHenna2Packet("dddS")
#80 AddHenna2Packet("dddS")
#81 AddSkill2Packet("ddddS")
#82 DelSkill2Packet("dddS")
#83 ModifySkill2Packet("ddddS")
#84 AddMacroPacket("dSSSdS")
#85 GetSSQStatusPacket("cdddddddddddd")
#86 GetSSQMainEventRecordPacket("dddddddSd")
#87 ModifyDepositedSSQItemPacket("ddddS")
#88 ChangePetNamePacket("ddSS")
#89 ChangeSubJobPacket("ddS")
#90 StopCharPacket("dd")
#91 CancelPersonalShopPacket("dd")
#92 AddMacroInfoPacket("ddddddSS")
#93 CreateCharacter2Packet("SSddddddddffddddddddddddfS")
#94 AddSkills2Packet("dSd")
#95 AddHennas2Packet("dSd")
#96 AddSubjobsPacket("dSd")
#97 GetPledge2Packet("dS")
#98 DelPledgeEmblemPacket("dS")
#99 RegisterAccountPacket("SS")
#100 DelPledgeAnnouncePacket("dS")
#101 SendPrivateAnnouncePacket("dSS")
#102 GetAgitListPacket("dSdSdSdd")
#103 GetPledgeMemberPacket("dS")
#104 EternalBanPacket("dS")
#105 GetCharacters4Packet("dS")
#106 SetNoblessPacket("ddS")
#107 SetHeroPacket("ddS")
#108 SetPartyLocationPacket("ddddS")
#109 ModOlympiadPointPacket("ddddS")
#110 DummyPacket()
$char_id = 3;
$newname = "KciNicK";
printf("The character %s is %s\n", $char_id, CheckCharacterPacket($char_id) == "x1" ? "online" : "offline");
printf("rename character %s to '%s': %s\n", $char_id, $newname, ChangeCharacterNamePacket($char_id, $newname) == "x1" ? "ok" : "error");
function tounicode($string) {
$rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
return($rs.chr(0).chr(0));
}
function CheckCharacterPacket($p0) {
$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", 1); // 1 = CheckCharacterPacket();
$buf .= pack("i", $p0); //char_id
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);
}
function ChangeCharacterNamePacket($p0, $p1) {
$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", 4); // 4 = ChangeCharacterNamePacket();
$buf .= pack("i", $p0); //char_id
$buf .= tounicode($p1); //new char name
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);
}
?>
KciNicK, great thanks!! )))
One more question please...
I have number 1000. 1000 in D it is E8 03 00 00 , right? :)
KciNicK, great thanks!! )))
One more question please...
I have number 1000. 1000 in D it is E8 03 00 00 , right? :)
in little endian, yes...
anyway, the way of writing numbers is cpu arch dependant, first try a simple write(), if that don't work, then start making a function that writes in little endian... but i don't think that u will need one...
Stenly76
12.08.2006, 22:38
Not info for AddItemPacket() and small info for AddItem2Packet (function must use Admin ID)
Please, write the example for this packets.
Old method (12; char_id; warehouse; itemType; itemAmount; enchant; eroded; bless; ident; wished) is incorrect
I can't make this functions working :(
CacheD returns no any byte of relpy, just close connection. In CacheD window appears error: admin server closed(127.0.0.1) error: 997
I trying to kick char id 79, packet is:
0B 00 05 4F 00 00 00 7A 00 00 00
KciNicK, please show yuo "pack" function? thx
not his function.
http://de.php.net/manual/en/function.pack.php
Does anyone knows format of a reply from cacheD? First two bytes are packet length, third byte seems to be packet ID, but what about the rest?
I can't make this functions working
CacheD returns no any byte of relpy, just close connection. In CacheD window appears error: admin server closed(127.0.0.1) error: 997
I trying to kick char id 79, packet is:
0B 00 05 4F 00 00 00 7A 00 00 00
I am LOL ))
Just incorrect PHP code )
Work fine ))
Does anyone knows format of a reply from cacheD? First two bytes are packet length, third byte seems to be packet ID, but what about the rest?
I see it's like in C1.
If you have 1 - all was good.
01, 03, 07 - some errors...
hmm... ADD_ITEM really not work (
CacheD reply is 04...
AddItem format is DDDDDDDDDDD, right?
Error codes from C1 cacheD:
01=SOCKET_INT_ERROR
2=SOCKET_INT_ARGS_NEED
3=SOCKET_INT_ARGS_INVALID
4=SOCKET_INT_CHAR_NOT_FOUNT
5=SOCKET_INT_WAREHOUSE_NOT_FOUNT
6=SOCKET_INT_ACCOUNT_NOT_FOUND
7=SOCKET_INT_CHAR_LOGIN
8=SOCKET_INT_TOO_MANY_CHARS
9=SOCKET_INT_CHAR_INPLEDGE
010=SOCKET_INT_CHAR_PLEDGEOWNER
011=SOCKET_INT_CANNOT_BAN
012=SOCKET_INT_NAME_EXISTS
013=SOCKET_INT_OBSOLETE
014=SOCKET_INT_INVALID_CHARNAME
015=SOCKET_INT_CHAR_NOT_LOGIN
016=SOCKET_INT_SAME_CHAR
017=SOCKET_INT_CHAR_NOTPLEDGE
018=SOCKET_INT_CHAR_PLEDGEMASTER
019=SOCKET_INT_SVR_NOTCONNECTED
020=SOCKET_INT_CREATE_PET_FAIL
021=SOCKET_INT_PLEDGE_EXISTS
022=SOCKET_INT_NO_CHARS
023=SOCKET_INT_INVALID_ANNOUNCEID
024=SOCKET_INT_PLEDGE_NOT_FOUND
025=SOCKET_INT_CASTLE_NOT_FOUND
026=SOCKET_INT_PET_NOT_FOUND
testdude
14.08.2006, 03:42
additem function has been replaced with AddItem2, cos additem was char name, additem2 is char id, and all functions now use char id instead...
AddItem2 work?
I have 01 in cached reply, but no have items in inventory.
AddItem2 work?
I have 01 in cached reply, but no have items in inventory.
You need to insert itemdata in CacheD :)
And AddItem2 format is DDDDDDDDDS
S - any string with not null length, i don't know who what is it )
$buf = pack("c", 55); // 55 = AddItem2Packet();
$buf .= pack("i", 3652); //char_id
$buf .= pack("i", 0); //warehouse
$buf .= pack("i", 57); //item_type
$buf .= pack("i", 1000); //item_amount
$buf .= pack("i", 0); //enchant ?
$buf .= pack("i", 0); //??
$buf .= pack("i", 0); //??
$buf .= pack("i", 0); //??
$buf .= pack("i", 0); //??
$buf .= tounicode("Web1"); //who
Its write?
Items added in tables.
Cacned returns 1, but no item.
nucer you can use AddItem2Packet?
help please
the last S is the name of the admin that do the request, intended for use with l2admin, is the name of the admin logued on that panel... is not needed...
// EDIT //
AddItem2(char_id, ware=1 or char=0, item_id, amount, enchants, eroded, bless, ident, wished, 1);
u need a "1" at the end...
Not work.
Anybody can help?
Not work.
Anybody can help?
it works for me...
testdude
18.08.2006, 15:39
for AddItem the admin id IS needed, it errors otherwise, though for me it refused to work so i hexed the cached to work without admin id xD
$pack=pack("cVVVVVVVVVVV",55,$charid,0,$itemid,$amount,$enchant,0,0,0,0,0,0 );
$out=pack("s",strlen($pack)+2);
$out.=$pack;
^ thats what i did for additem, and before anyone points out that im using V instead of "i", its because "i" is machine dependant, V is 32bit, and i run this on a 64bit server...
scrap512
18.08.2006, 17:54
so anyone can run these commands from anywhere .. isn't that a bit unsafe?
testdude
18.08.2006, 17:57
thats what firewalls are for
// EDIT //
AddItem2(char_id, ware=1 or char=0, item_id, amount, enchants, eroded, bless, ident, wished, 1);
u need a "1" at the end...
Why is that 1 at the end? Are another commands used like that (with addidional 1)?
P.S. If You could explain me why i have error in system logs:
08/20/2006 14:47:xx.xx4, admin server closed(127.0.0.1) error: 997
when command has been executed correctly ?
P.P.S. Sometimes i have:
08/20/2006 14:38:xx.xx5, admin server closed(127.0.0.1) error: 258
Weird... very weird...
testdude
20.08.2006, 14:50
the 1 at the end is the "admin id", also i would like to point out, that error when the socket closes is not an error to do with the function itself, it is just the response from WSAGetLastError()
I have another problem, highest item_type (item id from itemdata) which can be added to database is 7838, everything above it results -> "01". Item is added to database (via 'load items' cached option), but... can not add...
What is weird, that i can add items which are not in database (not in itemcache.txt & loaded), but with item_type <= 7838.
I'm stupid, You know... full cached restart (quit & run) has solved problem... (to be remembered: before asking, try to restart ;))
AgeNT2005
30.08.2006, 15:59
Say if you please id function for Cached for the changes of subjob0_class and deleted all skill
I use translator, sorry.
barabashka
01.09.2006, 14:49
Say if you please id function for Cached for the changes of subjob0_class and deleted all skill
I use translator, sorry.
So, I think you need to know structure of special Cashed Function for changing player profession. Couse, in lin2world>userdata there two rows class and sub_job0. And this two parameters are coordinating player profession. But cashed scripts for changing player's classes are working not correctly. If someone know or understand this problem - plz PM me. Together, we can solve this problem.
I have another problem, highest item_type (item id from itemdata) which can be added to database is 7838, everything above it results -> "01". Item is added to database (via 'load items' cached option), but... can not add...
What is weird, that i can add items which are not in database (not in itemcache.txt & loaded), but with item_type <= 7838.
I'm stupid, You know... full cached restart (quit & run) has solved problem... (to be remembered: before asking, try to restart ;))
I have this exact same problem, I know for a fact the items are added to the table, pllus I have restarted cached several times, but still receiving a code 01 (item not in ItemData table). Any other ideas?
Not work :(
You have original cached or patched "anti /block" ?
I have this exact same problem, I know for a fact the items are added to the table, pllus I have restarted cached several times, but still receiving a code 01 (item not in ItemData table). Any other ideas?
Try to generate itemcache.txt from your client itemname-e.txt and itemdata (quest/stacking flag) files and directly insert data to Itemdata table (in lin2world db) - remember to stop cached before db operations. Try to load generated itemcache. Then check db and restart cached. Should work.
P.S. Remember to have recent itemdata.txt in Your cachedscript directory.
Try to generate itemcache.txt from your client itemname-e.txt and itemdata (quest/stacking flag) files and directly insert data to Itemdata table (in lin2world db) - remember to stop cached before db operations. Try to load generated itemcache. Then check db and restart cached. Should work.
P.S. Remember to have recent itemdata.txt in Your cachedscript directory.
Well, the funny thing is I generated it off the itemdata on server side (so no descriptions) and inserted via the cached update script command. Might try inserting manually and restarting cached to see if this works. Will post results once I get a chance to do this.
I am using the next php script:
<?
$char_id = 8;
printf("giving adena to ", $char_id, additem($char_id) == "x1" ? "ok" : "error");
function additem($p0) {
$fp = fsockopen("127.0.0.1", "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", 57); //item_type
$buf .= pack("i", 1000); //item_amount
$buf .= pack("i", 0); //enchant
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 1);
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);
}
?>
But it doesn't work =(
CacheD:
admin server create socket[127.0.0.1]
[.\adminsocket.cpp][3454] No Admin Id
admin server closed(127.0.0.1) error: 997
Please, help me.
RumanticK
08.09.2006, 13:33
char must be offline, afaik
char must be offline, afaik
No-no, my char is offline..
This error doesn't connect with chars, imho.. <_<
I am using the next php script:
<?
// cut before to shorten message
$buf .= pack("i", 0); //enchant
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 0);
$buf .= pack("i", 1);
$buf .= tounicode ( "webadmin" ); // remember to add function
fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
// cut after to shorten message
?>
But it doesn't work =(
CacheD:
admin server create socket[127.0.0.1]
[.\adminsocket.cpp][3454] No Admin Id
^^^^^^^^^^^^^^^^^^^^^^^^^^
admin server closed(127.0.0.1) error: 997
Please, help me.
Try add admin name. Look above in Your corrected example.
Try to generate itemcache.txt from your client itemname-e.txt and itemdata (quest/stacking flag) files and directly insert data to Itemdata table (in lin2world db) - remember to stop cached before db operations. Try to load generated itemcache. Then check db and restart cached. Should work.
P.S. Remember to have recent itemdata.txt in Your cachedscript directory.
Well, the funny thing is I generated it off the itemdata on server side (so no descriptions) and inserted via the cached update script command. Might try inserting manually and restarting cached to see if this works. Will post results once I get a chance to do this.
Still a no go for any item above 7838, any other ideas?
how I can add builder to player/acc from CacheD?..
Any lin2error.txt? Or anything in '/err' log?
dinesat4
11.10.2006, 19:15
Any idea from Telnet?
CLog::Add -> CLog::AddV -> Log::AddV - vswprintf_s
hm - it could not make log record into console ...
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 =)
it's in the first example post Namenlos...
function tounicode($string) {
$rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
return($rs.chr(0).chr(0));
}
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?
<?
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);
}
?>
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.
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.
What about 67 AddSkillsPacket("dSd") ?
When trying to add all skills, nothing happens. Also, no errors in CacheD.
CacheD returns "1".
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";
}
}
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>.";
}
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
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!
$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);
}
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
Where is a function calling?
-> echo (ban_char($name, $hour));
after this script. Didn't post it here.
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.
$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);
}
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.
For anyone reading this thread, AddItem2 doesn't work, so don't waste your time.
Why? Works good for me.
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>.";
}
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:
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
Какой пакет нужен чтобы банить чат у игрока ???
AHTUKULLEP
30.10.2006, 11:15
tnx
:)
//RUS
Большое спасибо!
help whis pakets to set_noobless and set_hero
#106 SetNoblessPacket("ddS")
#107 SetHeroPacket("ddS")
not work
AHTUKULLEP
30.10.2006, 13:24
Deleted ^)
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.
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.
Namenlos
30.10.2006, 20:50
Who can decode what means "ddddS" or ect? I mean NOT integer(4 bytes) or unicode format.
I mean:
Packet 39 - character ban ("ddS") - ddS its CHAR_ID, HOUR_BAN and NAME. What about other packets?
zekillers
30.10.2006, 21:08
I also have additem2 working.
djvogans
30.10.2006, 21:14
http://img58.imageshack.us/img58/859/afn8.th.jpghttp://img53.imageshack.us/img53/7979/bmi3.th.jpg (http://img58.imageshack.us/my.php?image=afn8.jpg)
credits to russia :)
http://img58.imageshack.us/img58/859/afn8.th.jpghttp://img53.imageshack.us/img53/7979/bmi3.th.jpg (http://img58.imageshack.us/my.php?image=afn8.jpg)
credits to russia :)
I'm also started rewriting this :) My posts - functions for l2z.
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.
...cut code...
This doesnt work.
$cached_ip = "127.0.0.1";
$cached_port = 2012;
function ansi2unicode ( $ansi_str ) {
$unicode_str = "";
for ( $i = 0; $i < strlen ( $ansi_str ); $i++ )
$unicode_str .= $ansi_str [ $i ] . chr ( 0 );
return ( $unicode_str . chr ( 0 ) . chr ( 0 ) );
}
function l2_cached_push ( $cached_packet ) {
// print ( "Unicode: " . wordwrap ( bin2hex ( $cached_packet ), 80, "<br />", 1 ) . "<br />" );
$cached_fptr = @fsockopen ( $GLOBALS [ "cached_ip" ], $GLOBALS [ "cached_port" ], $errno, $errstr, 5 ) or die ( "Error connecting to cached: $errstr [server down??]\n" );
fwrite ( $cached_fptr, $cached_packet );
$array_ret_length = unpack ( "v", fread ( $cached_fptr, 2 ) );
$ret_id = unpack ( "c", fread ( $cached_fptr, 1 ) );
$ret_string = "";
for ( $i = 0; $i < ( ( $array_ret_length [ 1 ] - 4 ) / 4 ); $i++ ) {
$array_read = unpack ( "i", fread ( $cached_fptr, 4 ) );
$ret_string .= $array_read [ 1 ];
}
fclose ( $cached_fptr );
return ( $ret_string );
}
It works.
P.S. L2Z... looks nice... o.O
And for a Permanent BAN? Only a very large value for "$hour" or a specific value?
Thanks
Yeah and I have full C5 with a gold bar and unlimited hershy kisses. anyone can make up bull shit without any proof.
Kenster, You can try http://deo-lan.se/cachedscript.rar if you did not succeed with your code yet.
In general it contains a php script allthough its adepted to be executed from a php shellscript.
You can check the php script if you expect malware, aswell as get your own php.exe and php.ini and php5s.dll if you dont trust them.
In general you only need to press the exec.bat
And it will ask you what charid you want to target (I guess you know how to look up charids ;P)
After that it will ask what itemid (Try 600 since thats avadon boots)
After that it will ask for amount.
If it returns a 1x. It should "most" likly have worked.
Hopefully it will work for ya :P
lordchaos
01.11.2006, 14:20
Kenster, You can try http://deo-lan.se/cachedscript.rar if you did not succeed with your code yet.
In general it contains a php script allthough its adepted to be executed from a php shellscript.
You can check the php script if you expect malware, aswell as get your own php.exe and php.ini and php5s.dll if you dont trust them.
In general you only need to press the exec.bat
And it will ask you what charid you want to target (I guess you know how to look up charids ;P)
After that it will ask what itemid (Try 600 since thats avadon boots)
After that it will ask for amount.
If it returns a 1x. It should "most" likly have worked.
Hopefully it will work for ya :P
Looks familiar to me ;)
Looks familiar to me ;)
How strange :P
Can anybody help me in this situation:
I want to give SubJob's to players.
like he had subjob's 10 15 -1 -1 (just example)
and after that he will get:
20 15 -1 -1 (also, only example)
If I use: ChangeSubJobPacket it only changes current profession. (like from subjob #1 to #2 )
If I modify subjobs via database - cache does not reload data from db next time players login. (only if I restart server).
Any idea how to chage it ? :)
May be there is some sort of "delete character from cache" packet ?
Share ChangeSubJobPacket structure...
barabashka
03.11.2006, 12:34
Hel, i give it to you yesterday. Take it again: #89 ChangeSubJob("ddS; ID char; Subjob ID ;") , where Subjob ID from 0 to 3
Also some other functions:
#15 ModCharPacket("dddddddS; ID char; Set SP; Set EXP; Set Karma; Set PK; Set PK pardon; Set Duel; ;")
#16 ModCharPacket2("dddddddS;ID char;gender;rase;class;face;hair_shape;hair_color; ;")
#29 ModCharPacket3("dddddddS; ID char ; Add SP; Add Exp; Add Karma; Add PK; Add PK pardon; Add duel; ;")
2hel: вчера был занят сильно, неуспел записать все пакеты в таком формате. постучи мне в асю завтра.
barabashka
03.11.2006, 12:39
For add subjob to player need to use #96 AddSubjobsPacket("dSd"; ID char; String; id"), but for this moment i don't know what means String and last parameter.
hel
My structure is same as of barabashka:
#89 ChangeSubJob($char_id,$sub_job_id)
but it only changes active subjob :(
barabashka
Have you found anything about AddSubjobsPacket ?
PS: Is there any "reload information about char packet" ?
Has someone know about PledgeDeletePacket, how it works? I use this:
function l2_pledgedelete ( $pledge_id ) {
// 38 - PledgeDelete, pledge_id
$cached_op = pack ( "cV", 38, $pledge_id );
$cached_op .= ansi2unicode ( "webadmin" );
$ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
return ( $ret_string );
}
Command correctly return "1", but some 'test' clan has not been deleted, and i don't know where is the problem. Disband in-game command works ok.
djtincho
08.11.2006, 20:12
any news about addsubjobpacket?
it suposted to be something like addsubjobpacket($charid, $packetnumber, $class) but it doesn´t work :(
I tried to use this one:
#96 AddSubjobsPacket("dSd")
with list of parametres:
$char_id,$new_class,$f['hp'],$f['mp'],$f['sp'],$f['exp'],$f['level'],$subjob_id, $f['henna_1'],$f['henna_2'],$f['henna_3']
but no success :(
How about the StopChar packet? Anyone know the variables for this one? I would imagine one is the character ID, and the other?
Nevermind it's 90;<charid>;<min to freeze>
Character must be offline
I tried to use this one:
#96 AddSubjobsPacket("dSd")
with list of parametres:
$char_id,$new_class,$f['hp'],$f['mp'],$f['sp'],$f['exp'],$f['level'],$subjob_id, $f['henna_1'],$f['henna_2'],$f['henna_3']
but no success :(
Ollisso as You see on description... u need data such int,string,int... 3 vars... how many did u listed? xD sry for eng - tired...
does anyone have ChangePledgeOwner packet works?
does anyone have ChangePledgeOwner packet works?
I try everything... and cant get it working... i have most of the packets working but that or give error or give 01 but nothing happen... I try with pledge owner online.. offline.. new leader offline.. online... all combinations has been tested unsuscesfully.
Does Someone checked 20 and 21 packets?
Enable and Disable Char?
I have written code below, but if Unban char seems to work (returns 1), BanChar returns 03 - wrong args o_O
function ansi2unicode($string) {
$rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
return($rs.chr(0).chr(0));
}
function l2_cached_push($buf){
$cached_ip = "127.0.0.1";
$cached_port = "2012";
$fp = fsockopen($cached_ip, $cached_port, $errno, $errstr, 5); $rs = "";
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";
}
}
function l2_banCharacter($webadmin, $char_id) {
$cached_op = pack("c", 20); // 20 = DisableCharacterPacket();
$cached_op .= pack("i", $char_id);
$cached_op .= ansi2unicode ( $webadmin );
$rs = l2_cached_push ($cached_op);
return ( $rs );
}
function l2_unbanCharacter($webadmin, $char_id) {
$cached_op = pack("c", 21); // 21 = EnableCharacterPacket();
$cached_op .= pack("i", $char_id);
$cached_op .= ansi2unicode ( $webadmin );
$rs = l2_cached_push ($cached_op);
return ( $rs );
}
Ban
UPDATE user_account SET block_flag = 1,block_flag2 = 1 WHERE account='dumbass'
Unban
UPDATE user_account SET block_flag = 0,block_flag2 = 0 WHERE account='dumbass'
if you really really want to use cacheD commands try your cacheD command for 0 min. That's the only way i can get it to unban other than modifying the sql table.
That works for me
#20 DisableCharacterPacket("ddS")
function DisableCharacterPacket($char_id) {
$buf = pack("c", 20);
$buf .= pack("i", $char_id);
$buf .= pack("i", 1);
return CacheDInteractive($buf);
}
#21 EnableCharacterPacket("ddS")
function EnableCharacterPacket($char_id, $account_id) {
$buf = pack("c", 21);
$buf .= pack("i", $char_id);
$buf .= pack("i", $account_id);
return CacheDInteractive($buf);
}
My function CacheDInteractive... is better than try to connect to the server in each function...
function CacheDInteractive($buf) {
$fp = fsockopen("127.0.0.1", "2012", $errno, $errstr, 5);
$rs = "x";
if (!$fp) die("Error conectando con CacheD: [Server OFF?]");
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);
}
SilverCloud
06.04.2007, 21:41
These commands are only available when the character is offline right? If so, thats too bad.. I was about to create an auction site (php). Second, is it possible to check if a char is online?
These commands are only available when the character is offline right? If so, thats too bad.. I was about to create an auction site (php). Second, is it possible to check if a char is online?
You can check if player is online with this function...
#1 CheckCharacterPacket("dS")
function CheckCharacterPacket($char_id) {
$buf = pack("c", 1);
$buf .= pack("i", $char_id);
return CacheDInteractive($buf);
}
But always you can kick him first and problem solved.
#5 KickCharacterPacket("dS")
function KickCharacterPacket($char_id) {
$buf = pack("c", 5);
$buf .= pack("i", $char_id);
return CacheDInteractive($buf);
}
scrap512
12.04.2007, 19:33
Can't get additem2 to work even. itemdata and cache are both in the cached script folder :-/ any other suggestions?
has anybody make php function to add skill to char?
has anybody make php function to add skill to char?
function fragment :)
$buf=pack("cVVV",6,$char_id,$skill_id,$skill_level).tounicode("admin");
$cachedsocket=@fsockopen($cached_ip,$cached_port,$ errno,$errstr,1) or die("error");
fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf);
$len=unpack("v",fread($cachedsocket,2));$rid=unpack("c",fread($cachedsocket,1));
for($i=0;$i<(($len[1]-4)/4);$i++){$read=unpack("i",fread($cachedsocket,4));$rs.=$read[1];}
fclose($cachedsocket);
That works for me
#21 EnableCharacterPacket("ddS")
function EnableCharacterPacket($char_id, $account_id) {
$buf = pack("c", 21);
$buf .= pack("i", $char_id);
$buf .= pack("i", $account_id);
return CacheDInteractive($buf);
}
Does EnableCharacter works correct for you?
I have the same one, but it places in account_id unsigned -2 (somesing like 65K o_O).
What is wrong????
l2russia
17.06.2007, 15:36
ChangePledgeOwnerPacket
37 clan_id char_id unicode(admin)
выдает 1 при подходящих данных, при неверных 024
но абсолютно ничего не происходит.
ChangePledgeOwnerPacket
37 clan_id char_id unicode(admin)
выдает 1 при подходящих данных, при неверных 024
но абсолютно ничего не происходит.
Estoy de acuerdo (?)
Guaresnay
19.06.2007, 22:35
Estoy de acuerdo (?)
claro es la unica forma (?)
xly99168
22.06.2007, 21:30
what is format ?
#2 SetCharacterLocationPacket("dddddS")
char_id, location_X, location_Y, Location_Z, ???????, admin
who can help ????
Write sample please...
Try: SetCharacterLocationPacket, char_id, 1, x, y, z, unicode(admin)
P.S. Look in cached 'system' and 'err' logs, it usually shows you what is wrong.
xly99168
28.06.2007, 16:52
test success.....
very THX!
xly99168
02.07.2007, 00:35
about #50 ManAnnouncePacket("ddSS")????
Why arsy-varsy code after I write chinese on announce? But english is well.....
english 2byte = chinese 1byte
xly99168
10.07.2007, 18:36
about ChangePledgeOwnerPacket
37 clan_id char_id unicode(admin) ????
37 to_char_id pledge_id is error....
37 pledge_id to_char_id is error too....
then ..... ?
xly99168
10.07.2007, 18:37
cached 'system' and 'err' logs, it not shows me what is wrong.
ChangePledgeOwnerPacket is not working through cached :/
djvogans
24.07.2007, 08:31
not working in c1 modded cached . in retail cached it's working fine .
I'm using file 'cached.exe' size '1 540 096' from c4retailpack. It is not working for me same as PledgeDeletePacket.
xly99168
28.07.2007, 20:16
ChangePledgeOwnerPacket is not working through cached :/
me too, and PledgeDeletePacket is not working too....
xly99168
07.08.2007, 18:12
UP. who can help ?