Исходник J-Helper

Сырник

Известный
225
80
Lua:
script_name('HelperLovli')
script_author('#leomasker')
local version = 'test-release'

local MASLOSYKA = {"Family", "Dynasty", "Corporation", "Squad", "Crew", "Empire", "Brotherhood"}
local q = require 'lib.samp.events'
local inicfg = require 'inicfg'
local vkeys = require 'vkeys'
local imgui = require 'imgui'
local mem = require 'memory'
local bNotf, notf = pcall(import, "imgui_notf.lua")
local time = nil
local captime = nil
local hfind = 0
local forFind = {}
local houses = {}
local t = 0
local payday = false
local captcha = ''
local captchaTable = {}

local HLcfg = inicfg.load({
    main = {
        activation = 'helper',
        nClear = false,
        jtext = 'j family naxyi',
        resetpd = false,
        utime = false,
        ptime = false,
        HLmsg = false,
        max5 = false,
        plus3click = false,
        floodN = false,
        autofind = false,
        onkey = false,
        key = 'U',
        texttime = false,
        theme = 1,
        autoenter = false
    }
}, "HelperLovli")

local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local tags = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
buffer = imgui.ImBuffer(tostring(HLcfg.main.jtext), 256)
buffer.v = string.gsub(tostring(buffer.v), '"', '')
keybuff = imgui.ImBuffer(tostring(HLcfg.main.key), 5)
buffermenu = imgui.ImBuffer(tostring(HLcfg.main.activation), 256)

function apply_custom_style()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    local Colors = style.Colors
    local ImVec4 = imgui.ImVec4
    local ImVec2 = imgui.ImVec2
    style.Alpha = 1
    style.ChildWindowRounding = 15
    style.WindowRounding = 15
    style.GrabRounding = 15
    style.GrabMinSize = 20
    style.FrameRounding = 10
    Colors[imgui.Col.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
    Colors[imgui.Col.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
    Colors[imgui.Col.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
    Colors[imgui.Col.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
    Colors[imgui.Col.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
    Colors[imgui.Col.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
    Colors[imgui.Col.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
    Colors[imgui.Col.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
    Colors[imgui.Col.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
    Colors[imgui.Col.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
    Colors[imgui.Col.TitleBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
    Colors[imgui.Col.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
    Colors[imgui.Col.TitleBgActive] = ImVec4(0.07, 0.07, 0.09, 1.00)
    Colors[imgui.Col.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
    Colors[imgui.Col.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
    Colors[imgui.Col.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
    Colors[imgui.Col.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
    Colors[imgui.Col.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
    Colors[imgui.Col.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
    Colors[imgui.Col.CheckMark] = ImVec4(0.80, 0.80, 0.83, 0.31)
    Colors[imgui.Col.SliderGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
    Colors[imgui.Col.SliderGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
    Colors[imgui.Col.Button] = ImVec4(0.15, 0.15, 0.18, 1.00)
    Colors[imgui.Col.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
    Colors[imgui.Col.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
    Colors[imgui.Col.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
    Colors[imgui.Col.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
    Colors[imgui.Col.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
    Colors[imgui.Col.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
    Colors[imgui.Col.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
    Colors[imgui.Col.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
    Colors[imgui.Col.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
    Colors[imgui.Col.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
    Colors[imgui.Col.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
    Colors[imgui.Col.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
    Colors[imgui.Col.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
    Colors[imgui.Col.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
    Colors[imgui.Col.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
    Colors[imgui.Col.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
    Colors[imgui.Col.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end

function lightBlue()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    colors[clr.Text]   = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.TextDisabled]   = ImVec4(0.24, 0.24, 0.24, 1.00)
    colors[clr.WindowBg]              = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.ChildWindowBg]         = ImVec4(0.96, 0.96, 0.96, 1.00)
    colors[clr.PopupBg]               = ImVec4(0.92, 0.92, 0.92, 1.00)
    colors[clr.Border]                = ImVec4(0.86, 0.86, 0.86, 1.00)
    colors[clr.BorderShadow]          = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]               = ImVec4(0.88, 0.88, 0.88, 1.00)
    colors[clr.FrameBgHovered]        = ImVec4(0.82, 0.82, 0.82, 1.00)
    colors[clr.FrameBgActive]         = ImVec4(0.76, 0.76, 0.76, 1.00)
    colors[clr.TitleBg]               = ImVec4(0.00, 0.45, 1.00, 0.82)
    colors[clr.TitleBgCollapsed]      = ImVec4(0.00, 0.45, 1.00, 0.82)
    colors[clr.TitleBgActive]         = ImVec4(0.00, 0.45, 1.00, 0.82)
    colors[clr.MenuBarBg]             = ImVec4(0.00, 0.37, 0.78, 1.00)
    colors[clr.ScrollbarBg]           = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.ScrollbarGrab]         = ImVec4(0.00, 0.35, 1.00, 0.78)
    colors[clr.ScrollbarGrabHovered]  = ImVec4(0.00, 0.33, 1.00, 0.84)
    colors[clr.ScrollbarGrabActive]   = ImVec4(0.00, 0.31, 1.00, 0.88)
    colors[clr.ComboBg]               = ImVec4(0.92, 0.92, 0.92, 1.00)
    colors[clr.CheckMark]             = ImVec4(0.00, 0.49, 1.00, 0.59)
    colors[clr.SliderGrab]            = ImVec4(0.00, 0.49, 1.00, 0.59)
    colors[clr.SliderGrabActive]      = ImVec4(0.00, 0.39, 1.00, 0.71)
    colors[clr.Button]                = ImVec4(0.00, 0.49, 1.00, 0.59)
    colors[clr.ButtonHovered]         = ImVec4(0.00, 0.49, 1.00, 0.71)
    colors[clr.ButtonActive]          = ImVec4(0.00, 0.49, 1.00, 0.78)
    colors[clr.Header]                = ImVec4(0.00, 0.49, 1.00, 0.78)
    colors[clr.HeaderHovered]         = ImVec4(0.00, 0.49, 1.00, 0.71)
    colors[clr.HeaderActive]          = ImVec4(0.00, 0.49, 1.00, 0.78)
    colors[clr.ResizeGrip]            = ImVec4(0.00, 0.39, 1.00, 0.59)
    colors[clr.ResizeGripHovered]     = ImVec4(0.00, 0.27, 1.00, 0.59)
    colors[clr.ResizeGripActive]      = ImVec4(0.00, 0.25, 1.00, 0.63)
    colors[clr.CloseButton]           = ImVec4(0.00, 0.35, 0.96, 0.71)
    colors[clr.CloseButtonHovered]    = ImVec4(0.00, 0.31, 0.88, 0.69)
    colors[clr.CloseButtonActive]     = ImVec4(0.00, 0.25, 0.88, 0.67)
    colors[clr.PlotLines]             = ImVec4(0.00, 0.39, 1.00, 0.75)
    colors[clr.PlotLinesHovered]      = ImVec4(0.00, 0.39, 1.00, 0.75)
    colors[clr.PlotHistogram]         = ImVec4(0.00, 0.39, 1.00, 0.75)
    colors[clr.PlotHistogramHovered]  = ImVec4(0.00, 0.35, 0.92, 0.78)
    colors[clr.TextSelectedBg]        = ImVec4(0.00, 0.47, 1.00, 0.59)
    colors[clr.ModalWindowDarkening]  = ImVec4(0.20, 0.20, 0.20, 0.35)
end

function redTheme()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    style.WindowRounding = 2.0
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
    style.ChildWindowRounding = 2.0
    style.FrameRounding = 2.0
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0

    colors[clr.FrameBg] = ImVec4(0.48, 0.16, 0.16, 0.54)
    colors[clr.FrameBgHovered] = ImVec4(0.98, 0.26, 0.26, 0.40)
    colors[clr.FrameBgActive] = ImVec4(0.98, 0.26, 0.26, 0.67)
    colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive] = ImVec4(0.48, 0.16, 0.16, 1.00)
    colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark] = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.SliderGrab] = ImVec4(0.88, 0.26, 0.24, 1.00)
    colors[clr.SliderGrabActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Button] = ImVec4(0.98, 0.26, 0.26, 0.40)
    colors[clr.ButtonHovered] = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.ButtonActive] = ImVec4(0.98, 0.06, 0.06, 1.00)
    colors[clr.Header] = ImVec4(0.98, 0.26, 0.26, 0.31)
    colors[clr.HeaderHovered] = ImVec4(0.98, 0.26, 0.26, 0.80)
    colors[clr.HeaderActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
    colors[clr.Separator] = colors[clr.Border]
    colors[clr.SeparatorHovered] = ImVec4(0.75, 0.10, 0.10, 0.78)
    colors[clr.SeparatorActive] = ImVec4(0.75, 0.10, 0.10, 1.00)
    colors[clr.ResizeGrip] = ImVec4(0.98, 0.26, 0.26, 0.25)
    colors[clr.ResizeGripHovered] = ImVec4(0.98, 0.26, 0.26, 0.67)
    colors[clr.ResizeGripActive] = ImVec4(0.98, 0.26, 0.26, 0.95)
    colors[clr.TextSelectedBg] = ImVec4(0.98, 0.26, 0.26, 0.35)
    colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
    colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
    colors[clr.ChildWindowBg] = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.ComboBg] = colors[clr.PopupBg]
    colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
    colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
    colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
    colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
    colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
    colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
    colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
    colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
    colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
    colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
    colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
    colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
    colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end

function ShowHelpMarker(desc)
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450.0)
        imgui.TextUnformatted(desc)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end

function GetTheme()
  if HLcfg.main.theme == 1 then apply_custom_style()
  elseif HLcfg.main.theme == 2 then lightBlue()
  elseif HLcfg.main.theme == 3 then redTheme() end
end
GetTheme()

function imgui.OnDrawFrame()
  if main_window_state.v then
      imgui.SetNextWindowSize(imgui.ImVec2(410, 230), imgui.Cond.FirstUseEver) --низ по 25
    imgui.Begin(u8'[Arizona RP] Хелпер Ловли | '..version..'##main', main_window_state, imgui.WindowFlags.NoCollapse)
    imgui.SetWindowPos(u8'[Arizona RP] Хелпер Ловли | '..version..'##main', imgui.ImVec2(420, 170), imgui.Cond.FirstUseEver)
    if imgui.TreeNode(u8'Общие настройки') then
        imgui.Text(u8'Ваша фраза:')
        if imgui.InputText('##1', buffer, imgui.SameLine()) then
            HLcfg.main.jtext = string.format('%s', tostring(buffer.v))
        end
        ShowHelpMarker(u8'Ваша фраза после покупки имущества.', imgui.SameLine())

        imgui.Text(u8'Активация:')
        if imgui.InputText('##2', buffermenu, imgui.SameLine()) then
            sampUnregisterChatCommand(HLcfg.main.activation)
            HLcfg.main.activation = buffermenu.v
            sampRegisterChatCommand(tostring(HLcfg.main.activation), function() main_window_state.v = not main_window_state.v end)
        end
        ShowHelpMarker(u8'Команда для активации скрипта.', imgui.SameLine())

        if imgui.Checkbox(u8'Автонажатие Enter | Временно недоступно', imgui.ImBool(HLcfg.main.autoenter)) then HLcfg.main.autoenter = not HLcfg.main.autoenter end
        ShowHelpMarker(u8'Как только в диалоге капчи будет 5 символов - ответ отправится на сервер.', imgui.SameLine())

        if imgui.Checkbox(u8'Добавлять время во фразу', imgui.ImBool(HLcfg.main.texttime)) then HLcfg.main.texttime = not HLcfg.main.texttime end
        ShowHelpMarker(u8'Добавляет в вашу фразу время, за которое вы словили имущество.', imgui.SameLine())

        if imgui.Checkbox(u8'Отсчет времени в PayDay', imgui.ImBool(HLcfg.main.resetpd)) then HLcfg.main.resetpd = not HLcfg.main.resetpd end
        ShowHelpMarker(u8'Если включено, то скрипт будет работать от момента пайдея.\nЕсли выключено, то скрипт будет работать от момента открытия капчи.', imgui.SameLine())

        if imgui.Checkbox(u8'Отключить ники и семьи', tags) then
            pStSet = sampGetServerSettingsPtr()
            if tags.v then
                mem.setint8(pStSet + 56, 0)
                for i = 1, 2048 do
                    if sampIs3dTextDefined(i) then
                        local text, color, posX, posY, posZ, distance, ignoreWalls, player, vehicle = sampGet3dTextInfoById(i)
                        for ii = 1, #MASLOSYKA do if text:match(string.format('.+%s', MASLOSYKA[tonumber(ii)])) then sampDestroy3dText(i) end end
                    end
                end
            else
                mem.setint8(pStSet + 56, 1)
            end
        end
        ShowHelpMarker(u8'Отключает ник и название семьи над игроком.\n(название семье не вернется - на доработке)', imgui.SameLine())

        if imgui.Checkbox(u8'Флуд на N', imgui.ImBool(HLcfg.main.floodN)) then HLcfg.main.floodN = not HLcfg.main.floodN end
        ShowHelpMarker(u8'Если нажать на N до PayDay, то Вам не будет писать "Не флуди",\nа также не будет кд на повторное нажатие', imgui.SameLine())

        if imgui.Checkbox(u8'Поиск ближайшего дома', imgui.ImBool(HLcfg.main.autofind)) then HLcfg.main.autofind = not HLcfg.main.autofind end
        ShowHelpMarker(u8'Если открыть диалог с домами - будет найдет ближайший дом в госе.\nЕсли будет только 1 дом в госе - найдет его\nЕсли домов в госе не будет - не произойдет ничего', imgui.SameLine())
        imgui.TreePop()
    end
    imgui.Separator()
    if imgui.TreeNode(u8'Диалог капчи') then
        if imgui.Checkbox(u8'Удаление букв и символов с диалога капчи', imgui.ImBool(HLcfg.main.nClear)) then
            HLcfg.main.nClear = not HLcfg.main.nClear
        end
        ShowHelpMarker(u8'В диалог с капчей будет запрещено вводить всё кроме цифр', imgui.SameLine())

        if imgui.Checkbox(u8'Ограничение в 5 символов', imgui.ImBool(HLcfg.main.max5)) then
            HLcfg.main.max5 = not HLcfg.main.max5
        end
        ShowHelpMarker(u8'Запрещает вводить в диалог капчи больше 5 символов.', imgui.SameLine())
        imgui.TreePop()
    end
    imgui.Separator()
    if imgui.TreeNode(u8'Настройки чата') then
        if imgui.Checkbox(u8'Время покупки/неверного и т.д', imgui.ImBool(HLcfg.main.utime)) then
            HLcfg.main.utime = not HLcfg.main.utime
        end
        ShowHelpMarker(u8'Пишет в чат за сколько Вы купили дом или бизнес', imgui.SameLine())

        if imgui.Checkbox(u8'Время покупки другим человеком', imgui.ImBool(HLcfg.main.ptime)) then
            HLcfg.main.ptime = not HLcfg.main.ptime
        end
        ShowHelpMarker(u8'Пишет в чат за сколько другой игрок купил дом или бизнес', imgui.SameLine())

        if imgui.Checkbox(u8'Сообщение в чат после покупки имущества', imgui.ImBool(HLcfg.main.HLmsg)) then
            HLcfg.main.HLmsg = not HLcfg.main.HLmsg
        end
        ShowHelpMarker(u8'После покупки дома или бизнеса пишет в чат вашу фразу,\nкоторую можно указать во вкладке "Общие настройки"', imgui.SameLine())
        imgui.TreePop()
    end
    imgui.Separator()
    if imgui.TreeNode(u8'Тренировка капчи') then
        imgui.Text(u8'Кнопка')
        if imgui.InputText('##3', keybuff, imgui.SameLine()) then
            HLcfg.main.key = string.format('%s', tostring(keybuff.v))
        end
        ShowHelpMarker(u8'Кнопка по которой будет открыватся капча.', imgui.SameLine())

        if imgui.Checkbox(u8'Открывать капчу по кнопке', imgui.ImBool(HLcfg.main.onkey)) then
          HLcfg.main.onkey = not HLcfg.main.onkey
        end

        if imgui.Button(u8'Открыть капчу') then showCaptcha() end
        if imgui.Button(u8'Очистить текстдравы', imgui.SameLine()) then for i = 1, 400 do sampTextdrawDelete(i) end end
        imgui.TreePop()
    end
    imgui.Separator()
    if imgui.TreeNode(u8'Сменить тему') then
        if HLcfg.main.theme ~= 1 then apply_custom_style() end
        if imgui.Button(u8'Темная тема') then HLcfg.main.theme = 1; apply_custom_style() end
        GetTheme()
        if HLcfg.main.theme ~= 2 then lightBlue() end
        if imgui.Button(u8'Светло-синяя тема', imgui.SameLine()) then HLcfg.main.theme = 2; lightBlue() end
        GetTheme()
        if HLcfg.main.theme ~= 3 then redTheme() end
        if imgui.Button(u8'Красная тема', imgui.SameLine()) then HLcfg.main.theme = 3; redTheme() end
        GetTheme()
        imgui.TreePop()
    end
    imgui.End()
  end
end

function randomFloat(lower, greater)
    return lower + math.random()  * (greater - lower);
end

function showCaptcha()
    removeTextdraws()
    t = t + 1
    sampTextdrawCreate(t, "LD_SPAC:white", 220, 120)
    sampTextdrawSetLetterSizeAndColor(t, 0, 6.5, 0x80808080)
    sampTextdrawSetBoxColorAndSize(t, 1, 0xFF1A2432, 380, 0.000000)
    
    t = t + 1
    sampTextdrawCreate(t, "LD_SPAC:white", 225, 125)
    sampTextdrawSetLetterSizeAndColor(t, 0, 5.5, 0x80808080)
    sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, 375, 0.000000)
    nextPos = -30.0;
    
    math.randomseed(os.time())
    for i = 1, 4 do
        a = math.random(0, 9)
        table.insert(captchaTable, a)
        captcha = captcha..a
    end
    
    for i = 0, 4 do
        nextPos = nextPos + 30
        t = t + 1
        sampTextdrawCreate(t, "usebox", 240 + nextPos, 130)
        sampTextdrawSetLetterSizeAndColor(t, 0, 4.5, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF1A2432, 30, 25.000000)
        sampTextdrawSetAlign(t, 2)
        if i < 4 then GenerateTextDraw(captchaTable[i + 1], 240 + nextPos, 130, 3 + i * 2)
        else GenerateTextDraw(0, 240 + nextPos, 130, 3 + i * 10) end
    end
    captchaTable = {}
    sampShowDialog(8812, '{F89168}Проверка на робота', '{FFFFFF}Введите {C6FB4A}5{FFFFFF} символов, которые\nвидно на {C6FB4A}вашем{FFFFFF} экране.', 'Принять', 'Отмена', 1)
    captime = os.clock()
end

function removeTextdraws()
  if t > 0 then
    for i = 1, t do sampTextdrawDelete(i) end
    t = 0
    captcha = ''
    captime = nil
  end
end

function GenerateTextDraw(id, PosX, PosY)
  if id == 0 then
    t = t + 1
    sampTextdrawCreate(t, "LD_SPAC:white", PosX - 5, PosY + 7)
    sampTextdrawSetLetterSizeAndColor(t, 0, 3, 0x80808080)
    sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX+5, 0.000000)
  elseif id == 1 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then offsetX = 3; offsetBX = 15 else offsetX = -3; offsetBX = -15; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX - offsetX, PosY)
        sampTextdrawSetLetterSizeAndColor(t, 0, 4.5, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  elseif id == 2 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then offsetX = -8; offsetY = 7 offsetBX = 15 else offsetX = 6; offsetY = 25 offsetBX = -15; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX - offsetX, PosY + offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, 0.8, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  elseif id == 3 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 0.8; offsetY = 7 else size = 1; offsetY = 25 end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX+10, PosY+offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, 1, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-15, 0.000000)
    end
  elseif id == 4 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 1.8; offsetX = -10; offsetY = 0 offsetBX = 10 else size = 2; offsetX = -10; offsetY = 25 offsetBX = 15; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX - offsetX, PosY + offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, size, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  elseif id == 5 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 0.8; offsetX = 8; offsetY = 7 offsetBX = -15 else size = 1; offsetX = -10; offsetY = 25 offsetBX = 15; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX - offsetX, PosY + offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, size, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  elseif id == 6 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 0.8; offsetX = 7.5; offsetY = 7 offsetBX = -15 else size = 1; offsetX = -10; offsetY = 25 offsetBX = 10; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX - offsetX, PosY + offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, size, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  elseif id == 7 then
    t = t + 1
    sampTextdrawCreate(t, "LD_SPAC:white", PosX - 13, PosY + 7)
    sampTextdrawSetLetterSizeAndColor(t, 0, 3.75, 0x80808080)
    sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX+5, 0.000000)
  elseif id == 8 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 0.8; offsetY = 7 else size = 1; offsetY = 25 end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX+10, PosY+offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, 1, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-10, 0.000000)
    end
  elseif id == 9 then
    for i = 0, 1 do
        t = t + 1
        if i == 0 then size = 0.8; offsetY = 6; offsetBX = 10; else size = 1; offsetY = 25; offsetBX = 15; end
        sampTextdrawCreate(t, "LD_SPAC:white", PosX+10, PosY+offsetY)
        sampTextdrawSetLetterSizeAndColor(t, 0, 1, 0x80808080)
        sampTextdrawSetBoxColorAndSize(t, 1, 0xFF759DA3, PosX-offsetBX, 0.000000)
    end
  end
end

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand(tostring(HLcfg.main.activation), function() main_window_state.v = not main_window_state.v end)
  notf.addNotification('Активация: /' ..HLcfg.main.activation, 5, 1)
  notf.addNotification('Скрипт успешно загружен! Текущая версия: ' ..version, 5, 1)
  sampAddChatMessage('{ffff00}[Хелпер Ловли] {ffffff}by Leo_Masker for {20B2AA}J Family {ffff00}| {ffffff}Версия: '..version, -1)
  while true do wait(0)
    keybuff.v = string.upper(keybuff.v)
    if wasKeyPressed(vkeys.name_to_id(keybuff.v, false)) and HLcfg.main.onkey and not sampIsChatInputActive() and not sampIsDialogActive() then showCaptcha() end
    local result, button, list, input = sampHasDialogRespond(8812)
    if result then
      if button == 1 then
        if input == captcha..'0' then sampAddChatMessage(string.format('{ffff00}[Хелпер ловли] {ffffff}Код верный [%.3f]', os.clock() - captime), -1)
        elseif input ~= captcha..'0' then sampAddChatMessage(string.format('{ffff00}[Хелпер ловли] {ffffff}Неверный код! [%.3f] ('..captcha..'0|'..input..')', os.clock() - captime), -1) end
      end
      removeTextdraws()
    end

    if sampIsDialogActive() and sampGetDialogCaption():find('Проверка на робота') then
      if HLcfg.main.nClear then sampSetCurrentDialogEditboxText(string.gsub(sampGetCurrentDialogEditboxText(), '[^1234567890]','')) end
      if HLcfg.main.max5 then
        local text = sampGetCurrentDialogEditboxText()
        if #text > 5 then sampSetCurrentDialogEditboxText(text:sub(1, 5)) end
      end
    end
    imgui.Process = main_window_state.v
  end
  wait(-1)
end

function q.onPlayerChatBubble() if tags.v then return false end end

function q.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
  if time ~= nil and HLcfg.main.ptime then
    local _, pid = sampGetPlayerIdByCharHandle(playerPed)
      pname = sampGetPlayerNickname(pid)
    for pizda in text:gmatch('[^\n\r]+') do
      pizda = pizda:match('{FFFFFF}Владелец: {AFAFAF}(.+)')
      if pizda ~= nil and pizda ~= pname then return sampAddChatMessage(string.format('{ffff00}[Хелпер Ловли] {ffffff}Дом куплен игроком {20B2AA}%s {ffffff}[%.3f]', pizda, os.clock() - time), -1) end
    end
    for pizda in text:gmatch('[^\n\r]+') do
      pizda = pizda:match('{73B461}Владелец: {FFFFFF}(.+)')
      if pizda ~= nil and pizda ~= pname then return sampAddChatMessage(string.format('{ffff00}[Хелпер Ловли] {ffffff}Бизнес куплен игроком {20B2AA}%s {ffffff}[%.3f]', pizda, os.clock() - time), -1) end
    end
  end
end

function q.onSendPlayerSync(data)
  if HLcfg.main.floodN and data.weapon == 128 and not payday then return false
  elseif HLcfg.main.floodN and data.weapon == 128 and payday then payday = false end
end

function q.onShowDialog(dialogId, style, title, button1, button2, text)
  if title:find('Проверка на робота') then
    if not HLcfg.main.resetpd then
      time = os.clock()
      reset()
    end
  end
  if text:find('/findihouse ID') and HLcfg.main.autofind then
    for line in text:gmatch('[^\n\r]+') do
      if line:find('Эта информация может быть {1EA3CC}ошибочной%.{FFFFFF}') then
        if #forFind == 1 then
          sampSendChat('/findihouse '..forFind[1])
          table.remove(forFind, 1)
          sampAddChatMessage('{ffff00}[Хелпер Ловли] {ffffff}Слетел один дом. Метка установлена!', -1)
        elseif #forFind > 1 then
          sampAddChatMessage('{ffff00}[Хелпер Ловли] {ffffff}Слетело {ff0000}'..#forFind..' {ffffff}домов, ищем ближайщий!', -1)
          sampSendChat('/findihouse '..forFind[1])
        elseif #forFind == 0 then
          sampAddChatMessage('{ffff00}[Хелпер Ловли] {ffffff}Домов в госе нет!', -1)
        end
        return true
      end
      local hid = line:match('.+%. Дом        ID: {C9B931}(.+){FFFFFF}    %[{A9FF14}Слетел{FFFFFF}]')
      if hid ~= nil then table.insert(forFind, hid) end
    end
  end
end

function q.onServerMessage(color, text)
  if text:find('%[Подсказка] {FFFFFF}На миникарте отмечено место где будет продаваться дом.') then
    if #forFind > 0 then
      local x, y, z = getCharCoordinates(playerPed)
      local x1, y1, z1 = GetRedMarkerCoords()
      houses[forFind[1]] = getDistanceBetweenCoords3d(x, y, z, x1, y1, z1)
      table.remove(forFind, 1)
      if #forFind > 0 then sampSendChat('/findihouse '..forFind[1]) end
      if #forFind == 0 then hfind = 1 end
    end
    if #forFind == 0 and hfind == 1 then
        for k,v in spairs(houses, function(t,a,b) return t[b] > t[a] end) do
          hfind = 2
          forFind, houses = {}, {}
          sampAddChatMessage('{ffff00}[Хелпер Ловли] {ffffff}Ближайший дом - '..k..'. Метка установлена на карте!', -1)
          sampSendChat('/findihouse '..k)
          return
        end
    end
    if hfind == 2 then
      hfind = 0
      return false
    end
  end

  if text:find('%[Ошибка] {FFFFFF}У вас недостаточно денег%. Вы можете пополнить свой баланс %[/donate]') and color == -10270721 and time ~= nil then
    if HLcfg.main.utime then
      sampAddChatMessage(string.format('{FF6347}[Ошибка] {FFFFFF}У вас недостаточно денег. [%.3f]', os.clock() - time), -1)
      return false
    end
  end
  if text:find('__________________________________') and color == 1941201407 or
    text:find('Для получения PayDay вы должны отыграть минимум 20 минут.') and color == -10270721 then
      if HLcfg.main.resetpd then
        time = os.clock()
        reset()
      end
      payday = true
  end
  if text:find('%[Информация] {FFFFFF}Поздравляю! Теперь этот бизнес ваш!') and color == 1941201407 and time ~= nil then
    if HLcfg.main.HLmsg then
      if HLcfg.main.texttime then sampSendChat(u8:decode(string.format('%s [%.3f]', HLcfg.main.jtext, time)))
      else sampSendChat(u8:decode(HLcfg.main.jtext)) end
    end
    if HLcfg.main.utime then
      time = os.clock() - time
      sampAddChatMessage(string.format('{73B461}[Информация] {FFFFFF}Поздравляю! Теперь этот бизнес ваш! [%.3f]', time), -1)
      return false
    end
  end
  if text:find('%[Информация] {FFFFFF}Поздравляю! Теперь этот дом ваш!') and color == 1941201407 and time ~= nil then
    if HLcfg.main.HLmsg then
      if HLcfg.main.texttime then sampSendChat(u8:decode(string.format('%s [%.3f]', HLcfg.main.jtext, time)))
      else sampSendChat(u8:decode(HLcfg.main.jtext)) end
    end
    if HLcfg.main.utime then
      time = os.clock() - time
      sampAddChatMessage(string.format('{73B461}[Информация] {FFFFFF}Поздравляю! Теперь этот дом ваш! [%.3f]', time), -1)
      return false
    end
  end
    if text:find('%[Ошибка] {FFFFFF}Ответ неверный!') and color == -10270721 and time ~= nil and HLcfg.main.utime then
    sampAddChatMessage(string.format('{FF6347}[Ошибка] {FFFFFF}Ответ неверный! [%.3f]', os.clock() - time), -1)
    return false
  end
  if text:find('%[Ошибка] {FFFFFF}Неверный код!') and color == -10270721 and time ~= nil and HLcfg.main.utime then
    sampAddChatMessage(string.format('{FF6347}[Ошибка] {FFFFFF}Неверный код! [%.3f]', os.clock() - time), -1)
    return false
  end
  if text:find('%[Ошибка] {FFFFFF}Этот дом уже куплен!') and color == -10270721 and time ~= nil and HLcfg.main.utime then
    sampAddChatMessage(string.format('{FF6347}[Ошибка] {FFFFFF}Этот дом уже куплен! [%.3f]', os.clock() - time), -1)
    return false
  end
  if text:find('%[Ошибка] {FFFFFF}Этот бизнес уже кем то куплен') and color == -10270721 and time ~= nil and HLcfg.main.utime then
    sampAddChatMessage(string.format('{FF6347}[Ошибка] {FFFFFF}Этот бизнес уже кем то куплен [%.3f]', os.clock() - time), -1)
    return false
  end
  if text:find('>> {FF6347} Местом спавна автоматически назначен ваш дом. Изменить место спавна {FFFFFF}>>{FF6347} /setspawn!') and time ~= nil and HLcfg.main.utime then time = os.clock() - time end
end

function onWindowMessage(msg, wparam, lparam)
  if msg == 0x100 or msg == 0x101 then
    if wparam == vkeys.VK_ESCAPE and main_window_state.v and not isPauseMenuActive() then
      consumeWindowMessage(true, false)
      main_window_state.v = false
    end
  end
end

function reset()
  lua_thread.create(function()
    wait(4000)
    time = nil
  end)
end

function onScriptTerminate(script, quitGame)
  if script == thisScript() then
    inicfg.save(HLcfg, "HelperLovli")
  end
end

function onQuitGame()
  inicfg.save(HLcfg, "HelperLovli")
end

function GetRedMarkerCoords() -- snippet by SR_team, slightly modified
    for i = 0, 31 do
        local markerPtr = 0xC7F168 + i * 56
        --local markerPtr = 0xC7DEC8 + i * 160
        local x = representIntAsFloat(readMemory(markerPtr + 0, 4, false))
        local y = representIntAsFloat(readMemory(markerPtr + 4, 4, false))
        local z = representIntAsFloat(readMemory(markerPtr + 8, 4, false))
        if x ~= 0.0 or y ~= 0.0 or z ~= 0.0 then
            requestCollision(x, y); loadScene(x, y, z);
            return x, y, z
        end
    end
    return 0, 0, 0
end

function spairs(t, order)
    -- collect the keys
    local keys = {}
    for k in pairs(t) do keys[#keys+1] = k end

    -- if order function given, sort by it by passing the table and keys a, b,
    -- otherwise just sort the keys
    if order then
        table.sort(keys, function(a,b) return order(t, a, b) end)
    else
        table.sort(keys)
    end

    -- return the iterator function
    local i = 0
    return function()
        i = i + 1
        if keys[i] then
            return keys[i], t[keys[i]]
        end
    end
end


без привязки для крабов
вырезал прямо тут в редакторе кода на бластхаке поэтому если че то не работает то кидайте ошибку с мунлодер лога
Вырезал так что аж перестал работать тренер капчи)
 

Oi Nikazum

Потрачен
182
232
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Вырезал так что аж перестал работать тренер капчи)
не может быть, я вырезал конкретно привязку, другие функции я не трогал, значит, изначально не работало -,-
 

Flushka

Новичок
3
0
(error) HelperLovli: ...òíèå Ñáîðêè\90K EDITION BY DAPO SHOW\moonloader\xer..lua:483: attempt to call field 'addNotification' (a nil value)
stack traceback:
...òíèå Ñáîðêè\90K EDITION BY DAPO SHOW\moonloader\xer..lua: in function <...òíèå Ñáîðêè\90K EDITION BY DAPO SHOW\moonloader\xer..lua:479>
[ML] (error) HelperLovli: Script died due to an error. (062B08E4)
[ML] (error) HelperLovli: ...0K EDITION BY DAPO SHOW\moonloader\õóéïåð õó¸âëè (1).lua:483: attempt to call field 'addNotification' (a nil value)
stack traceback:
...0K EDITION BY DAPO SHOW\moonloader\õóéïåð õó¸âëè (1).lua: in function <...0K EDITION BY DAPO SHOW\moonloader\õóéïåð õó¸âëè (1).lua:479>
[ML] (error) HelperLovli: Script died due to an error. (062B1834)
 

™ ChipFamily

По ту сторону надежды.
Автор темы
5,144
1,980
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Поставьте это кто юзает скрипт, зависимость
 

Вложения

  • imgui_notf.lua
    6.6 KB · Просмотры: 266

deadsaxon

Потрачен
147
20
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
активация?
 

ronnyG

Участник
121
14
как это решить нахуй?
 

Вложения

  • sa-mp-025.png
    sa-mp-025.png
    140.4 KB · Просмотры: 729

™ ChipFamily

По ту сторону надежды.
Автор темы
5,144
1,980
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
  • Bug
Реакции: brabus и xdswd