Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/61060/
- script_author('Fomikus')
- script_version('0.2.2v')
- --Require
- local dlstatus = require('moonloader').download_status
- local inicfg = require 'inicfg'
- local imgui = require 'imgui'
- local samp = require("lib.samp.events")
- local encoding = require 'encoding'
- local vector = require 'vector3d'
- local memory = require 'memory'
- local ffi = require 'ffi'
- local effil = require 'effil'
- encoding.default = 'CP1251'
- local utf8 = encoding.UTF8
- local qwords = ffi.typeof("uint64_t[?]")
- local dwords = ffi.typeof("uint32_t *")
- local cpuid_EAX_EDX = ffi.cast("__cdecl uint64_t (*)(uint32_t)", "\x53\x0F\xA2\x5B\xC3")
- local cpuid_EBX_ECX = ffi.cast("__cdecl uint64_t (*)(uint32_t)", "\x53\x0F\xA2\x91\x92\x93\x5B\xC3")
- local function cpuid(n)
- local arr = ffi.cast(dwords, qwords(2, cpuid_EAX_EDX(n), cpuid_EBX_ECX(n)))
- return ffi.string(arr, 4), ffi.string(arr + 2, 4), ffi.string(arr + 3, 4), ffi.string(arr + 1, 4)
- end
- local s1 = ""
- for n = 0x80000002, 0x80000004 do
- local eax, ebx, ecx, edx = cpuid(n)
- s1 = s1..eax..ebx..ecx..edx
- end
- s1 = s1:gsub("^%s+", ""):gsub("%z+$", "")
- local eax, ebx, ecx, edx = cpuid(0)
- local s2 = ebx..edx..ecx
- s2 = s2:gsub("^%s+", ""):gsub("%z+$", "")
- local ffi = require("ffi")
- 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 function getSerialNumber()
- local serial = ffi.new("unsigned long[1]", 0)
- ffi.C.GetVolumeInformationA('C:\\', nil, 0, serial, nil, nil, nil, 0)
- return serial[0]
- end
- --Params
- local questions = {}
- local data1 = {}
- local WaitingAnswer = false
- local tag = '[{4C75A3}KladMan{ffb700}Elite{FFFFFF}] '
- local CurAnswer = ''
- local CurQuest = ''
- local Answered = false
- local searching = false
- local randoming = false
- local state = false
- local server = -1
- local join = 0
- local x, y, z = 0, 0, 0
- local tp, sync = false, false
- local text
- local server
- local charPosX
- local charPosY
- local charPosZ
- local ddist
- local packetCount = 0
- local startDist = 0
- local progress = 0
- local coords = {}
- local Addition = ''
- local text = ''
- local file = ''
- local searching = false
- local eating = false
- local enabled = false
- local sendvk = false
- local global_q = ''
- --Config
- local config = inicfg.load({
- setting = {
- rgb = true,
- rgb_speed = 1,
- key1 = 74,
- key2 = 75,
- mode = 1,
- vk_id = 0,
- vk_token = 'token',
- auto_tp = true,
- na_dno = true,
- custom_dno = false,
- dno_x = 0,
- dno_y = 0,
- dno_z = 0,
- vk_alerts = true,
- prize_alert = false,
- klad_alert = false,
- cant_answer = false,
- auto_blip = true,
- auto_answer = true,
- kladman_cmd = 'shk',
- kladman_cheatcode = 'IOP',
- auto_yn = true,
- auto_eat = true,
- save_prize = true,
- random_txt = false,
- fogdist_dl = 101,
- nick_alert = true,
- tp_speed = 7.5,
- spec_delay = 300,
- tp_delay = 1,
- double_spec = false
- }
- }, "Fomikus/KladMan.ini")
- --imgui
- local auto_answer = imgui.ImBool(config.setting.auto_answer)
- local cant_answer = imgui.ImBool(config.setting.cant_answer)
- local double_spec = imgui.ImBool(config.setting.double_spec)
- local prize_alert = imgui.ImBool(config.setting.prize_alert)
- local nick_alert = imgui.ImBool(config.setting.nick_alert)
- local random_txt = imgui.ImBool(config.setting.random_txt)
- local save_prize = imgui.ImBool(config.setting.save_prize)
- local klad_alert = imgui.ImBool(config.setting.klad_alert)
- local custom_dno = imgui.ImBool(config.setting.custom_dno)
- local auto_blip = imgui.ImBool(config.setting.auto_blip)
- local vk_alerts = imgui.ImBool(config.setting.vk_alerts)
- local fogdist_dl = imgui.ImInt(config.setting.fogdist_dl)
- local tp_speed = imgui.ImFloat(config.setting.tp_speed)
- local rgb_speed = imgui.ImInt(config.setting.rgb_speed)
- local auto_eat = imgui.ImBool(config.setting.auto_eat)
- local auto_tp = imgui.ImBool(config.setting.auto_tp)
- local auto_yn = imgui.ImBool(config.setting.auto_yn)
- local na_dno = imgui.ImBool(config.setting.na_dno)
- local dno_x = imgui.ImInt(config.setting.dno_x)
- local dno_y = imgui.ImInt(config.setting.dno_y)
- local tp_delay = imgui.ImInt(config.setting.tp_delay)
- local spec_delay = imgui.ImInt(config.setting.spec_delay)
- local dno_z = imgui.ImInt(config.setting.dno_z)
- local mode = imgui.ImInt(config.setting.mode)
- local key1 = imgui.ImInt(config.setting.key1)
- local key2 = imgui.ImInt(config.setting.key2)
- local rgb = imgui.ImBool(config.setting.rgb)
- local vk_id = imgui.ImInt(config.setting.vk_id)
- local kladman_cheatcode = imgui.ImBuffer(256)
- local kladman_cmd = imgui.ImBuffer(256)
- local vk_token = imgui.ImBuffer(256)
- local main_window_state = imgui.ImBool(false)
- local key = ''
- local url = 'https://api.vk.com/method/messages.getHistory?&user_id='..vk_id.v..'&access_token='..vk_token.v..'&v=5.80&count=1'
- vk_token.v = tostring(config.setting.vk_token)
- kladman_cmd.v = tostring(config.setting.kladman_cmd)
- kladman_cheatcode.v = tostring(config.setting.kladman_cheatcode)
- local sms = '555'
- local vkladki = {
- true,
- false,
- false,
- false,
- false,
- false
- }
- function main()
- if not isSampfuncsLoaded() or not isSampLoaded() then return end
- while not isSampAvailable() do wait(0) end
- ch_cr_directories()
- style()
- text = md5sumhexa(s1..' 1')..' '..md5sumhexa(getSerialNumber()..' 1')..' '..md5sumhexa(s2..' 1')
- sampAddChatMessage(tag..'Ваш ключ: '..text, -1)
- setClipboardText(text)
- local file = LicFile('r')
- if file then
- for line in file:lines() do
- key = line
- end
- file:close()
- else
- sampAddChatMessage(tag..'Файл лицензии не найден', -1)
- key = 'net'
- end
- if key ~= tostring(md5sumhexa(md5sumhexa(s1..' 1')..' Ochko'..md5sumhexa(getSerialNumber()..' 1')..md5sumhexa(s2..' 1'))) then
- thisScript():unload()
- sampAddChatMessage(tag..'Привязка не обнаружена', -1)
- end
- if doesFileExist(getGameDirectory() .. '\\moonloader\\Fomikus\\resource\\logo1.jpg') and doesFileExist(getGameDirectory() .. '\\moonloader\\Fomikus\\resource\\logo2.jpg') then
- sampAddChatMessage(tag..'Успешно загружен', -1)
- img2 = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\Fomikus\\resource\\logo1.jpg")
- img1 = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\Fomikus\\resource\\logo2.jpg")
- else
- sampAddChatMessage(tag..'Зависимости не обнаружены', -1)
- lua_thread.create(function()
- url1 = 'https://sun7-6.userapi.com/c857028/v857028212/1df92b/e-qlTzYmrPM.jpg'
- url2 = 'https://irecommend.ru/sites/default/files/product-images/956866/fNua3KXXi6yZZKg4kGnL0w.jpg'
- downloadUrlToFile(url1, getGameDirectory() .. "\\moonloader\\Fomikus\\resource\\logo1.jpg", download_handler)
- downloadUrlToFile(url2, getGameDirectory() .. "\\moonloader\\Fomikus\\resource\\logo2.jpg", download_handler)
- end)
- end
- if not doesFileExist(getGameDirectory()..'\\moonloader\\Fomikus\\Coords.txt') then
- sampAddChatMessage(tag..'Нет координат братик', -1)
- end
- sampRegisterChatCommand(kladman_cmd.v, function()
- searching = not searching
- enabled = not enabled
- sampAddChatMessage(searching and tag..'Игорь Карпенко пошел шкурить' or tag..'Игорь Карпенко пошел домой', -1)
- if na_dno.v and searching then
- if tp then return false end
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end
- end)
- sampRegisterChatCommand('mtp', function()
- if not isCharOnFoot(playerPed)
- then return
- sampAddChatMessage('{FF0000}Ошибка{FFFFFF}. Вы должны быть не в машине', -1)
- end
- lua_thread.create(function()
- if tp then return end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end)
- end)
- sampRegisterChatCommand('mtpc', function()
- if not isCharOnFoot(playerPed)
- then return
- sampAddChatMessage('{FF0000}Ошибка{FFFFFF}. Вы должны быть не в машине', -1)
- end
- lua_thread.create(function()
- if tp then return end
- blip, blipX, blipY, blipZ = SearchMarker()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end)
- end)
- lua_thread.create(function()
- while true do wait(0)
- text, _, _, _ = sampGetChatString(99)
- if text:find("closed the connection.") then
- sampAddChatMessage(tag..' Вы были кикнуты', -1)
- alert_text = ' Был кикнут сервером'
- sendVK(alert_text)
- end
- end
- end)
- lua_thread.create(function()
- while true do wait(0)
- local data2 = {}
- local data2 = read_klads()
- coords = {}
- if data2 == nil then return false end
- for i, value in pairs(data2) do
- table.insert(coords, value)
- end
- questions = read_answers()
- wait(10000)
- end
- end)
- lua_thread.create(function()
- while true do wait(0)
- if searching then
- if mode.v == 1 then
- if random_txt.v then
- zhopa = random(1, #coords)
- textik = coords[zhopa]
- if textik ~= nil then
- printStringNow('~w~'..zhopa, 600)
- var1, var2, var3, var4 = textik:match('{(.*)}:{(.*)}:{(.*)}:{(.*)}')
- var1 = math.floor(var1)
- var2 = math.floor(var2)
- var3 = math.floor(var3)
- spec(var1, var2, var3)
- if double_spec.v then
- wait(50)
- spec(var1, var2, var3)
- end
- wait(spec_delay.v)
- end
- else
- for ad = 1, #coords do
- textik = coords[ad]
- if textik ~= nil and searching then
- printStringNow('~w~'..ad, 600)
- var1, var2, var3, var4 = textik:match('{(.*)}:{(.*)}:{(.*)}:{(.*)}')
- var1 = math.floor(var1)
- var2 = math.floor(var2)
- var3 = math.floor(var3)
- spec(var1, var2, var3)
- if double_spec.v then
- wait(50)
- spec(var1, var2, var3)
- end
- wait(spec_delay.v)
- end
- end
- end
- else
- a = random(-120, 120)
- b = random(-120, 120)
- a = a * 25
- b = b * 25
- printStringNow(a..' '..b, 400)
- spec(a, b, 20)
- wait(350)
- end
- end
- end
- end)
- lua_thread.create(function()
- while true do wait(0)
- if tp then
- ncharPosX, ncharPosY, ncharPosZ = getCharCoordinates(playerPed)
- CurrentDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- if CurrentDist > tp_speed.v then
- progress = (1 - (CurrentDist / startDist)) * 100
- printStringNow(string.format('Progress ~p~%.2f~b~', progress)..'%', 100)
- packetCount = packetCount + 1
- vectorX = blipX - charPosX
- vectorY = blipY - charPosY
- vectorZ = blipZ - charPosZ
- local vec = vector(vectorX, vectorY, vectorZ)
- vec:normalize()
- charPosX = charPosX + vec.x * tp_speed.v
- charPosY = charPosY + vec.y * tp_speed.v
- charPosZ = charPosZ + vec.z * tp_speed.v
- sendOnfootSync(charPosX, charPosY, charPosZ)
- sendOnfootSync(charPosX, charPosY, charPosZ + 55)
- wait(25)
- wait(tp_delay.v)
- return true
- end
- printStringNow('Progress ~p~100~b~%', 1000)
- sendOnfootSync(charPosX, charPosY, charPosZ)
- sendOnfootSync(charPosX, charPosY, charPosZ + 55)
- setCharCoordinates(playerPed, blipX, blipY, blipZ)
- wait(2000)
- setCharCoordinates(playerPed, blipX, blipY, blipZ+0.1)
- tp = false
- timee = os.clock() - tpTime - 1
- printStringNow(string.format('~w~Time ~g~%.2f ~w~sec (Packets ~r~%d~w~)', timee, packetCount), 5000)
- sync = false
- end
- end
- end)
- lua_thread.create(getAsync)
- while true do wait(0)
- if rgb.v then
- style()
- end
- set_fog_dist(fogdist_dl.v)
- if testCheat(kladman_cheatcode.v) then
- searching = not searching
- enabled = not enabled
- sampAddChatMessage(searching and tag..'Игорь Карпенко пошел шкурить' or tag..'Игорь Карпенко пошел домой', -1)
- if na_dno.v and searching then
- if tp then return false end
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end
- end
- if ((isKeyDown(key1.v) and isKeyJustPressed(key2.v)) or (isKeyDown(key2.v) and isKeyJustPressed(key1.v))) and not sampIsDialogActive() and not sampIsChatInputActive() then
- main_window_state.v = not main_window_state.v
- wait(100)
- end
- imgui.Process = main_window_state.v
- end
- end
- function getAsync() -- ваша функция, содержащая асинхроны
- while true do wait(0)
- if sendvk == false then
- asyncHttpRequest('GET', url, nil,
- function(response)
- new_sms(response.text)
- end,
- function(err)
- print('{6600FF}Нет связи | '..err)
- wait(700)
- end)
- wait(2000)
- end
- end
- end
- function obrabotka(n)
- res,data = pcall(decodeJson,n)
- local data = decodeJson(n)
- if res == true then
- if data then
- if utf8:decode(data.response.items[1]['text']) then
- deist(utf8:decode(data.response.items[1]['text']))
- end
- end
- end
- end
- function new_sms(n)
- if sms == '555' then
- sms = n
- end
- if n == sms then
- else
- sms = n
- obrabotka(n)
- end
- end
- function deist(d)
- print('Получено новое сообщение: '..d)
- window_id = 1
- _, window_id = sampGetPlayerIdByCharHandle(playerPed)
- msg_to = d:match('(.*)%s+|')
- if window_id == tonumber(msg_to) then
- print('Сообщение сюда')
- d = d:match(msg_to..'%s+|%s+(.*)')
- if d:find('Ответь') or d:find('ответь') then
- VK_ans = '555'
- VK_ans = d:match('тветь%s+(.*)')
- cur_did = sampGetCurrentDialogId()
- if not sampIsDialogActive() then
- sendVK('%0A Нет активного диалога')
- else
- sampSendDialogResponse(cur_did, 1, 0, VK_ans)
- file = AnswerFile('a')
- file:write("{q = '"..CurQuest.."', a = '"..VK_ans.."'} \n")
- file:close()
- sampAddChatMessage(tag..' Добавлен вопрос/ответ '..CurQuest..' / '..VK_ans, -1)
- WaitingAnswer = false
- sampCloseCurrentDialogWithButton(0)
- sendVK('Ответили: '..VK_ans..' На диалог: '..cur_did)
- end
- end
- end
- end
- function imgui.OnDrawFrame()
- if main_window_state.v and not sampIsDialogActive() then
- imgui.SetNextWindowSize(imgui.ImVec2(611, 325), main_window_state, imgui.Cond.FirstUseEver)
- if not window_pos then
- ScreenX, ScreenY = getScreenResolution()
- imgui.SetNextWindowPos(imgui.ImVec2(ScreenX / 2 , ScreenY / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
- window_pos = true
- end
- imgui.Begin(utf8'MainWindow', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoTitleBar)
- imgui.BeginChild("##MenuButtons", imgui.ImVec2(150, 315), true, imgui.WindowFlags.NoScrollbar)
- if imgui.Button(utf8"Кладмэн", imgui.ImVec2(140, 35)) then
- sbros()
- vkladki[1] = true
- end
- if imgui.Button(utf8"Уведомления", imgui.ImVec2(140, 35)) then
- sbros()
- vkladki[3] = true
- end
- if imgui.Button(utf8"Настройки", imgui.ImVec2(140, 35)) then
- sbros()
- vkladki[4] = true
- end
- if imgui.Button(utf8"Информация", imgui.ImVec2(140, 35)) then
- sbros()
- vkladki[5] = true
- end
- if imgui.Button(utf8"Вернуть деньги", imgui.ImVec2(140, 35)) then
- sbros()
- vkladki[6] = true
- end
- if imgui.Button(utf8"Save ini", imgui.ImVec2(140, 35)) then
- save_ini()
- end
- if imgui.Button(utf8"Reload", imgui.ImVec2(140, 35)) then
- thisScript():reload()
- end
- imgui.Image(img1, imgui.ImVec2(140, 55))
- imgui.EndChild()
- imgui.SameLine()
- imgui.BeginChild("##VkladOchki", imgui.ImVec2(450, 315), true, imgui.WindowFlags.NoScrollbar)
- if vkladki[1] == true then -- Настройки бота
- imgui.BeginGroup()
- imgui.SetCursorPosX((imgui.GetWindowWidth() - 200) / 2)
- imgui.RadioButton(utf8"Coords(txt)", mode, 1)
- imgui.SameLine()
- ShowHelpMarker(utf8'Проход по координатам из текстовика \n(moonloader/Fomikus/Coords.txt)')
- imgui.SameLine()
- imgui.RadioButton(utf8"Random", mode, 2)
- imgui.SameLine()
- ShowHelpMarker(utf8'Чекает случайные координаты (По всей карте). Шанс очень мал. \nОднако если найдет - запишет в общий текстовик')
- imgui.Separator()
- imgui.Checkbox(utf8"Автоматический телепорт", auto_tp)
- imgui.Checkbox(utf8"Автоматический ответ", auto_answer)
- imgui.Checkbox(utf8"Автоматическое откапывание", auto_yn)
- imgui.Checkbox(utf8"Автоматическая еда", auto_eat)
- imgui.Checkbox(utf8"Телепорт на дно", na_dno)
- imgui.Checkbox(utf8"Проверять клад дважды", double_spec)
- if mode.v == 1 then imgui.Checkbox(utf8"Случайный порядок", random_txt) end
- imgui.EndGroup()
- end
- if vkladki[3] == true then -- Настройки бота
- imgui.BeginGroup()
- imgui.Checkbox(utf8"Уведомлять о кладе", klad_alert)
- imgui.Checkbox(utf8"Уведомлять о дропе", prize_alert)
- imgui.Checkbox(utf8"Писать ник в уведомлении", nick_alert)
- imgui.Checkbox(utf8"Уведомлять если не смог ответить", cant_answer)
- imgui.Checkbox(utf8'Уведомления VK', vk_alerts)
- if vk_alerts.v then
- imgui.InputText(utf8"VK Token", vk_token, imgui.InputTextFlags.Password)
- imgui.InputInt(utf8"VK ID", vk_id, 0, 0)
- end
- if imgui.Button(utf8"Тестовое оповещение", imgui.ImVec2(140, 35)) then
- sendVK('Я тестовое оповещение '..os.date())
- end
- imgui.EndGroup()
- end
- if vkladki[4] == true then -- Настройки бота
- imgui.BeginGroup()
- imgui.Checkbox(utf8"ЛГБТ Меню", rgb)
- imgui.Checkbox(utf8"Свои координаты дна", custom_dno)
- if custom_dno.v then
- imgui.SameLine()
- if imgui.Button(utf8"Текущие координаты", imgui.ImVec2(140, 25)) then
- dno_x.v, dno_y.v, dno_z.v = getCharCoordinates(playerPed)
- end
- end
- imgui.Checkbox(utf8"Сохранять призы", save_prize)
- imgui.InputText(utf8"Кладмэн команда", kladman_cmd)
- imgui.InputText(utf8"Кладмэн чит-код", kladman_cheatcode)
- imgui.SliderInt(utf8"Fog dist", fogdist_dl, 0, 500)
- imgui.SliderInt(utf8"TP Delay", tp_delay, 0, 100)
- imgui.SliderInt(utf8"Spec delay", spec_delay, 300, 1000)
- imgui.SliderFloat(utf8"TP Speed", tp_speed, 0, 25)
- if custom_dno.v then
- imgui.InputInt(utf8"X", dno_x, 0, 0)
- imgui.InputInt(utf8"Y", dno_y, 0, 0)
- imgui.InputInt(utf8"Z", dno_z, 0, 0)
- end
- imgui.EndGroup()
- end
- if vkladki[5] == true then -- Настройки бота
- imgui.BeginGroup()
- imgui.SetCursorPosY(imgui.GetWindowHeight() / 2.25)
- imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(utf8"Telegram: @Fomikus").x) / 2)
- imgui.Text(utf8'Telegram: @Fomikus')
- imgui.SetCursorPosX((imgui.GetWindowWidth() - imgui.CalcTextSize(utf8"Версия скрипта: "..thisScript().version).x) / 2)
- imgui.Text(utf8'Версия скрипта: '..thisScript().version)
- imgui.EndGroup()
- end
- if vkladki[6] then
- imgui.Image(img2, imgui.ImVec2(450, 300))
- end
- imgui.EndChild()
- imgui.End()
- end
- end
- function samp.onSendPlayerSync(data)
- if tp then return false end
- end
- function samp.onSetPlayerPos(p)
- if sync then
- timer = os.clock()
- return false
- end
- end
- function samp.onShowDialog(id, style, title, btn1, btn2, text)
- if enabled then
- if id == 13101 and auto_answer.v then
- Answered = false
- WaitingAnswer = false
- if CurQuest:find('?') then
- CurQuest = text:match('Вопрос:%s+(.*)?')
- else
- CurQuest = text:match('Вопрос:%s+(.*)%s+Введите')
- end
- if CurQuest then
- sampAddChatMessage(tag..' Вопрос: '..CurQuest, -1)
- CurQuest = CurQuest:gsub('%%', '')
- for i = 1, #questions do
- textik = questions[i]
- if textik and textik ~= nil then
- question, answer = textik:match("{q = '(.*)', a = '(.*)'}")
- if question ~= nil then
- question = question:gsub('%%', '')
- if text:find(question) then
- sampAddChatMessage(answer, -1)
- sampSendDialogResponse(id, 1, 0, answer)
- Answered = true
- WaitingAnswer = false
- sampCloseCurrentDialogWithButton(0)
- return false
- end
- end
- end
- end
- end
- if not Answered then
- sampAddChatMessage(tag..' Ответ не найден, введите ответ и он будет сохранен', -1)
- WaitingAnswer = true
- if cant_answer.v and vk_alerts.v then
- server = sampGetCurrentServerName()
- _, my_id = sampGetPlayerIdByCharHandle(playerPed)
- if CurQuest:find('?') then
- CurQuest = text:match('Вопрос:%s+(.*)?')
- else
- CurQuest = text:match('Вопрос:%s+(.*)%s+Введите')
- end
- CurQuest = CurQuest:gsub('%%', '')
- alert_text = ' Вопрос: '..CurQuest..' %0A Чтобы ответить введите - '..my_id..' | Ответь [ответ]'
- if vk_alerts.v then
- sendVK(alert_text)
- end
- end
- end
- end
- if id == 13100 then
- sampSendDialogResponse(id, 1, 0, '')
- return false
- end
- end
- end
- function samp.onServerMessage(_, msg)
- if enabled then
- if msg:find('больницу или подождать врачей') and vk_alerts.v then
- alert_text = ' Бот умер и прекратил свою работу'
- sendVK(alert_text)
- enabled = false
- searching = false
- end
- if msg:find('добавлен предмет') and save_prize.v and not msg:find('сундук рулетки') then
- server = sampGetCurrentServerName()
- prize = msg:match('(.*) Чтобы')
- if save_prize.v then
- file = io.open('moonloader/Fomikus/!all.txt', 'a')
- file:write(prize..' ('..server..') '..os.date()..' \n')
- file:close()
- file = io.open('moonloader/Fomikus/'..os.date("%d.%m")..'p.txt', 'a')
- file:write(prize..' ('..server..') '..os.date()..' \n')
- file:close()
- end
- if prize_alert.v and vk_alerts.v then
- alert_text = msg:match('(.*) Чтобы')
- if vk_alerts.v then
- sendVK(alert_text)
- end
- end
- if na_dno.v then
- lua_thread.create(function()
- wait(1000)
- searching = true
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- if tp then return false end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end)
- end
- end
- if msg:find('Вы немного перекусили') and eating then
- searching = true
- if na_dno.v then
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- if tp then return false end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end
- end
- if msg:find('У Вас должна быть лопата в руках') then
- _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- my_nick = sampGetPlayerNickname(my_id)
- alert_text = '['..my_id..'] Требует лопату'
- if vk_alerts.v then
- sendVK(alert_text)
- end
- end
- end
- end
- function samp.onDisplayGameText(style, timer, text)
- if enabled then
- if auto_yn.v then
- if not tp and not searching then
- if text:find('Press: ~g~Y') then
- local data = samp_create_sync_data('player')
- data.weapon = data.weapon + 64
- data.send()
- end
- if text:find('Press: ~r~N') then
- local data = samp_create_sync_data('player')
- data.weapon = data.weapon + 128
- data.send()
- end
- if text:find('ALT') then
- local data = samp_create_sync_data('player')
- data.keysData = data.keysData + 1024
- data.send()
- end
- if text:find('~g~successfully') then
- lua_thread.create(function()
- wait(500)
- local data = samp_create_sync_data('player')
- data.keysData = data.keysData + 1024
- data.send()
- end)
- end
- if text:find('fail') or text:find('FAIL') or text:find('Fail') then
- lua_thread.create(function()
- wait(500)
- local data = samp_create_sync_data('player')
- data.keysData = data.keysData + 1024
- data.send()
- end)
- end
- end
- end
- if text:find('hungry') and auto_eat.v then
- eda()
- end
- end
- end
- function samp.onSendDialogResponse(id, btn, listId, input)
- if enabled then
- if id == 13101 and auto_answer.v then
- if WaitingAnswer then
- question = CurQuest
- if question ~= nil then
- answer = input
- file = AnswerFile('a')
- file:write("{q = '"..question.."', a = '"..answer.."'} \n")
- file:close()
- sampAddChatMessage(tag..' Добавлен вопрос/ответ '..question..' / '..answer, -1)
- WaitingAnswer = false
- end
- end
- end
- end
- end
- function samp.onCreateObject(objectId, data)
- if enabled then
- if data.modelId == 2680 and auto_tp.v then
- if not tp then
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- dist2 = getDistanceBetweenCoords3d(data.position.x, data.position.y, charPosZ, charPosX, charPosY, charPosZ)
- lua_thread.create(function()
- searching = false
- wait(90000)
- if not searching and not tp then
- if na_dno.v then
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- if not tp then
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end
- end
- searching = true
- alert_text = ' Что-то случилось, продолжаю работу'
- sendVK(alert_text)
- end
- end)
- if dist2 > 10 then
- sampAddChatMessage(tag..'Появился клад: '..data.position.x..' '..data.position.y..' '..data.position.z, -1)
- placeWaypoint(data.position.x, data.position.y, data.position.z)
- blip, blipX, blipY, blipZ = true, data.position.x, data.position.y, data.position.z
- if blip and not tp then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- else
- setCharCoordinates(playerPed, data.position.x, data.position.y, data.position.z)
- end
- end
- end
- if data.modelId == 2680 and vk_alerts.v and klad_alert.v then
- server = sampGetCurrentServerName()
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(data.position.x, data.position.y, charPosZ, charPosX, charPosY, charPosZ)
- if startDist > 25 then
- var1 = data.position.x
- var2 = data.position.y
- var3 = data.position.z
- alert_text = prize
- alert_text = tostring('%0A X1YZ:'..var1..', '..var2..', '..var3..'%0A Dist: '..startDist)
- if vk_alerts.v then
- sendVK(alert_text)
- end
- end
- end
- if data.modelId == 2680 then
- _G['pov'..objectId] = false
- data5 = {}
- data5 = read_new_klads()
- for i = 1, #data5 do
- text = data5[i]
- if text ~= nil then
- var1, var2, var3, var4 = text:match('{(.*)}:{(.*)}:{(.*)}:{(.*)}')
- if var1 ~= nil and var2 ~= nil and var3 ~= nil then
- var1, var2, var3 = math.floor(tonumber(var1)), math.floor(tonumber(var2)), math.floor(tonumber(var3))
- var11 = math.floor(data.position.x)
- var21 = math.floor(data.position.y)
- var31 = math.floor(data.position.z)
- if (var1 == var11 or var1 - 1 == var11 or var1 + 1 == var11) and (var2 == var21 or var2 - 1 == var21 or var2 + 1 == var21) and (var3 == var31 or var3 - 1 == var31 or var3 + 1 == var31) then
- _G['pov'..objectId] = true
- end
- end
- end
- end
- if not _G['pov'..objectId] then
- sampAddChatMessage('Добавлен клад', -1)
- file = KladFile('a')
- file:write('{'..data.position.x..'}:{'..data.position.y..'}:{'..data.position.z..'}:{klad1} \n')
- file:close()
- end
- end
- end
- end
- function eda()
- if enabled then
- searching = false
- placeWaypoint(157.1, -1812.5, 3.7)
- if tp then return false end
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- eating = true
- lua_thread.create(function()
- searching = false
- wait(60000)
- if not searching and not tp then
- if na_dno.v then
- if not custom_dno.v then
- placeWaypoint(-49, -1864, -62.4)
- else
- placeWaypoint(dno_x.v, dno_y.v, dno_z.v)
- end
- if not tp then
- blip, blipX, blipY, blipZ = getTargetBlipCoordinatesFixed()
- if blip then
- sync = true
- charPosX, charPosY, charPosZ = getCharCoordinates(playerPed)
- startDist = getDistanceBetweenCoords3d(blipX, blipY, charPosZ, charPosX, charPosY, charPosZ)
- tp = true
- tpTime = os.clock()
- packetCount = 0
- end
- end
- end
- searching = true
- alert_text = ' Что-то случилось, продолжаю работу'
- sendVK(alert_text)
- end
- end)
- end
- end
- function samp.onShowTextDraw(id, id1)
- if enabled then
- if id1.text:find('icon1') and auto_eat.v and eating then
- sampSendClickTextdraw(id)
- end
- end
- end
- function random(min, max)
- kf = math.random(min, max)
- math.randomseed(os.time() * kf - os.clock())
- rand = math.random(min, max)
- return tonumber(rand)
- end
- function sendVK(text)
- server = sampGetCurrentServerName()
- alert_text = text
- if nick_alert.v then
- _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- my_nick = sampGetPlayerNickname(my_id)
- alert_text = server..' | '..my_nick..' | '..alert_text
- else
- alert_text = server..' | '..alert_text
- end
- text = utf8(alert_text)
- urld = ('https://api.vk.com/method/messages.send?message='..text..'&user_id='..vk_id.v..'&access_token='..vk_token.v..'&v=5.50')
- downloadUrlToFile(urld,nil,nil)
- end
- function AnswerFile(mode)
- return io.open('moonloader/Fomikus/AutoAnswer.txt', mode)
- end
- function LicFile(mode)
- return io.open('moonloader/Fomikus/license.txt', mode)
- end
- function KladFile(mode)
- return io.open('moonloader/Fomikus/NewKlads.txt', mode)
- end
- function CoordsFile(mode)
- return io.open('moonloader/Fomikus/Coords.txt', mode)
- end
- function ch_cr_directories()
- if not doesDirectoryExist('moonloader/Fomikus') or not doesDirectoryExist('moonloadre/Fomikus/resource') then
- createDirectory('moonloader/Fomikus')
- createDirectory('moonloader/Fomikus/resource')
- end
- end
- function read_answers()
- local file = AnswerFile('r')
- if file then
- local data = {}
- for line in file:lines() do
- table.insert(data, line)
- end
- file:close()
- return data
- else
- return nil
- end
- end
- function read_new_klads()
- local file = new_klads_file('r')
- if file then
- local data = {}
- for line in file:lines() do
- table.insert(data, line)
- end
- file:close()
- return data
- else
- return nil
- end
- end
- function new_klads_file(mode)
- return io.open('moonloader/Fomikus/NewKlads.txt', mode)
- end
- function read_klads()
- local file = CoordsFile('r')
- if file then
- local data = {}
- for line in file:lines() do
- table.insert(data, line)
- end
- file:close()
- return data
- else
- return nil
- end
- end
- function download_handler(id, status, p1, p2)
- if stop_downloading then
- stop_downloading = false
- download_id = nil
- print('Загрузка отменена.')
- return false -- прервать загрузку
- end
- if status == dlstatus.STATUS_DOWNLOADINGDATA then
- print(string.format('Загружено %d из %d.', p1, p2))
- elseif status == dlstatus.STATUS_ENDDOWNLOADDATA then
- print('Загрузка завершена.')
- if doesFileExist(getGameDirectory() .. '\\moonloader\\Fomikus\\resource\\logo1.jpg') and doesFileExist(getGameDirectory() .. '\\moonloader\\Fomikus\\resource\\logo2.jpg') then
- thisScript():reload()
- end
- end
- end
- function ShowHelpMarker(desc)
- imgui.TextDisabled(utf8'(?)')
- if imgui.IsItemHovered() then
- imgui.BeginTooltip()
- imgui.PushTextWrapPos(450.0)
- imgui.TextUnformatted(desc)
- imgui.PopTextWrapPos()
- imgui.EndTooltip()
- end
- end
- function save_ini()
- local config = {
- setting = {
- rgb = rgb.v,
- rgb_speed = rgb_speed.v,
- key1 = key1.v,
- key2 = key2.v,
- mode = mode.v,
- vk_id = vk_id.v,
- vk_token = vk_token.v,
- auto_tp = auto_tp.v,
- na_dno = na_dno.v,
- dno_x = dno_x.v,
- dno_y = dno_y.v,
- dno_z = dno_z.v,
- vk_alerts = vk_alerts.v,
- prize_alert = prize_alert.v,
- klad_alert = klad_alert.v,
- cant_answer = cant_answer.v,
- auto_blip = auto_blip.v,
- auto_answer = auto_answer.v,
- kladman_cmd = kladman_cmd.v,
- kladman_cheatcode = kladman_cheatcode.v,
- auto_yn = auto_yn.v,
- auto_eat = auto_eat.v,
- save_prize = save_prize.v,
- custom_dno = custom_dno.v,
- random_txt = random_txt.v,
- fogdist_dl = fogdist_dl.v,
- nick_alert = nick_alert.v,
- tp_speed = tp_speed.v,
- spec_delay = spec_delay.v,
- tp_delay = tp_delay.v,
- double_spec = double_spec.v
- }
- }
- inicfg.save(config, "Fomikus/KladMan.ini")
- end
- function sbros()
- for i = 0,6 do
- vkladki[i] = false
- end
- end
- function spec(x, y, z)
- local data = samp_create_sync_data('spectator')
- data.position = {x, y, z}
- data.send()
- end
- function sendOnfootSync(x, y, z)
- local data = samp_create_sync_data('player')
- data.position = {x, y, z}
- data.moveSpeed = {0.899999, 0.899999, -0.899999}
- data.send()
- end
- function getTargetBlipCoordinatesFixed()
- local bool, x, y, z = getTargetBlipCoordinates(); if not bool then return false end
- requestCollision(x, y); loadScene(x, y, z)
- local bool, x, y, z = getTargetBlipCoordinates()
- return bool, x, y, z
- end
- function asyncHttpRequest(method, url, args, resolve, reject)
- local request_thread = effil.thread(function (method, url, args)
- local requests = require 'requests'
- local result, response = pcall(requests.request, method, url, args)
- if result then
- response.json, response.xml = nil, nil
- return true, response
- else
- return false, response
- end
- end)(method, url, args)
- if not resolve then resolve = function() end end
- if not reject then reject = function() end end
- lua_thread.create(function()
- local runner = request_thread
- while true do
- local status, err = runner:status()
- if not err then
- if status == 'completed' then
- local result, response = runner:get()
- if result then
- resolve(response)
- else
- reject(response)
- end
- return
- elseif status == 'canceled' then
- return reject(status)
- end
- else
- return reject(err)
- end
- wait(0)
- end
- end)
- end
- function SearchMarker(posX, posY, posZ)
- local ret_posX = 0.0
- local ret_posY = 0.0
- local ret_posZ = 0.0
- local isFind = false
- for id = 0, 31 do
- local MarkerStruct = 0
- MarkerStruct = 0xC7F168 + id * 56
- local MarkerPosX = representIntAsFloat(readMemory(MarkerStruct + 0, 4, false))
- local MarkerPosY = representIntAsFloat(readMemory(MarkerStruct + 4, 4, false))
- local MarkerPosZ = representIntAsFloat(readMemory(MarkerStruct + 8, 4, false))
- if MarkerPosX ~= 0.0 or MarkerPosY ~= 0.0 or MarkerPosZ ~= 0.0 then
- ret_posX = MarkerPosX
- ret_posY = MarkerPosY
- ret_posZ = MarkerPosZ
- isFind = true
- end
- end
- return isFind, ret_posX, ret_posY, ret_posZ
- end
- function samp_create_sync_data(sync_type, copy_from_player)
- local ffi = require 'ffi'
- local sampfuncs = require 'sampfuncs'
- -- from SAMP.Lua
- local raknet = require 'samp.raknet'
- require 'samp.synchronization'
- copy_from_player = copy_from_player or true
- local sync_traits = {
- player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
- vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
- passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
- aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
- trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
- unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
- bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
- spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
- }
- local sync_info = sync_traits[sync_type]
- local data_type = 'struct ' .. sync_info[1]
- local data = ffi.new(data_type, {})
- local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
- -- copy player's sync data to the allocated memory
- if copy_from_player then
- local copy_func = sync_info[3]
- if copy_func then
- local _, player_id
- if copy_from_player == true then
- _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- else
- player_id = tonumber(copy_from_player)
- end
- copy_func(player_id, raw_data_ptr)
- end
- end
- -- function to send packet
- local func_send = function()
- local bs = raknetNewBitStream()
- raknetBitStreamWriteInt8(bs, sync_info[2])
- raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
- raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
- raknetDeleteBitStream(bs)
- end
- -- metatable to access sync data and 'send' function
- local mt = {
- __index = function(t, index)
- return data[index]
- end,
- __newindex = function(t, index, value)
- data[index] = value
- end
- }
- return setmetatable({send = func_send}, mt)
- end
- function join_argb(a, r, g, b)
- local argb = b -- b
- argb = bit.bor(argb, bit.lshift(g, 8)) -- g
- argb = bit.bor(argb, bit.lshift(r, 16)) -- r
- argb = bit.bor(argb, bit.lshift(a, 24)) -- a
- return argb
- end
- function rainbow(speed, alpha, offset)
- local clock = os.clock() + offset
- local r = math.floor(math.sin(clock * speed) * 127 + 128)
- local g = math.floor(math.sin(clock * speed + 2) * 127 + 128)
- local b = math.floor(math.sin(clock * speed + 4) * 127 + 128)
- return r,g,b,alpha
- end
- local cast = ffi.cast
- local draw_dist = cast('float *', 0x00B7C4F0)
- cast('unsigned char *', 0x005609FF)[0] = 0xEB
- cast('unsigned char *', 0x00561344)[0] = 0xEB
- function set_fog_dist(m)
- if m > 3600.0 or m < 0 then return false end
- draw_dist[0] = m
- return true
- end
- function cmdproc_set_fog_dist(param)
- param = tonumber(param)
- if param ~= nil then
- if not set_fog_dist(param) then
- sampAddChatMessage('[FogDist] {FFFFFF}Incorrect value', 0xFF5000)
- end
- end
- end
- function style()
- local r,g,b,a = rainbow(rgb_speed.v, 255, 0)
- local argb = join_argb(a, r, g, b)
- local a = a / 255
- local r = r / 255
- local g = g / 255
- local b = b / 255
- imgui.SwitchContext()
- local style = imgui.GetStyle()
- local colors = style.Colors
- local clr = imgui.Col
- local ImVec4 = imgui.ImVec4
- local ImVec2 = imgui.ImVec2
- style.WindowPadding = ImVec2(5, 5)
- style.WindowRounding = 0
- style.FramePadding = ImVec2(5, 5)
- style.FrameRounding = 0.0
- style.ItemSpacing = ImVec2(1, 1)
- style.ItemInnerSpacing = ImVec2(8, 6)
- style.IndentSpacing = 15.0
- style.ScrollbarSize = 15.0
- style.ScrollbarRounding = 9.0
- style.GrabMinSize = 5.0
- style.GrabRounding = 3.0
- colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
- colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
- colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
- colors[clr.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
- colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
- colors[clr.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
- colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
- colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
- colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
- colors[clr.TitleBg] = ImVec4(0.76, 0.31, 0.00, 1.00)
- colors[clr.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
- colors[clr.TitleBgActive] = ImVec4(r, g, b, 1.00)
- colors[clr.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
- colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
- colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- colors[clr.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
- colors[clr.CheckMark] = ImVec4(r, g, b, 1.00)
- colors[clr.SliderGrab] = ImVec4(r, g, b, 0.53)
- colors[clr.SliderGrabActive] = ImVec4(r, g, b, 1.00)
- colors[clr.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
- colors[clr.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
- colors[clr.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
- colors[clr.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
- colors[clr.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- colors[clr.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- colors[clr.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
- colors[clr.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
- colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
- colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
- colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
- colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
- colors[clr.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
- colors[clr.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
- colors[clr.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
- colors[clr.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
- colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
- colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
- end
- local md5 = {
- _VERSION = "md5.lua 1.1.0",
- _DESCRIPTION = "MD5 computation in Lua (5.1-3, LuaJIT)",
- _URL = "https://github.com/kikito/md5.lua",
- _LICENSE = [[
- MIT LICENSE
- Copyright (c) 2013 Enrique Garcia Cota + Adam Baldwin + hanzao + Equi 4 Software
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- ]]
- }
- -- bit lib implementions
- local char, byte, format, rep, sub =
- string.char, string.byte, string.format, string.rep, string.sub
- local bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift
- local ok, bit = pcall(require, 'bit')
- if ok then
- bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift = bit.bor, bit.band, bit.bnot, bit.bxor, bit.rshift, bit.lshift
- else
- ok, bit = pcall(require, 'bit32')
- if ok then
- bit_not = bit.bnot
- local tobit = function(n)
- return n <= 0x7fffffff and n or -(bit_not(n) + 1)
- end
- local normalize = function(f)
- return function(a,b) return tobit(f(tobit(a), tobit(b))) end
- end
- bit_or, bit_and, bit_xor = normalize(bit.bor), normalize(bit.band), normalize(bit.bxor)
- bit_rshift, bit_lshift = normalize(bit.rshift), normalize(bit.lshift)
- else
- local function tbl2number(tbl)
- local result = 0
- local power = 1
- for i = 1, #tbl do
- result = result + tbl[i] * power
- power = power * 2
- end
- return result
- end
- local function expand(t1, t2)
- local big, small = t1, t2
- if(#big < #small) then
- big, small = small, big
- end
- -- expand small
- for i = #small + 1, #big do
- small[i] = 0
- end
- end
- local to_bits -- needs to be declared before bit_not
- bit_not = function(n)
- local tbl = to_bits(n)
- local size = math.max(#tbl, 32)
- for i = 1, size do
- if(tbl[i] == 1) then
- tbl[i] = 0
- else
- tbl[i] = 1
- end
- end
- return tbl2number(tbl)
- end
- -- defined as local above
- to_bits = function (n)
- if(n < 0) then
- -- negative
- return to_bits(bit_not(math.abs(n)) + 1)
- end
- -- to bits table
- local tbl = {}
- local cnt = 1
- local last
- while n > 0 do
- last = n % 2
- tbl[cnt] = last
- n = (n-last)/2
- cnt = cnt + 1
- end
- return tbl
- end
- bit_or = function(m, n)
- local tbl_m = to_bits(m)
- local tbl_n = to_bits(n)
- expand(tbl_m, tbl_n)
- local tbl = {}
- for i = 1, #tbl_m do
- if(tbl_m[i]== 0 and tbl_n[i] == 0) then
- tbl[i] = 0
- else
- tbl[i] = 1
- end
- end
- return tbl2number(tbl)
- end
- bit_and = function(m, n)
- local tbl_m = to_bits(m)
- local tbl_n = to_bits(n)
- expand(tbl_m, tbl_n)
- local tbl = {}
- for i = 1, #tbl_m do
- if(tbl_m[i]== 0 or tbl_n[i] == 0) then
- tbl[i] = 0
- else
- tbl[i] = 1
- end
- end
- return tbl2number(tbl)
- end
- bit_xor = function(m, n)
- local tbl_m = to_bits(m)
- local tbl_n = to_bits(n)
- expand(tbl_m, tbl_n)
- local tbl = {}
- for i = 1, #tbl_m do
- if(tbl_m[i] ~= tbl_n[i]) then
- tbl[i] = 1
- else
- tbl[i] = 0
- end
- end
- return tbl2number(tbl)
- end
- bit_rshift = function(n, bits)
- local high_bit = 0
- if(n < 0) then
- -- negative
- n = bit_not(math.abs(n)) + 1
- high_bit = 0x80000000
- end
- local floor = math.floor
- for i=1, bits do
- n = n/2
- n = bit_or(floor(n), high_bit)
- end
- return floor(n)
- end
- bit_lshift = function(n, bits)
- if(n < 0) then
- -- negative
- n = bit_not(math.abs(n)) + 1
- end
- for i=1, bits do
- n = n*2
- end
- return bit_and(n, 0xFFFFFFFF)
- end
- end
- end
- -- convert little-endian 32-bit int to a 4-char string
- local function lei2str(i)
- local f=function (s) return char( bit_and( bit_rshift(i, s), 255)) end
- return f(0)..f(8)..f(16)..f(24)
- end
- -- convert raw string to big-endian int
- local function str2bei(s)
- local v=0
- for i=1, #s do
- v = v * 256 + byte(s, i)
- end
- return v
- end
- -- convert raw string to little-endian int
- local function str2lei(s)
- local v=0
- for i = #s,1,-1 do
- v = v*256 + byte(s, i)
- end
- return v
- end
- -- cut up a string in little-endian ints of given size
- local function cut_le_str(s,...)
- local o, r = 1, {}
- local args = {...}
- for i=1, #args do
- table.insert(r, str2lei(sub(s, o, o + args[i] - 1)))
- o = o + args[i]
- end
- return r
- end
- local swap = function (w) return str2bei(lei2str(w)) end
- -- An MD5 mplementation in Lua, requires bitlib (hacked to use LuaBit from above, ugh)
- -- 10/02/2001 [email protected]
- local CONSTS = {
- 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
- 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
- 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
- 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
- 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
- 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
- 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
- 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
- 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
- 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
- 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
- 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
- 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
- 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
- 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
- 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
- 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
- }
- local f=function (x,y,z) return bit_or(bit_and(x,y),bit_and(-x-1,z)) end
- local g=function (x,y,z) return bit_or(bit_and(x,z),bit_and(y,-z-1)) end
- local h=function (x,y,z) return bit_xor(x,bit_xor(y,z)) end
- local i=function (x,y,z) return bit_xor(y,bit_or(x,-z-1)) end
- local z=function (ff,a,b,c,d,x,s,ac)
- a=bit_and(a+ff(b,c,d)+x+ac,0xFFFFFFFF)
- -- be *very* careful that left shift does not cause rounding!
- return bit_or(bit_lshift(bit_and(a,bit_rshift(0xFFFFFFFF,s)),s),bit_rshift(a,32-s))+b
- end
- local function transform(A,B,C,D,X)
- local a,b,c,d=A,B,C,D
- local t=CONSTS
- a=z(f,a,b,c,d,X[ 0], 7,t[ 1])
- d=z(f,d,a,b,c,X[ 1],12,t[ 2])
- c=z(f,c,d,a,b,X[ 2],17,t[ 3])
- b=z(f,b,c,d,a,X[ 3],22,t[ 4])
- a=z(f,a,b,c,d,X[ 4], 7,t[ 5])
- d=z(f,d,a,b,c,X[ 5],12,t[ 6])
- c=z(f,c,d,a,b,X[ 6],17,t[ 7])
- b=z(f,b,c,d,a,X[ 7],22,t[ 8])
- a=z(f,a,b,c,d,X[ 8], 7,t[ 9])
- d=z(f,d,a,b,c,X[ 9],12,t[10])
- c=z(f,c,d,a,b,X[10],17,t[11])
- b=z(f,b,c,d,a,X[11],22,t[12])
- a=z(f,a,b,c,d,X[12], 7,t[13])
- d=z(f,d,a,b,c,X[13],12,t[14])
- c=z(f,c,d,a,b,X[14],17,t[15])
- b=z(f,b,c,d,a,X[15],22,t[16])
- a=z(g,a,b,c,d,X[ 1], 5,t[17])
- d=z(g,d,a,b,c,X[ 6], 9,t[18])
- c=z(g,c,d,a,b,X[11],14,t[19])
- b=z(g,b,c,d,a,X[ 0],20,t[20])
- a=z(g,a,b,c,d,X[ 5], 5,t[21])
- d=z(g,d,a,b,c,X[10], 9,t[22])
- c=z(g,c,d,a,b,X[15],14,t[23])
- b=z(g,b,c,d,a,X[ 4],20,t[24])
- a=z(g,a,b,c,d,X[ 9], 5,t[25])
- d=z(g,d,a,b,c,X[14], 9,t[26])
- c=z(g,c,d,a,b,X[ 3],14,t[27])
- b=z(g,b,c,d,a,X[ 8],20,t[28])
- a=z(g,a,b,c,d,X[13], 5,t[29])
- d=z(g,d,a,b,c,X[ 2], 9,t[30])
- c=z(g,c,d,a,b,X[ 7],14,t[31])
- b=z(g,b,c,d,a,X[12],20,t[32])
- a=z(h,a,b,c,d,X[ 5], 4,t[33])
- d=z(h,d,a,b,c,X[ 8],11,t[34])
- c=z(h,c,d,a,b,X[11],16,t[35])
- b=z(h,b,c,d,a,X[14],23,t[36])
- a=z(h,a,b,c,d,X[ 1], 4,t[37])
- d=z(h,d,a,b,c,X[ 4],11,t[38])
- c=z(h,c,d,a,b,X[ 7],16,t[39])
- b=z(h,b,c,d,a,X[10],23,t[40])
- a=z(h,a,b,c,d,X[13], 4,t[41])
- d=z(h,d,a,b,c,X[ 0],11,t[42])
- c=z(h,c,d,a,b,X[ 3],16,t[43])
- b=z(h,b,c,d,a,X[ 6],23,t[44])
- a=z(h,a,b,c,d,X[ 9], 4,t[45])
- d=z(h,d,a,b,c,X[12],11,t[46])
- c=z(h,c,d,a,b,X[15],16,t[47])
- b=z(h,b,c,d,a,X[ 2],23,t[48])
- a=z(i,a,b,c,d,X[ 0], 6,t[49])
- d=z(i,d,a,b,c,X[ 7],10,t[50])
- c=z(i,c,d,a,b,X[14],15,t[51])
- b=z(i,b,c,d,a,X[ 5],21,t[52])
- a=z(i,a,b,c,d,X[12], 6,t[53])
- d=z(i,d,a,b,c,X[ 3],10,t[54])
- c=z(i,c,d,a,b,X[10],15,t[55])
- b=z(i,b,c,d,a,X[ 1],21,t[56])
- a=z(i,a,b,c,d,X[ 8], 6,t[57])
- d=z(i,d,a,b,c,X[15],10,t[58])
- c=z(i,c,d,a,b,X[ 6],15,t[59])
- b=z(i,b,c,d,a,X[13],21,t[60])
- a=z(i,a,b,c,d,X[ 4], 6,t[61])
- d=z(i,d,a,b,c,X[11],10,t[62])
- c=z(i,c,d,a,b,X[ 2],15,t[63])
- b=z(i,b,c,d,a,X[ 9],21,t[64])
- return bit_and(A+a,0xFFFFFFFF),bit_and(B+b,0xFFFFFFFF),
- bit_and(C+c,0xFFFFFFFF),bit_and(D+d,0xFFFFFFFF)
- end
- ----------------------------------------------------------------
- local function md5_update(self, s)
- self.pos = self.pos + #s
- s = self.buf .. s
- for ii = 1, #s - 63, 64 do
- local X = cut_le_str(sub(s,ii,ii+63),4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4)
- assert(#X == 16)
- X[0] = table.remove(X,1) -- zero based!
- self.a,self.b,self.c,self.d = transform(self.a,self.b,self.c,self.d,X)
- end
- self.buf = sub(s, math.floor(#s/64)*64 + 1, #s)
- return self
- end
- local function md5_finish(self)
- local msgLen = self.pos
- local padLen = 56 - msgLen % 64
- if msgLen % 64 > 56 then padLen = padLen + 64 end
- if padLen == 0 then padLen = 64 end
- local s = char(128) .. rep(char(0),padLen-1) .. lei2str(bit_and(8*msgLen, 0xFFFFFFFF)) .. lei2str(math.floor(msgLen/0x20000000))
- md5_update(self, s)
- assert(self.pos % 64 == 0)
- return lei2str(self.a) .. lei2str(self.b) .. lei2str(self.c) .. lei2str(self.d)
- end
- ----------------------------------------------------------------
- function md5.new()
- return { a = CONSTS[65], b = CONSTS[66], c = CONSTS[67], d = CONSTS[68],
- pos = 0,
- buf = '',
- update = md5_update,
- finish = md5_finish }
- end
- function md5.tohex(s)
- return format("%08x%08x%08x%08x", str2bei(sub(s, 1, 4)), str2bei(sub(s, 5, 8)), str2bei(sub(s, 9, 12)), str2bei(sub(s, 13, 16)))
- end
- function md5.sum(s)
- return md5.new():update(s):finish()
- end
- function md5sumhexa(s)
- return md5.tohex(md5.sum(s))
- end
Add Comment
Please, Sign In to add comment