const
ALARM_SOUND_PATH = 'C:\Users\Sergey\Desktop\boot\Sounds\sirena.wav'; //путь до алярма
var
P1, P2 : pointer;
Action: TL2Action;
Actor: TL2Live;
function SetForegroundWindow(hwnd: integer) : Boolean; stdcall;
external 'user32.dll';
begin
while Engine.Status = lsOnline do
begin
Action:=Engine.WaitAction([laDlg], P1, P2);
if Action = ladlg then
SetForegroundWindow(Engine.GameWindow);