- Рег
- 21 Авг 2015
- Сообщения
- 60
- Реакции
- 0
this script author: rsdk
Код:
uses SysUtils;
function ShellExecuteW(hwnd: integer; lpOperation, lpFile, lpParameters, lpDirectory: PChar; nShowCmd: integer): integer; stdcall;
external 'Shell32.dll';
function keybd_event(bVk, bScan: byte; dwFlags, dwExtraInfo: integer): integer; stdcall;
external 'user32.dll';
procedure disconnectMonitor;
const
login = 'lgn';
password = 'pwd';
gamePath = 'F:\l2gf\system\l2.exe';
begin
while Delay(3000) do begin
if Engine.Status = lsOffline then begin
print('dc');
Engine.FaceControl(0, false);
Delay(1000);
Engine.GameClose;
Delay(1000);
ShellExecuteW(0, 'open', PChar(gamePath), nil, nil, 0);
Delay(10000);
enterText(login);
Engine.UseKey('Tab');
Delay(300);
enterText(password);
Delay(300);
Engine.UseKey('Enter');
Delay(2000);
Engine.UseKey('Enter');
Delay(2000);
Engine.UseKey('Enter');
Delay(2000);
Engine.UseKey('Enter');
Delay(10000);
Engine.FaceControl(0, true);
end;
end;
end;
procedure enterText(const text: string);
var
i: cardinal;
upperCase: boolean;
begin
for i:= 1 to length(text) do begin
if isDigit(text[i]) then
Engine.UseKey(text[i])
else begin
upperCase:= text[i] = UpCase(text[i]);
if upperCase then begin
keybd_event(20, 0, 1, 0);
keybd_event(20, 0, 2, 0);
Engine.UseKey(text[i]);
delay(10);
keybd_event(20, 0, 1, 0);
keybd_event(20, 0, 2, 0);
end else
Engine.UseKey(text[i]);
end;
Delay(50);
end;
end;
function isDigit(ch: char): boolean;
const
digits = '013456789';
var
i: cardinal;
begin
result:= false;
for i:= 0 to length(digits) do
if digits[i] = ch then begin
result:= true;
exit;
end;
end;
begin
Script.NewThread(@disconnectMonitor);
end.