I think this should work:
Delphi Код:
begin // Get Mob Info
if (FromServer) and (ConnectName=PJName) and (pck[1]=#$16) then
begin
MobID[i]:=ReadD(2); // String
MobX[i][1]:=Read(14); // Integer
MobX[i][2]:=Read(15);
MobX[i][3]:=Read(16);
MobX[i][4]:=Read(17);
MobY[i][1]:=Read(18);
MobY[i][2]:=Read(19);
MobY[i][3]:=Read(20);
MobY[i][4]:=Read(21);
MobZ[i][1]:=Read(22);
MobZ[i][2]:=Read(23);
MobZ[i][3]:=Read(24);
MobZ[i][4]:=Read(25);
end;
end;
//************************************************************************************************
begin
MobXTot[i]:=MobX[i][1]+MobX[i][2]+MobX[i][3]+MobX[i][4];
MobYTot[i]:=MobY[i][1]+MobY[i][2]+MobY[i][3]+MobY[i][4]; // MobXTot, MobYTot, MobZTot : extended
MobZTot[i]:=MobZ[i][1]+MobZ[i][2]+MobZ[i][3]+MobZ[i][4];
Distance[i]:=sqr((MobXTot[i]-MyX)*(MobXTot[i]-MyX)+(MobYTot[i]-MyY)*(MobYTot[i]-MyY)); // Extended
end;
//*************************************************************************************************
begin // Find Nearest Mob
Nearest:=0;
for i:=1 to 100 do
begin
If Distance[i]<Distance[Nearest] then Nearest:=i;
end;
end;
//************************************************************************************************
begin // Atack
buf:=#$0A;
WriteD(MobX[i][1]+MobX[i][2]+MobX[i][3]+MobX[i][4]);
WriteD(MobY[i][1]+MobY[i][2]+MobY[i][3]+MobY[i][4]);
WriteD(MobZ[i][1]+MobZ[i][2]+MobZ[i][3]+MobZ[i][4]);
end;
I just keep the "raw" mob location, an use the variable Distance[i] to convert the int to ext...
I can not test it because im at work -.-
Then ill tell you the results.
Charly.