NoEnv Persistent SingleInstance force Include CRMPUDF ahk global mainN

  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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#NoEnv
#Persistent
#SingleInstance, force
#Include, CRMPUDF.ahk
global mainNick := "Erik_Forest"
global chatLog := A_MyDocuments "\GTA San Andreas User Files\CR-MP\GenerationC\chatlog.txt"
global tempLog := 0
global ArrL := []
global afk_time := 0
global last_afk := 0
global last_noafk := 0
global noafk_time := 0
SetTimer, Main, 100
~F6::
~ESC::
ifWinNotActive, Criminal Russia Multiplayer Ревизия G
return
Dialog := 0
return
F3::
if (!IsSAMPAvailable())
addChatMessage("ok")
else
MsgBox, % "ok"
return
Main()
{
FileRead, tempLog, % chatLog
for k, v in StrSplit(tempLog, "`n")
{
if (RegExMatch(v, "\[(?<Time>\d+:\d+:\d+)\]\s+Администратор\s+" mainNick "\s+посадил\s+игрока\s+(?<WanNick>[A-z_]+)\s+в\s+тюрьму\.\s+Причина:\s+(?<Cause>.*)", out))
log(1, outTime, outWanNick, outCause)
if (RegExMatch(v, "\[(?<Time>\d+:\d+:\d+)\]\s+Администратор\s+" mainNick "\s+посадил\s+игрока\s+(?<WanNick>[A-z_]+)\s+в\s+Де\s+Морган\.\s+Причина:\s+(?<Cause>.*)", out))
log(2, outTime, outWanNick, outCause)
if (RegExMatch(v, "\[(?<Time>\d+:\d+:\d+)\]\s+Администратор\s+" mainNick "\s+кикнул\s+игрока\s+(?<WanNick>[A-z_]+)\.\s+Причина:\s+(?<Cause>.*)", out))
log(3, outTime, outWanNick, outCause)
if (RegExMatch(v, "\[(?<Time>\d+:\d+:\d+)\]\s+(?<WanNick>[A-z_]+)\s+получил\s+бан\s+чата\s+от\s+администратора\s+" mainNick , out))
log(4, outTime, outWanNick, 0)
if (RegExMatch(v, "\[(?<Time>\d+:\d+:\d+)\]\s+<\s+PM:\s+" mainNick "\s+игроку\s+(?<WanNick>[A-z_]+)\s+>\s+{FFFFFF}(?<Cause>.*)", out))
log(0, outTime, outWanNick, outCause)
}
afk := IsInAFK()
if (afk != -1)
{
if (afk == 1)
afk_time += 100
else if (afk == 0 && last_afk == 1)
{
log(5, afk_time, 0, 0)
afk_time := 0
}
last_afk := afk
if (afk == 0)
noafk_time += 100
else if ((afk == 1 && last_noafk == 0) || (afk == 0 && noafk_time > 10000))
{
log(6, noafk_time, 0, 0)
noafk_time := 0
}
last_noafk := afk
}else if (afk_time > 0)
afk_time := 0
else if (noafk_time > 0)
noafk_time := 0
}
log(mode, times, nick, texter)
{
dater := get("http://fforest.pro/time.php?time=MDY")
if (mode < 5)
saveCRMP(tempLog)
if (mode == 1){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegWrite, REG_MULTI_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish, % temp "[" times "] |Т|`t" nick "`t`t`t" texter "`n"
}else if (mode == 2){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegWrite, REG_MULTI_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish, % temp "[" times "] |Д|`t" nick "`t`t`t" texter "`n"
}else if (mode == 3){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegWrite, REG_MULTI_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish, % temp "[" times "] |К|`t" nick "`t`t`t" texter "`n"
}else if (mode == 4){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish
RegWrite, REG_MULTI_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, punish, % temp "[" times "] |M|`t" nick "`t`t`t" texter "`n"
}else if (mode == 0){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, ansver
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, ansver
RegWrite, REG_MULTI_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, ansver, % temp "[" times "] " nick "`t`t |О|: " texter "`n"
}else if (mode == 5){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeAfk
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeAfk
RegWrite, REG_EXPAND_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeAfk, % (temp ? temp + times : times)
}else if (mode == 6){
RegRead, temp, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeNoAfk
RegDelete, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeNoAfk
RegWrite, REG_EXPAND_SZ, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" dater, timeNoAfk, % (temp ? temp + times : times)
}
}
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
}
StrInArr(str)
{
newArr := []
for k, v in StrSplit(str, "`n")
newArr.Push(v)
return (newArr.MaxIndex() >= 1 ? newArr.MaxIndex() - 1 : "0")
}
~F2::
tempTextDial := ""
Loop, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" , 2, 1
{
RegRead, tempP, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" A_LoopRegName, punish
RegRead, tempA, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" A_LoopRegName, ansver
RegRead, tempTA, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" A_LoopRegName, timeAfk
RegRead, tempNA, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" A_LoopRegName, timeNoAfk
tempTextDial .= "Д: " A_LoopRegName " | Наказания: " StrInArr(tempP) " | Ответы: " StrInArr(tempA) " | АФК: " time_afk(tempTa) " | Чистый: " time_afk(tempNA) "`n"
}
Sleep, 100
showDialog(2, "Логи", tempTextDial, "X", "X", 100)
Dialog := 1
return
~LButton::
Time := A_TickCount
while(isDialogOpen())
{
if (A_TickCount - Time > 500)
return
}
~NumpadEnter::
~Enter::
if (isDialogButton1Selected() == 1 || isDialogButton2Selected() == 1)
Dialog := 0
ifWinNotActive, Criminal Russia Multiplayer Ревизия G
return
if (Dialog == 1)
{
Dialog := 0
line_num := getDialogLineNumber()
line_text := getDialogLine(line_num)
RegExMatch(line_text, "Д:\s(?<date>[0-9.]+)\s\|\sНаказания:\s(?<pun>[0-9]+)\s\|\sОтветы:\s(?<ans>[0-9]+)\s\|\sАФК:\s(?<afk>[0-9:]+)\s\|\sЧистый:\s(?<onl>[0-9:]+)", out)
text := "Открыть лог наказаний [" outpun "]{00FF00} (Кликабельно)`nОткрыть лог ответов [" outans "]{00FF00} (Кликабельно)`nЧистый онлайн: {00FF00}~ {00FF00}" outafk " `nВремя в афк: {00FF00}~ {00FF00}" outonl
Sleep, 100
showDialog(2, outdate, text, "X", "X", 100)
Dialog:= 2
return
}
if (Dialog == 2)
{
Dialog := 0
line_num := getDialogLineNumber()
line_text := getDialogLine(line_num)
CaptionD := getDialogCaption()
if (line_num == 1){
RegRead, end, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" CaptionD, punish
Sleep, 100
showDialog(0, "Наказания", "{00FF00}Time`t`tNick`t`t`t`tPunish`n{FFFFFF}" end, "X", "X", 100)
}else if (line_num == 2){
RegRead, ender, HKEY_CURRENT_USER, % "Software\AdmLogCRMP\" CaptionD, ansver
Sleep, 100
showDialog(0, "Наказания", "{00FF00}Time Nick`t`t`tAnswer`n{FFFFFF}" ender, "X", "X", 100)
}else if (line_num > 2 )
return
}
return
time_afk(afk_time, min := 0)
{
if (!min)
{
sec := Ceil(afk_time/1000)
h := sec/3600 ^ 0
m := (sec-h*3600)/60 ^ 0
s := sec-h*3600-m*60
if (afk_time > 5)
return (h < 10 ? "0" h : h) ":" (m < 10 ? "0" m : m) ":" (s < 10 ? "0" s : s)
return -1
}
else
return isInteger((afk_time/1000)/60)
}