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:
delphi Код:
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(OriginX)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(OriginX)d(OriginY)d(OriginZ)d(MoveMovement)
begin
readmask('ddddddd',2,values);
//using data from values
end;
end;
end;