god you just have to merge them
you're never gonna learn anything if you just keep asking people to do everything for you
var
XorString : string;
Message : string;
gserver : boolean;
i : integer;
Procedure OnCreate;
begin
//gSys.tLA2BFToken:= 'a%S[{&*-94}^#%xx-P]a'+#0;
XorString := HStr('00 00 00 12 18 85 a0 00');
end;
function Crypt(buffer : string): string;
begin
for i := 4 to length(buffer) do begin
buffer[i] := Chr(ord(buffer[i]) xor ord(XorString[((i-4) and 7)+1]));
end;
Result := Buffer;
end;
begin
if(not _gfromserv) and (_gAbsNumPkt=3) then begin
gserver := true;
end;
if (not _gFromServ) and (copy(_gBuff,3,1)=#$38) then begin
ScanPck5(_gBuff,4,'s',Message,null,null,null,null);
if Message = 'Cat'+#0 then begin
GSys.EnSendS(crypt(HStr('0C 00 45 EF 03 00 00 00 00 00 00 00')));
gBlockPacket;
end;
end;
if gserver and (length(_gBuff)>3) then begin
_gOutBuff:=Crypt(_gBuff);
end;
end.