Просмотр полной версии : packet identification
Why i can't use PCK[1] = HStr ('01 ') ?
i can compare whole pck variable. like if pck = hstr('blablabla')
why this happens ?
alexteam
01.01.2010, 14:40
PCK[1] => char type
hstr() => string type
if pck = hstr ('blablabla') then - will work.
do not use that translator.
ah ok, sorry for translation, I wonder what I wrote ;)
so if I want to check, if packet = movetolocation ( 01 .. .. .. .. ), I should use:
if PCK[1] = '01' then
without use hstr() ?
or its not possible to check type of packet?
alexteam
01.01.2010, 15:09
if PCK[1] = #$01 then will be fine (remember that '1' not equal to #$01. also you must remember that symbol $ means hex something like #$FF = #255)
anyway look on this structure, its easy to understand and easy to use/modify:
var
Values : variant;
begin
if fromserver then //packets from server
case pck[1] of
#$2F: //2F=MoveToLocation:d(CharID)d(ToX)d(ToY)d(ToZ)d(Ori ginX)d(OriginY)d(OriginZ)
begin
//reading structure of packet
readmask('ddddddd',2,values);
//using data from values array where:
//values[0]=CharID
//values[1]=ToX
//values[2]=ToY
//blablabla
//values[6]=OriginZ
end;
#$4A: //4A=CreatureSay:d(ObjectID)d(TextType)s(CharName)s( Text)
begin
//reading structure of packet
readmask('ddss',2,values);
//using data from values array where:
//values[0]=sayer oid
//values[1]=chat type(texttype)
//values[2]=who sayd
//values[4]=what he say.
end;
if fromclient then
case pck[1] of //packets from client
#$0f://0F=MoveBackwardToLocation:d(ToX)d(ToY)d(ToZ)d(Orig inX)d(OriginY)d(OriginZ)d(MoveMovement)
begin
readmask('ddddddd',2,values);
//using data from values
end;
end;
end;
OK, i made smth like this:
if FromServer and (pck[1] = #$27) then
begin
buf:=#$4A;
WriteD(0);
WriteD(10);
WriteS('');
WriteS('inv updated');
SendToClient;
end
but dont work when server send packet to update inventory
can You look at this ?
alexteam
01.01.2010, 17:04
fully work. did you mark script to be executed ? (element #19 (http://l2phx.pp.ru/arhive/l2ph_help/scr/PSD/scr.jpg))
yes, I marked it to be used.... I really dont know what is wrong....
alexteam
01.01.2010, 17:18
must look like
procedure init;
begin
end;
procedure free;
begin
end;
begin
if FromServer and (pck[1] = #$27) then
begin
buf:=#$4A;
WriteD(0);
WriteD(10);
WriteS('');
WriteS('inv updated');
SendToClient;
end;
end.
version of l2ph ?
I pasted Your code and it dont work either...
v3.5.32.163
settings:
do not decrypt traffic
t0 - interlude
---
use lsp driver
alexteam
01.01.2010, 17:35
yeah. 32.163 thats all what i need to know.... its a bugged release. xkor compilled it with old modifications of fastscript. so script engine won't work there correct. download 31.162 or 33.164 ver here http://l2phx.pp.ru/arhive/
OK, Its working now.
One more question, Im now on both account, Im trying to send annoucement hello to one but it goes to both.
I wrote one 'if' : (ConnectName = 'MycharName')
and I replaced SentToClient for SendToClientEx('MycharName') but it dont reconize my char.
I noticed that hmmm in packet capture window there are 2 tabs, one is first char (dwarf sitting in girian), second is mainchar. On other server these tabs was named like my chars, but on this server, they are named [Proxy]#436 and [Proxy]#500. Maybe this is a reason? Any idea how to solve this?
alexteam
01.01.2010, 18:11
put useforconnectname := 'connectionname' in init procedure to define what connection will use that script.
or
UseForConnectID := xxx;
where xxx its a number after "[Proxy]#"
and use sendtoserver/sendtoclient
its will work.
also if tabs have "[Proxy]#xxxx" names its mean that l2ph cant define connectionname.
ps.uncheck "do not decrypt traffic"...
Добавлено через 8 минут
also you can rename tab by using simple script
procedure init;
begin
UseForConnectID := xxx;
SetName := 'newconnectionname';
end;
procedure free;
begin
end;
begin
end.
You are great! It works well.
Thx for help.
vBulletin® v3.6.11, Copyright ©2000-2024, Jelsoft Enterprises Ltd. Перевод: zCarot