Persistent SingleInstance Force Include SAMP ahk global chatlogPatch A

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#Persistent
#SingleInstance, Force
#Include, SAMP.ahk
global chatlogPatch := A_MyDocuments "\GTA San Andreas User Files\SAMP\chatlog.txt"
global ansAdm := ["Да, а где мне ещё быть?", "Допустим...", "/n Нет(да)"]
global Ignor := 1
SetTimer, checAdminReport, 50
return
checAdminReport()
{
FileRead, chatlog, % chatlogPatch
for k, v in StrSplit(chatlog, "`n")
{
if (RegExMatch(v, "\]\sАдминистратор\s[A-z_]+\[[0-9]+\]:\s(?<text>.*)", out_))
{
save(chatlog)
if (RegExMatch(out_text, "[Cc]ядь") && A_TickCount - startTime > 1000 * 60)
{
startTime := A_TickCount
sitDown()
}
if (RegExMatch(out_text, "(тут|[зс]дес|нами|ответ)") && A_TickCount - startTime > 1000 * 60)
{
startTime := A_TickCount
ansAdmin()
}
}
}
}
sitDown()
{
showGameText("ADMINISTRATOR", 5000, 3)
Sleep 500
Send {vk43 down}
Sleep 50
Send {vk43 up}
Sleep, 200
Send {vk43 down}
Sleep 50
Send {vk43 up}
return
}
ansAdmin()
{
showGameText("ADMINISTRATOR", 5000, 3)
sitDown()
if(Ignor != ansAdm.MaxIndex() + 1)
{
Sleep, StrLen(ansAdm[Ignor]) * 100 + 1000
SendChat(ansAdm[Ignor])
Ignor ++
}
else
{
global Ignor := 1
ansAdmin()
}
return
}