PDA

Просмотр полной версии : PvP Helper


Fer123
16.01.2009, 18:00
Скрипт создает список игроков которые атакуют вас в виде кнопок в HTML файле. Есть возможность добавить игрока в исключения и в списке он появляться не будет. Скрипт реагирует на любые скилы и удары которыми атакуют вас. Ид скилов можно внести в список исключений.
Скрипт писался под С4!

Program PvPHelper;
const Name='Fer123';
Excludes=[1218,1219,1217,1254,1016,1311,1335,4092,45];
BaseMax=200;
var
CharOID: array[1..BaseMax] of integer;
CharNames: array[1..BaseMax] of string;
Attackers: array[1..2,1..10] of integer;
ex: array of integer;
quantity,aquantity,exqnt,temp,i,MyOID: integer;
procedure Init;
begin
exqnt:=1;
end;
procedure Free; //Вызывается при выключении скрипта
begin
for i:=1 to BaseMax do
begin
CharNames[i]:='';
CharOID[i]:=0;
end;
for i:=1 to 10 do Attackers[1,i]:=0;
exqnt:=0;
quantity:=0;
temp:=0;
aquantity:=0;
end;
function GetArrayNum(OID:integer) : integer;
var i:integer;
begin
for i:=1 to BaseMax do
begin
if CharOID[i]=OID then
begin
result:=i;
exit;
end;
end;
result:=0;
end;
function GetAttackersNum(OID:integer) : integer;
var i:integer;
begin
for i:=1 to 10 do
if Attackers[1,i]=OID then
begin
result:=i;
exit;
end;
result:=0;
end;
function GetName(OID:integer) : string;
var i:integer;
begin
result:='None';
for i:=1 to BaseMax do
if OID=CharOID[i] then
begin
result:=CharNames[i];
exit;
end;
end;
function CheckEx(OID:integer) : boolean;
var i:integer;
begin
for i:=0 to exqnt-1 do
if ex[i]=OID then
begin
result:=false;
exit;
end;
result:=true;
end;
procedure CreateHTML;
var
tempstr,dmg:string;
begin
tempstr:='<html><body><center>PvP Helper:<br><table width="285" border="0">';
for i:=1 to 10 do
begin
if attackers[2,i]>=0 then dmg:=inttostr(attackers[2,i]) else dmg:='Magic';
if attackers[1,i]>0 then tempstr:=tempstr+'<tr><td><button value="Name:'+GetName(attackers[1,i])+' Damage:'+dmg+'" action="bypass -h a'+inttostr(attackers[1,i])+'" width=265 height=20></td><td><button value="E" action="bypass -h e'+inttostr(attackers[1,i])+'" width=20 height=20></td></tr><tr></tr>';
end;
tempstr:=tempstr+'</table></center></body></html>';
buf:=#$0F;
WriteD(1209014528);
WriteS(tempstr);
WriteD(0);
SendToClientEx(Name);
tempstr:='';
end;
begin
if FromServer and (ConnectName=Name) then
begin
case pck[1] of
#$03: if GetArrayNum(ReadD(18))=0 then
begin
inc(quantity);
if quantity=BaseMax+1 then quantity:=1;
CharNames[quantity]:=ReadS(22);
CharOID[quantity]:=ReadD(18);
end;
#$04: MyOID:=ReadD(18);
#$05: if (ReadD(6)=MyOID) and (CheckEx(ReadD(2))) then
begin
temp:=GetAttackersNum(ReadD(2));
if temp>0 then Attackers[2,temp]:=ReadD(10);
if temp=0 then
begin
inc(aquantity);
if aquantity=11 then aquantity:=1;
Attackers[1,aquantity]:=ReadD(2);
Attackers[2,aquantity]:=ReadD(10);
end;
CreateHTML;
end;
#$06: begin
temp:=GetAttackersNum(ReadD(2));
if temp>0 then
begin
Attackers[1,temp]:=0;
CreateHTML;
end;
end;
#$76: if (ReadD(length(pck)-3)=MyOID) and (ReadD(2)<>MyOID) and (not (ReadD(6) in Excludes)) and (CheckEx(ReadD(2))) then
begin
temp:=GetAttackersNum(ReadD(2));
if temp>0 then Attackers[2,temp]:=-1;
if temp=0 then
begin
inc(aquantity);
if aquantity=11 then aquantity:=1;
Attackers[1,aquantity]:=ReadD(2);
Attackers[2,aquantity]:=-1;
end;
CreateHTML;
end;
end;
end;
if FromClient and (ConnectName=Name) then
begin
case pck[1] of
#$21: begin
if ReadH(2)=97 then
begin
buf:=#$0A;
WriteD(strtoint(ReadS(4)));
SendToServerEx(Name);
CreateHTML;
pck:='';
end;
if ReadH(2)=101 then
begin
temp:=GetAttackersNum(strtoint(ReadS(4)));
if temp>0 then Attackers[1,temp]:=0;
ex[exqnt-1]:=strtoint(ReadS(4));
inc(exqnt);
SetLength(ex, exqnt);
CreateHTML;
pck:='';
end;
end;
#$6D: for i:=1 to 10 do Attackers[1,i]:=0;
end;
end;
end.