попробуй так
uses SysUtils;
procedure Cancel_Protect;
var
P1, P2 : pointer;
Action: TL2Action;
Actor: TL2Live;
SkillID: integer;
begin
try
while Engine.Status = lsOnline do
begin
Action := Engine.WaitAction([laCast], P1, P2);
if Action = laCast then
begin
Actor := TL2Live(P1);
SkillID := Actor.Cast.ID;
if (SkillID = 4094) or (SkillID = 4177) and // Моб юзает канцел
(User.DistTo(Actor) < 500) // Рендж до моба не больше 500
then
begin
print(actor.Name + ' casting: ' + actor.Cast.Name + ' (' + intToStr(actor.Cast.Id) + '