SendMode Input UseHook NoEnv SingleInstance force Include crmp ahk glo

 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
SendMode Input
#UseHook
#NoEnv
#SingleInstance, force
#Include crmp.ahk
global chatLog := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt" ; путь к чатлогу
global Words :=
settimer, start, 50
Return
ListLines Off
SetBatchLines -1
Words = (warn|kick|ban|jail|skick|sethp|sban|o|iban|offban|ioffban|offmute|offjail|offwarn|sp|freeze|unfreeze|givegun|getip|agetip|agetstats|aunjail)
F2::
FileRead, Str, %A_MyDocuments%\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt
StringReplace, Str, Str, `r`n, `n, 1
StringReplace, Str, Str, `r, `n, 1
RegExMatch("`n" Str "`n", "i).*\n\[\d+:\d+:\d+]\s*\[ADM-CHAT] {FFFFFF}.*?\[.*?]:\s*(/`*" Words "\s.*?)\n", Match)
ToolTip % Clipboard := Match1
Sleep 100
SendMessage, 0x50,, 0x4190419,, A
SendInput,{F6}%match1% {enter}
clipboard =
ToolTip
FileDelete,%A_MyDocuments%\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt
Return
!Right:: SendPlay, {right 37}
!Left:: SendPlay, {left 43}/{right 56}{space}
start()
{
FileRead, textChatLog, % chatLog
for k, v in StrSplit(textChatLog, "`n")
{
if (RegExMatch(v, "^\[\d+:\d+:\d+\]\s+\[ADM-CHAT\]\s+{FFFFFF}(?<nick>[A-z_]+)\[[0-9]{1,3}\]:\s(?<text>.*)$", out_) && RegExMatch(out_text, "(?<punish>\/warn|\/kick|\/ban|\/jail|\/skick|\/sethp|\/sban|\/o|\/iban|\/offban|\/ioffban|\/offmute|\/offjail|\/offwarn|\/sp|\/freeze|\/unfreeze|\/givegun|\/getip|\/agetip|\/agetstats|\/aunjail)", out_))
{
saveCRMP(textChatLog)
addChatMessageEx("FFFFFF", "Администратор {00FF00}" out_nick " просит выдать "out_text)
}
}
Return true
}
saveCRMP(chatlog)
{
static logschat := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\ChatLogs\"
static chat := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt"
FileCreateDir , % logschat A_MM "-" A_YYYY
FileAppend , % chatlog, % logschat A_MM "-" A_YYYY "\" A_DD "." A_MM "." A_YYYY ".txt"
FileDelete , % chat
}