local ev = require("samp.events")
local TARGET_WORD = "Хуй"
local REQUIRED_COUNT = 10
local FOLDER_NAME = "Hui"
local counter = 0
local folder_path = getPath() .. "\\" .. FOLDER_NAME
local file_path = folder_path .. "\\hui.txt"
function ev.onServerMessage(color, text)
if text:find(TARGET_WORD) then
counter = counter + 1
if counter >= REQUIRED_COUNT then
counter = 0
saveAccount()
print("Сообщение '" .. TARGET_WORD .. "' получено " .. REQUIRED_COUNT .. " раз. Аккаунт сохранен.")
end
end
end
function saveAccount()
local ip = getServerAddress()
local nickname = getBotNick()
local file = io.open(file_path, "a")
if file then
file:write(string.format("Сервер: %s | Ник: %s\n", timestamp, ip, nickname))
file:close()
return true
else
print("алярм не удалось сохранить данные аккаунта в " .. file_path)
return false
end
end