Приду домой буду голову ломать дальше, потому что судя по коду все должно быть гладко...
Добавлено спустя 4 часа 54 минуты 50 секунд:
То ли с ума сошел я, - то ли мир вокруг меня глумится... Ковыряю сейчас скрипт
msk на бота хилера...
Код:
Const
HP=2000;
BotName='Хилер';
MasterName='Командос';
Chaos=100;
GreatHeal='2F C1 04 00 00 00 00 00 00 00';
GroupHeal='2F C3 04 00 00 00 00 00 00 00';
var
CharName: array[1..9] of string;
CharID: array[1..9] of integer;
CurHP: array[1..9] of integer;
MaxHP: array[1..9] of integer;
CurMP: array[1..9] of integer;
MaxMP: array[1..9] of integer;
Dev: array[1..9] of extended;
xe, ye: extended;
PartyCount,i,f,e,t,MinHP,NeedHP,ox,oy,oz,x,y,z,MasterID,BotID: integer;
exist, HealKey, RunKey: boolean;
TimerHP: TTimer;
procedure Init; //Aucuaaaony i?e aee??aiee ne?eioa
begin
TimerHP:=TTimer.Create(nil);
TimerHP.OnTimer:=@OnTimerHP;
TimerHP.enabled:=true;
TimerHP.interval:=1000;
end;
procedure Heal;
begin
//target
buf:=#$04;
WriteD(CharID[NeedHP]);
WriteD(ox);
WriteD(oy);
WriteD(oz);
WriteC(0);
SendToServerEx(BotName);
//heal
buf:=hstr(GreatHeal);
SendToServerEx(BotName);
end;
procedure SendMsg(msg:string);
begin
buf:=#$4A;
WriteD(BotID);
WriteD(2);
WriteS(BotName);
WriteS(msg);
SendToClient;
end;
procedure Min(n1,n2:integer);
begin
if n1<n2 then MinHP:=n1 else MinHP:=n2;
end;
procedure OnTimerHP(Sender: TObject);
begin
if PartyCount>0 then
begin
MinHP:=CurHP[1];
for t:=1 to PartyCount do
begin
if CharName[t]=MasterName then MasterID:=CharID[t];
if CharName[t]=BotName then BotID:=CharID[t];
min(MinHP,CurHP[t]);
end;
for t:=1 to PartyCount do
begin
if (CurHP[t]=MinHP) and (CurHP[t]<MaxHP[t]) then
begin
NeedHP:=t;
break;
end;
end;
if (HealKey=true) and (MinHP<HP) then Heal;
end;
end;
procedure Free; //Aucuaaaony i?e auee??aiee ne?eioa
begin
PartyCount:=0;
TimerHP.free;
HealKey:=false;
RunKey:=false;
end;
//iniiaiay ?anou ne?eioa
//aucuaaaony i?e i?eoiaa ea?aiai iaeaoa anee ne?eio aee??ai
begin
if FromServer and (pck[1]=#$52) then
begin
i:=6;
for f:=1 to (PartyCount+1) do
begin
if CharID[f]=ReadD(2) then exist:=true else exist:=false;
if exist=true then
begin
CharName[f]:=ReadS(i);
i:=i+8;
CurHP[f]:=ReadD(i);
MaxHP[f]:=ReadD(i);
CurMP[f]:=ReadD(i);
MaxMP[f]:=ReadD(i);
Dev[f]:=CurHP[f]/MaxHP[f];
break;
end;
end;
if exist=false then
begin
PartyCount:=PartyCount+1;
f:=PartyCount;
CharID[f]:=ReadD(2);
CharName[f]:=ReadS(i);
i:=i+8;
CurHP[f]:=ReadD(i);
MaxHP[f]:=ReadD(i);
CurMP[f]:=ReadD(i);
MaxMP[f]:=ReadD(i);
Dev[f]:=CurHP[f]/MaxHP[f];
end;
end;
if FromClient and (ConnectName=MasterName) and (RunKey=true) and (pck[1]=#$01) then
begin
xe:=ReadD(2)-Chaos/2+round(random*Chaos);
ye:=ReadD(6)-Chaos/2+round(random*Chaos);
x:=round(xe);
y:=round(ye);
z:=ReadD(10);
buf:=#$01;
WriteD(x);
WriteD(y);
WriteD(z);
WriteD(ox);
WriteD(oy);
WriteD(oz);
ox:=x;
oy:=y;
oz:=z;
SendToServerEx(BotName);
end;
if FromClient and (ConnectName=BotName) and (pck[1]=#$01) then
begin
ox:=ReadD(2);
oy:=ReadD(6);
oz:=ReadD(10);
end;
//Heal mode
if FromClient and (ConnectName=MasterName) and (pck=hstr('1B 02 00 00 00')) then
begin
HealKey:=not(HealKey);
pck:='';
Case HealKey of
true: SendMsg('Heal mode ON');
false: SendMsg('Heal mode OFF');
end;
end;
//Run mode
if FromClient and (ConnectName=MasterName) and (pck=hstr('1B 03 00 00 00')) then
begin
RunKey:=not(RunKey);
pck:='';
Case RunKey of
true: SendMsg('Run mode ON');
false: SendMsg('Run mode OFF');
end;
end;
if FromClient and (pck=hstr('1B 04 00 00 00')) then
begin
//target master
buf:=#$04;
WriteD(MasterID);
WriteD(ox);
WriteD(oy);
WriteD(oz);
WriteC(0);
SendToServerEx(BotName);
buf:=hstr('2F F5 03 00 00 00 00 00 00 00');
SendToServerEx(BotName);
pck:='';
end;
end.[/quote]
Короче вчера вот строго в этом виде все работало без мистики - с одним лиш косяком кторый заключался в том, что SE хилял безконечно после того, как опрделил что у одного из членов пати Текущее HP меньше чем максимальное.
Сейчас в этом же виде когда включаеш HEAL MODE - L2PacketHack вывливает коврик
Variant or safe array index out of bounds :shock:
Ошибка исчезает если вернуть строку
if (CurHP[t]=MinHP) and (CurHP[t]<MaxHP[t]) then к виду
if CurHP[t]=MinHP then
Похоже крыша у меня поехала... тяжелых наркотиков не употреблял вроде на кануне. :unknown: