1

Тема: [AHK - GTA SA:MP] Помогите с кодом.

В общем суть такова, скрипт не работает должным образом.

while (true)
{
	Filedelete, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Fileappend, , %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	loop
	{
	label:
	Loop, Read, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
		{
			IfInString, A_LoopReadLine, БАНКОВСКИЙ ЧЕК
			{
			goto, label1
			}
			else IfInString, A_LoopReadLine, Server closed the connection
			{
			goto, label2
			}
			else IfInString, A_LoopReadLine, Добро пожаловать на Advance RolePlay
			{
			goto, label3
			}
			else IfInString, A_LoopReadLine, Сервер возобновит работу в течение минуты
			{
			goto, label4
			}
		}
		
	SetTimer, CheckPayDay1, 1000 
	return 

	CheckPayDay1: 
	if (A_Min == 59 && A_Sec == 30 || A_Min == 29 && A_Sec == 30 || A_Min == 30 && A_Sec == 30)
	{ 
		Send {vk57 down}
		sleep 500
		Send {vk57 up}
		Sendinput {Esc down}
		sleep 50
		Sendinput {Esc up}
		Send {vk57 down}
		sleep 500
		Send {vk57 up}
	}

	goto, label
	label1:
	Filedelete, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Fileappend, , %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
		{
		Send {vk57 down}
		sleep 500
		Send {vk57 up}
		Sendinput {Esc down}
		sleep 50
		Sendinput {Esc up}		
		}
	
	goto, label
	label2:
	Filedelete, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Fileappend, , %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
		{
			SendInput, {f6}/recon 15{Enter}
		}
	
	goto, label
	label3:
	Filedelete, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Fileappend, , %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Loop, Read, file.txt
		{
			Sendinput %A_LoopReadLine%{Enter}
			sleep 3000
			Send {vk57 down}
			sleep 500
			Send {vk57 up}
			Sendinput {Esc down}
			sleep 50
			Sendinput {Esc up}
		}
	
	goto, label
	label4:
	Filedelete, %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
	Fileappend, , %A_MyDocuments%\GTA San Andreas User Files\SAMP\chatlog.txt
		{
			SendInput {F6}/recon 180{Enter}
		}
	}
}

Скрипт выше предназначен для того, чтобы после PayDay (часа игры) уходить в АФК (жмет на паузу). А в 59 минут 30 секунд выходить из АФК (Выходить с паузы). Так же скрипт сам релогается когда вылетает сообщение "Server closed the connection". После слов "Добро пожаловать на Advance RolePlay" через 3 секунды скрипт вписывает пароль, после входа в игру уходит в АФК (жмет на паузу). Все паузы сопровождаются движением в перед.

И так вопрос. Почему после часа - двух часов срипт перестает работать ???

Покумекаем о делах наших скорбных.

2 (изменено: Phoenixxx_Czar, 2018-01-27 05:10:00)

Re: [AHK - GTA SA:MP] Помогите с кодом.

password := "ПАРОЛЬ"
chat := A_MyDocuments "/GTA San Andreas User Files/SAMP/chatlog.txt"
SetTimer, Chat, 50
SetTimer, PayDay, 1000
return

Chat:
FileRead, chatlog, % chat
FileDelete, % chat

if (RegExMatch(chatlog, "\[\d+:\d+:\d+\]\s+БАНКОВСКИЙ ЧЕК"))
{
	Send, {ESC down}
	sleep, 50
	Send, {ESC up}
}
if (RegExMatch(chatlog, "\[\d+:\d+:\d+\]\s+Добро пожаловать на Advance RolePlay!"))
{
	while(!isDialogOpen())
		Continue

	Send, % password "{ENTER}"
}
if (RegExMatch(chatlog, "\[\d+:\d+:\d+\]\s+Server closed the connection") || RegExMatch(chatlog, "\[\d+:\d+:\d+\]\s+Сервер возобновит работу в течение минуты"))
{
	SendInput, {f6}/recon 15{Enter}
}
return

PayDay:
if (A_Min == 59 && A_Sec == 01)
{
	Send, {ESC down}
	sleep, 50
	Send, {ESC up}

	sleep, 300

	Send, {vk57 down}
	sleep, 1000
	Send, {vk57 up}
}
Return
Win10: LTSC (21H2); AHK: ANSI (v1.1.36.02)