Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

Loocking

Известный
1,372
468
почему цикл начинает запускаться бесконечно?
Lua:
local act = false
--main
sampRegisterChatCommand('testik',function () act = not act end)
--main 

lua_thread.create(function()
    if act then
        for i = 1, 1000 do
            wait(800)
            sampSendChat('/id '..i,-1)
        end
    end
end)
 

shadow80962

Известный
127
13
1660648939271.png


Что это за элемент ?
 

SerakD

Новичок
1
0
Привет, скажите как сделать чтобы сообщение из чата определялось по тексту и цвету.
Lua:
local sampev = require 'lib.samp.events'[/B]

function sampev.onServerMessage(color, msg )
    if string.find(msg, 'Проверил сотрудник NPR: ', 1, true) then
    sampAddChatMessage("+", 0xFFFFFF)
end[B]
 

ARMOR

kjor32 is legend
Модератор
4,847
6,071
Привет, скажите как сделать чтобы сообщение из чата определялось по тексту и цвету.
Lua:
local sampev = require 'lib.samp.events'[/B]

function sampev.onServerMessage(color, msg )
    if string.find(msg, 'Проверил сотрудник NPR: ', 1, true) then
    sampAddChatMessage("+", 0xFFFFFF)
end[B]
Lua:
local sampev = require 'lib.samp.events'

function sampev.onServerMessage(color, msg )
    if string.find(msg, 'Проверил сотрудник {Тут цвет}NPR: ', 1, true) then
    sampAddChatMessage("+", 0xFFFFFF)
end
 

TheUnity

Известный
107
37
Есть такой скрипт, добавляет запятые в строки с деньгами
split the money:
require 'lib.moonloader'
local sampevcheck, sampev = pcall(require, "lib.samp.events")

function comma_value(n)
    local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
    return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end

function separator(text)
    if text:find("$") then
        for S in string.gmatch(text, "%$%d+") do
            local replace = comma_value(S)
            text = string.gsub(text, S, replace)
        end
        for S in string.gmatch(text, "%d+%$") do
            S = string.sub(S, 0, #S-1)
            local replace = comma_value(S)
            text = string.gsub(text, S, replace)
        end
    end
    return text
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    text = separator(text)
    title = separator(title)
    return {dialogId, style, title, button1, button2, text}
end

function sampev.onServerMessage(color, text)
    text = separator(text)
    return {color, text}
end

function sampev.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
    text = separator(text)
    return {id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text}
end

function sampev.onTextDrawSetString(id, text)
    text = separator(text)
    return {id, text}
end
смотрел, вроде все верно, в replace правильный текст, но вот string.gsub как то криво заменяет подстроку.
Снимок экрана 2022-08-16 234858.png

а должно быть 70,000,000
12,500,000

Проверял в онлайн компиляторе - все ок.
 
Последнее редактирование:

Gorskin

I shit on you
Проверенный
1,246
1,042
Как получить текст с сайта и вывести его в print? Хочу получать чат ютуба:IMG_20220817_125909_854.jpg
 

SurnikSur

Активный
284
40
у меня есть таблица с координатами, как мне выбрать ближайшую ко мне
 

KOJIKOV

Активный
568
76
как сделать так что бы в темах было всё по строкам.
1660727830147.png

типо 1 срока первые 3 темы, и дальше оно переносилось на другую строку
2 строка 4 темы
Lua:
script_name('HelperLovli')
script_author('kenez')
local version = '1.0'

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 = 'no name squad!',
        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 violetTheme()
        local style = imgui.GetStyle()
        local colors = style.Colors
        local clr = imgui.Col
        local ImVec4 = imgui.ImVec4
        colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
        colors[clr.TextDisabled]         = ImVec4(0.60, 0.60, 0.60, 1.00)
        colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.ChildWindowBg]        = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.PopupBg]              = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.Border]               = ImVec4(0.71, 0.71, 0.71, 0.40)
        colors[clr.BorderShadow]         = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.FrameBg]              = ImVec4(0.34, 0.30, 0.34, 0.30)
        colors[clr.FrameBgHovered]       = ImVec4(0.22, 0.21, 0.21, 0.40)
        colors[clr.FrameBgActive]        = ImVec4(0.20, 0.20, 0.20, 0.44)
        colors[clr.TitleBg]              = ImVec4(0.52, 0.27, 0.77, 0.82)
        colors[clr.TitleBgActive]        = ImVec4(0.55, 0.28, 0.75, 0.87)
        colors[clr.TitleBgCollapsed]     = ImVec4(9.99, 9.99, 9.90, 0.20)
        colors[clr.MenuBarBg]            = ImVec4(0.27, 0.27, 0.29, 0.80)
        colors[clr.ScrollbarBg]          = ImVec4(0.08, 0.08, 0.08, 0.60)
        colors[clr.ScrollbarGrab]        = ImVec4(0.54, 0.20, 0.66, 0.30)
        colors[clr.ScrollbarGrabHovered] = ImVec4(0.21, 0.21, 0.21, 0.40)
        colors[clr.ScrollbarGrabActive]  = ImVec4(0.80, 0.50, 0.50, 0.40)
        colors[clr.ComboBg]              = ImVec4(0.20, 0.20, 0.20, 0.99)
        colors[clr.CheckMark]            = ImVec4(0.89, 0.89, 0.89, 0.50)
        colors[clr.SliderGrab]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.SliderGrabActive]     = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Button]               = ImVec4(0.48, 0.25, 0.60, 0.60)
        colors[clr.ButtonHovered]        = ImVec4(0.67, 0.40, 0.40, 1.00)
        colors[clr.ButtonActive]         = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Header]               = ImVec4(0.56, 0.27, 0.73, 0.44)
        colors[clr.HeaderHovered]        = ImVec4(0.78, 0.44, 0.89, 0.80)
        colors[clr.HeaderActive]         = ImVec4(0.81, 0.52, 0.87, 0.80)
        colors[clr.Separator]            = ImVec4(0.42, 0.42, 0.42, 1.00)
        colors[clr.SeparatorHovered]     = ImVec4(0.57, 0.24, 0.73, 1.00)
        colors[clr.SeparatorActive]      = ImVec4(0.69, 0.69, 0.89, 1.00)
        colors[clr.ResizeGrip]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.ResizeGripHovered]    = ImVec4(1.00, 1.00, 1.00, 0.60)
        colors[clr.ResizeGripActive]     = ImVec4(1.00, 1.00, 1.00, 0.89)
        colors[clr.CloseButton]          = ImVec4(0.33, 0.14, 0.46, 0.50)
        colors[clr.CloseButtonHovered]   = ImVec4(0.69, 0.69, 0.89, 0.60)
        colors[clr.CloseButtonActive]    = ImVec4(0.69, 0.69, 0.69, 1.00)
        colors[clr.PlotLines]            = ImVec4(1.00, 0.99, 0.99, 1.00)
        colors[clr.PlotLinesHovered]     = ImVec4(0.49, 0.00, 0.89, 1.00)
        colors[clr.PlotHistogram]        = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.PlotHistogramHovered] = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.TextSelectedBg]       = ImVec4(0.54, 0.00, 1.00, 0.34)
        colors[clr.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.34)
    end
    function orangeTheme()
    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(4.0, 4.0)
    style.WindowRounding               = 7
    style.WindowTitleAlign             = ImVec2(0.5, 0.5)
    style.FramePadding                 = ImVec2(4.0, 3.0)
    style.ItemSpacing                  = ImVec2(8.0, 4.0)
    style.ItemInnerSpacing             = ImVec2(4.0, 4.0)
    style.ChildWindowRounding          = 7
    style.FrameRounding                = 7
    style.ScrollbarRounding            = 7
    style.GrabRounding                 = 7
    style.IndentSpacing                = 21.0
    style.ScrollbarSize                = 13.0
    style.GrabMinSize                  = 10.0
    style.ButtonTextAlign              = ImVec2(0.5, 0.5)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.96)
    colors[clr.Border]                 = ImVec4(0.73, 0.36, 0.00, 0.00)
    colors[clr.FrameBg]                = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.FrameBgHovered]         = ImVec4(0.65, 0.32, 0.00, 1.00)
    colors[clr.FrameBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBg]                = ImVec4(0.15, 0.11, 0.09, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.15, 0.11, 0.09, 0.51)
    colors[clr.MenuBarBg]              = ImVec4(0.62, 0.31, 0.00, 1.00)
    colors[clr.CheckMark]              = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.84, 0.41, 0.00, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.98, 0.49, 0.00, 1.00)
    colors[clr.Button]                 = ImVec4(0.73, 0.36, 0.00, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.ButtonActive]           = ImVec4(1.00, 0.50, 0.00, 1.00)
    colors[clr.Header]                 = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.HeaderHovered]          = ImVec4(0.70, 0.35, 0.01, 1.00)
    colors[clr.HeaderActive]           = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.49, 0.24, 0.00, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.48, 0.23, 0.00, 1.00)
    colors[clr.ResizeGripHovered]      = ImVec4(0.78, 0.38, 0.00, 1.00)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.PlotLines]              = ImVec4(0.83, 0.41, 0.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.99, 0.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.93, 0.46, 0.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.33, 0.33, 0.33, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.39, 0.39, 0.39, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.48, 0.48, 0.48, 1.00)
    colors[clr.CloseButton]            = colors[clr.FrameBg]
    colors[clr.CloseButtonHovered]     = colors[clr.FrameBgHovered]
    colors[clr.CloseButtonActive]      = colors[clr.FrameBgActive]
end
function bordTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4

    style.FrameRounding    = 4.0
    style.GrabRounding     = 4.0

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]         = ImVec4(0.73, 0.75, 0.74, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 0.94)
    colors[clr.ChildWindowBg]        = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.FrameBgHovered]       = ImVec4(0.84, 0.66, 0.66, 0.40)
    colors[clr.FrameBgActive]        = ImVec4(0.84, 0.66, 0.66, 0.67)
    colors[clr.TitleBg]              = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.TitleBgActive]        = ImVec4(0.47, 0.22, 0.22, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.MenuBarBg]            = ImVec4(0.34, 0.16, 0.16, 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.CheckMark]            = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.71, 0.39, 0.39, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(0.84, 0.66, 0.66, 1.00)
    colors[clr.Button]               = ImVec4(0.47, 0.22, 0.22, 0.65)
    colors[clr.ButtonHovered]        = ImVec4(0.71, 0.39, 0.39, 0.65)
    colors[clr.ButtonActive]         = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.Header]               = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.HeaderHovered]        = ImVec4(0.84, 0.66, 0.66, 0.65)
    colors[clr.HeaderActive]         = ImVec4(0.84, 0.66, 0.66, 0.00)
    colors[clr.Separator]            = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.SeparatorHovered]     = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.SeparatorActive]      = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGrip]           = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGripHovered]    = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.ResizeGripActive]     = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.CloseButton]          = ImVec4(0.41, 0.41, 0.41, 1.00)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
function greenTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4
  local ImVec2 = imgui.ImVec2

  style.WindowRounding         = 4.0
  style.WindowTitleAlign       = ImVec2(0.5, 0.5)
  style.ChildWindowRounding    = 2.0
  style.FrameRounding          = 4.0
  style.ItemSpacing            = ImVec2(10, 5)
  style.ScrollbarSize          = 15
  style.ScrollbarRounding      = 0
  style.GrabMinSize            = 9.6
  style.GrabRounding           = 1.0
  style.WindowPadding          = ImVec2(10, 10)
  style.AntiAliasedLines       = true
  style.AntiAliasedShapes      = true
  style.FramePadding           = ImVec2(5, 4)
  style.DisplayWindowPadding   = ImVec2(27, 27)
  style.DisplaySafeAreaPadding = ImVec2(5, 5)
  style.ButtonTextAlign        = ImVec2(0.5, 0.5)
  style.IndentSpacing          = 12.0
  style.Alpha                  = 1.0

    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(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    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.FrameBg]              = ImVec4(0.44, 0.44, 0.44, 0.60)
    colors[clr.FrameBgHovered]       = ImVec4(0.57, 0.57, 0.57, 0.70)
    colors[clr.FrameBgActive]        = ImVec4(0.76, 0.76, 0.76, 0.80)
    colors[clr.TitleBg]              = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]        = ImVec4(0.16, 0.16, 0.16, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.60)
    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.CheckMark]            = ImVec4(0.13, 0.75, 0.55, 0.80)
    colors[clr.SliderGrab]           = ImVec4(0.13, 0.75, 0.75, 0.80)
    colors[clr.SliderGrabActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Button]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ButtonHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ButtonActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Header]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.HeaderHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.HeaderActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Separator]            = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.SeparatorHovered]     = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.SeparatorActive]      = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.ResizeGrip]           = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ResizeGripHovered]    = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ResizeGripActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    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()
elseif HLcfg.main.theme == 4 then violetTheme()
elseif HLcfg.main.theme == 5 then orangeTheme()
elseif HLcfg.main.theme == 6 then bordTheme()
elseif HLcfg.main.theme == 7 then greenTheme()  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'Добавлять время во фразу', imgui.ImBool(HLcfg.main.texttime)) then HLcfg.main.texttime = not HLcfg.main.texttime end
        ShowHelpMarker(u8'Добавляет в вашу фразу время, за которое вы словили имущество.', 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())

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()
        if HLcfg.main.theme ~= 4 then violetTheme() end
        if imgui.Button(u8'Фиолетовая тема', imgui.SameLine()) then HLcfg.main.theme = 4; violetTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 5 then orangeTheme() end
        if imgui.Button(u8'Оранжевая тема', imgui.SameLine()) then HLcfg.main.theme = 5; orangeTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 6 then bordTheme() end
        if imgui.Button(u8'Тёмно - красная тема', imgui.SameLine()) then HLcfg.main.theme = 6; bordTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 7 then greenTheme() end
        if imgui.Button(u8'Зелёная', imgui.SameLine()) then HLcfg.main.theme = 7; greenTheme() 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 Kenez for {20B2AA}no name squad! {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
 
Последнее редактирование:

Gorskin

I shit on you
Проверенный
1,246
1,042
как сделать так что бы в темах было всё по строкам.
Посмотреть вложение 163245
типо 1 срока первые 3 темы, и дальше оно переносилось на другую строку
2 строка 4 темы
Lua:
script_name('HelperLovli')
script_author('kenez')
local version = '1.0'

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 = 'no name squad!',
        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 violetTheme()
        local style = imgui.GetStyle()
        local colors = style.Colors
        local clr = imgui.Col
        local ImVec4 = imgui.ImVec4
        colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
        colors[clr.TextDisabled]         = ImVec4(0.60, 0.60, 0.60, 1.00)
        colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.ChildWindowBg]        = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.PopupBg]              = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.Border]               = ImVec4(0.71, 0.71, 0.71, 0.40)
        colors[clr.BorderShadow]         = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.FrameBg]              = ImVec4(0.34, 0.30, 0.34, 0.30)
        colors[clr.FrameBgHovered]       = ImVec4(0.22, 0.21, 0.21, 0.40)
        colors[clr.FrameBgActive]        = ImVec4(0.20, 0.20, 0.20, 0.44)
        colors[clr.TitleBg]              = ImVec4(0.52, 0.27, 0.77, 0.82)
        colors[clr.TitleBgActive]        = ImVec4(0.55, 0.28, 0.75, 0.87)
        colors[clr.TitleBgCollapsed]     = ImVec4(9.99, 9.99, 9.90, 0.20)
        colors[clr.MenuBarBg]            = ImVec4(0.27, 0.27, 0.29, 0.80)
        colors[clr.ScrollbarBg]          = ImVec4(0.08, 0.08, 0.08, 0.60)
        colors[clr.ScrollbarGrab]        = ImVec4(0.54, 0.20, 0.66, 0.30)
        colors[clr.ScrollbarGrabHovered] = ImVec4(0.21, 0.21, 0.21, 0.40)
        colors[clr.ScrollbarGrabActive]  = ImVec4(0.80, 0.50, 0.50, 0.40)
        colors[clr.ComboBg]              = ImVec4(0.20, 0.20, 0.20, 0.99)
        colors[clr.CheckMark]            = ImVec4(0.89, 0.89, 0.89, 0.50)
        colors[clr.SliderGrab]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.SliderGrabActive]     = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Button]               = ImVec4(0.48, 0.25, 0.60, 0.60)
        colors[clr.ButtonHovered]        = ImVec4(0.67, 0.40, 0.40, 1.00)
        colors[clr.ButtonActive]         = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Header]               = ImVec4(0.56, 0.27, 0.73, 0.44)
        colors[clr.HeaderHovered]        = ImVec4(0.78, 0.44, 0.89, 0.80)
        colors[clr.HeaderActive]         = ImVec4(0.81, 0.52, 0.87, 0.80)
        colors[clr.Separator]            = ImVec4(0.42, 0.42, 0.42, 1.00)
        colors[clr.SeparatorHovered]     = ImVec4(0.57, 0.24, 0.73, 1.00)
        colors[clr.SeparatorActive]      = ImVec4(0.69, 0.69, 0.89, 1.00)
        colors[clr.ResizeGrip]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.ResizeGripHovered]    = ImVec4(1.00, 1.00, 1.00, 0.60)
        colors[clr.ResizeGripActive]     = ImVec4(1.00, 1.00, 1.00, 0.89)
        colors[clr.CloseButton]          = ImVec4(0.33, 0.14, 0.46, 0.50)
        colors[clr.CloseButtonHovered]   = ImVec4(0.69, 0.69, 0.89, 0.60)
        colors[clr.CloseButtonActive]    = ImVec4(0.69, 0.69, 0.69, 1.00)
        colors[clr.PlotLines]            = ImVec4(1.00, 0.99, 0.99, 1.00)
        colors[clr.PlotLinesHovered]     = ImVec4(0.49, 0.00, 0.89, 1.00)
        colors[clr.PlotHistogram]        = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.PlotHistogramHovered] = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.TextSelectedBg]       = ImVec4(0.54, 0.00, 1.00, 0.34)
        colors[clr.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.34)
    end
    function orangeTheme()
    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(4.0, 4.0)
    style.WindowRounding               = 7
    style.WindowTitleAlign             = ImVec2(0.5, 0.5)
    style.FramePadding                 = ImVec2(4.0, 3.0)
    style.ItemSpacing                  = ImVec2(8.0, 4.0)
    style.ItemInnerSpacing             = ImVec2(4.0, 4.0)
    style.ChildWindowRounding          = 7
    style.FrameRounding                = 7
    style.ScrollbarRounding            = 7
    style.GrabRounding                 = 7
    style.IndentSpacing                = 21.0
    style.ScrollbarSize                = 13.0
    style.GrabMinSize                  = 10.0
    style.ButtonTextAlign              = ImVec2(0.5, 0.5)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.96)
    colors[clr.Border]                 = ImVec4(0.73, 0.36, 0.00, 0.00)
    colors[clr.FrameBg]                = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.FrameBgHovered]         = ImVec4(0.65, 0.32, 0.00, 1.00)
    colors[clr.FrameBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBg]                = ImVec4(0.15, 0.11, 0.09, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.15, 0.11, 0.09, 0.51)
    colors[clr.MenuBarBg]              = ImVec4(0.62, 0.31, 0.00, 1.00)
    colors[clr.CheckMark]              = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.84, 0.41, 0.00, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.98, 0.49, 0.00, 1.00)
    colors[clr.Button]                 = ImVec4(0.73, 0.36, 0.00, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.ButtonActive]           = ImVec4(1.00, 0.50, 0.00, 1.00)
    colors[clr.Header]                 = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.HeaderHovered]          = ImVec4(0.70, 0.35, 0.01, 1.00)
    colors[clr.HeaderActive]           = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.49, 0.24, 0.00, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.48, 0.23, 0.00, 1.00)
    colors[clr.ResizeGripHovered]      = ImVec4(0.78, 0.38, 0.00, 1.00)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.PlotLines]              = ImVec4(0.83, 0.41, 0.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.99, 0.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.93, 0.46, 0.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.33, 0.33, 0.33, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.39, 0.39, 0.39, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.48, 0.48, 0.48, 1.00)
    colors[clr.CloseButton]            = colors[clr.FrameBg]
    colors[clr.CloseButtonHovered]     = colors[clr.FrameBgHovered]
    colors[clr.CloseButtonActive]      = colors[clr.FrameBgActive]
end
function bordTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4

    style.FrameRounding    = 4.0
    style.GrabRounding     = 4.0

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]         = ImVec4(0.73, 0.75, 0.74, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 0.94)
    colors[clr.ChildWindowBg]        = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.FrameBgHovered]       = ImVec4(0.84, 0.66, 0.66, 0.40)
    colors[clr.FrameBgActive]        = ImVec4(0.84, 0.66, 0.66, 0.67)
    colors[clr.TitleBg]              = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.TitleBgActive]        = ImVec4(0.47, 0.22, 0.22, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.MenuBarBg]            = ImVec4(0.34, 0.16, 0.16, 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.CheckMark]            = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.71, 0.39, 0.39, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(0.84, 0.66, 0.66, 1.00)
    colors[clr.Button]               = ImVec4(0.47, 0.22, 0.22, 0.65)
    colors[clr.ButtonHovered]        = ImVec4(0.71, 0.39, 0.39, 0.65)
    colors[clr.ButtonActive]         = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.Header]               = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.HeaderHovered]        = ImVec4(0.84, 0.66, 0.66, 0.65)
    colors[clr.HeaderActive]         = ImVec4(0.84, 0.66, 0.66, 0.00)
    colors[clr.Separator]            = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.SeparatorHovered]     = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.SeparatorActive]      = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGrip]           = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGripHovered]    = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.ResizeGripActive]     = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.CloseButton]          = ImVec4(0.41, 0.41, 0.41, 1.00)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
function greenTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4
  local ImVec2 = imgui.ImVec2

  style.WindowRounding         = 4.0
  style.WindowTitleAlign       = ImVec2(0.5, 0.5)
  style.ChildWindowRounding    = 2.0
  style.FrameRounding          = 4.0
  style.ItemSpacing            = ImVec2(10, 5)
  style.ScrollbarSize          = 15
  style.ScrollbarRounding      = 0
  style.GrabMinSize            = 9.6
  style.GrabRounding           = 1.0
  style.WindowPadding          = ImVec2(10, 10)
  style.AntiAliasedLines       = true
  style.AntiAliasedShapes      = true
  style.FramePadding           = ImVec2(5, 4)
  style.DisplayWindowPadding   = ImVec2(27, 27)
  style.DisplaySafeAreaPadding = ImVec2(5, 5)
  style.ButtonTextAlign        = ImVec2(0.5, 0.5)
  style.IndentSpacing          = 12.0
  style.Alpha                  = 1.0

    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(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    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.FrameBg]              = ImVec4(0.44, 0.44, 0.44, 0.60)
    colors[clr.FrameBgHovered]       = ImVec4(0.57, 0.57, 0.57, 0.70)
    colors[clr.FrameBgActive]        = ImVec4(0.76, 0.76, 0.76, 0.80)
    colors[clr.TitleBg]              = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]        = ImVec4(0.16, 0.16, 0.16, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.60)
    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.CheckMark]            = ImVec4(0.13, 0.75, 0.55, 0.80)
    colors[clr.SliderGrab]           = ImVec4(0.13, 0.75, 0.75, 0.80)
    colors[clr.SliderGrabActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Button]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ButtonHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ButtonActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Header]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.HeaderHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.HeaderActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Separator]            = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.SeparatorHovered]     = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.SeparatorActive]      = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.ResizeGrip]           = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ResizeGripHovered]    = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ResizeGripActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    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()
elseif HLcfg.main.theme == 4 then violetTheme()
elseif HLcfg.main.theme == 5 then orangeTheme()
elseif HLcfg.main.theme == 6 then bordTheme()
elseif HLcfg.main.theme == 7 then greenTheme()  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'Добавлять время во фразу', imgui.ImBool(HLcfg.main.texttime)) then HLcfg.main.texttime = not HLcfg.main.texttime end
        ShowHelpMarker(u8'Добавляет в вашу фразу время, за которое вы словили имущество.', 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())

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()
        if HLcfg.main.theme ~= 4 then violetTheme() end
        if imgui.Button(u8'Фиолетовая тема', imgui.SameLine()) then HLcfg.main.theme = 4; violetTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 5 then orangeTheme() end
        if imgui.Button(u8'Оранжевая тема', imgui.SameLine()) then HLcfg.main.theme = 5; orangeTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 6 then bordTheme() end
        if imgui.Button(u8'Тёмно - красная тема', imgui.SameLine()) then HLcfg.main.theme = 6; bordTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 7 then greenTheme() end
        if imgui.Button(u8'Зелёная', imgui.SameLine()) then HLcfg.main.theme = 7; greenTheme() 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 Kenez for {20B2AA}no name squad! {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
Удали
Lua:
imgui.SameLine()
 
  • Нравится
Реакции: KOJIKOV

KOJIKOV

Активный
568
76
1660729067796.png

Как убрать вкладки?
"Общие настройки, настройка чата, треня капчи"
что бы всё сразу было открыть, но вкладок не было
Lua:
script_name('HelperLovli')
script_author('kenez')
local version = '1.0'

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 = 'no name squad!',
        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 violetTheme()
        local style = imgui.GetStyle()
        local colors = style.Colors
        local clr = imgui.Col
        local ImVec4 = imgui.ImVec4
        colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
        colors[clr.TextDisabled]         = ImVec4(0.60, 0.60, 0.60, 1.00)
        colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.ChildWindowBg]        = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.PopupBg]              = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.Border]               = ImVec4(0.71, 0.71, 0.71, 0.40)
        colors[clr.BorderShadow]         = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.FrameBg]              = ImVec4(0.34, 0.30, 0.34, 0.30)
        colors[clr.FrameBgHovered]       = ImVec4(0.22, 0.21, 0.21, 0.40)
        colors[clr.FrameBgActive]        = ImVec4(0.20, 0.20, 0.20, 0.44)
        colors[clr.TitleBg]              = ImVec4(0.52, 0.27, 0.77, 0.82)
        colors[clr.TitleBgActive]        = ImVec4(0.55, 0.28, 0.75, 0.87)
        colors[clr.TitleBgCollapsed]     = ImVec4(9.99, 9.99, 9.90, 0.20)
        colors[clr.MenuBarBg]            = ImVec4(0.27, 0.27, 0.29, 0.80)
        colors[clr.ScrollbarBg]          = ImVec4(0.08, 0.08, 0.08, 0.60)
        colors[clr.ScrollbarGrab]        = ImVec4(0.54, 0.20, 0.66, 0.30)
        colors[clr.ScrollbarGrabHovered] = ImVec4(0.21, 0.21, 0.21, 0.40)
        colors[clr.ScrollbarGrabActive]  = ImVec4(0.80, 0.50, 0.50, 0.40)
        colors[clr.ComboBg]              = ImVec4(0.20, 0.20, 0.20, 0.99)
        colors[clr.CheckMark]            = ImVec4(0.89, 0.89, 0.89, 0.50)
        colors[clr.SliderGrab]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.SliderGrabActive]     = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Button]               = ImVec4(0.48, 0.25, 0.60, 0.60)
        colors[clr.ButtonHovered]        = ImVec4(0.67, 0.40, 0.40, 1.00)
        colors[clr.ButtonActive]         = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Header]               = ImVec4(0.56, 0.27, 0.73, 0.44)
        colors[clr.HeaderHovered]        = ImVec4(0.78, 0.44, 0.89, 0.80)
        colors[clr.HeaderActive]         = ImVec4(0.81, 0.52, 0.87, 0.80)
        colors[clr.Separator]            = ImVec4(0.42, 0.42, 0.42, 1.00)
        colors[clr.SeparatorHovered]     = ImVec4(0.57, 0.24, 0.73, 1.00)
        colors[clr.SeparatorActive]      = ImVec4(0.69, 0.69, 0.89, 1.00)
        colors[clr.ResizeGrip]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.ResizeGripHovered]    = ImVec4(1.00, 1.00, 1.00, 0.60)
        colors[clr.ResizeGripActive]     = ImVec4(1.00, 1.00, 1.00, 0.89)
        colors[clr.CloseButton]          = ImVec4(0.33, 0.14, 0.46, 0.50)
        colors[clr.CloseButtonHovered]   = ImVec4(0.69, 0.69, 0.89, 0.60)
        colors[clr.CloseButtonActive]    = ImVec4(0.69, 0.69, 0.69, 1.00)
        colors[clr.PlotLines]            = ImVec4(1.00, 0.99, 0.99, 1.00)
        colors[clr.PlotLinesHovered]     = ImVec4(0.49, 0.00, 0.89, 1.00)
        colors[clr.PlotHistogram]        = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.PlotHistogramHovered] = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.TextSelectedBg]       = ImVec4(0.54, 0.00, 1.00, 0.34)
        colors[clr.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.34)
    end
    function orangeTheme()
    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(4.0, 4.0)
    style.WindowRounding               = 7
    style.WindowTitleAlign             = ImVec2(0.5, 0.5)
    style.FramePadding                 = ImVec2(4.0, 3.0)
    style.ItemSpacing                  = ImVec2(8.0, 4.0)
    style.ItemInnerSpacing             = ImVec2(4.0, 4.0)
    style.ChildWindowRounding          = 7
    style.FrameRounding                = 7
    style.ScrollbarRounding            = 7
    style.GrabRounding                 = 7
    style.IndentSpacing                = 21.0
    style.ScrollbarSize                = 13.0
    style.GrabMinSize                  = 10.0
    style.ButtonTextAlign              = ImVec2(0.5, 0.5)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.96)
    colors[clr.Border]                 = ImVec4(0.73, 0.36, 0.00, 0.00)
    colors[clr.FrameBg]                = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.FrameBgHovered]         = ImVec4(0.65, 0.32, 0.00, 1.00)
    colors[clr.FrameBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBg]                = ImVec4(0.15, 0.11, 0.09, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.15, 0.11, 0.09, 0.51)
    colors[clr.MenuBarBg]              = ImVec4(0.62, 0.31, 0.00, 1.00)
    colors[clr.CheckMark]              = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.84, 0.41, 0.00, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.98, 0.49, 0.00, 1.00)
    colors[clr.Button]                 = ImVec4(0.73, 0.36, 0.00, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.ButtonActive]           = ImVec4(1.00, 0.50, 0.00, 1.00)
    colors[clr.Header]                 = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.HeaderHovered]          = ImVec4(0.70, 0.35, 0.01, 1.00)
    colors[clr.HeaderActive]           = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.49, 0.24, 0.00, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.48, 0.23, 0.00, 1.00)
    colors[clr.ResizeGripHovered]      = ImVec4(0.78, 0.38, 0.00, 1.00)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.PlotLines]              = ImVec4(0.83, 0.41, 0.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.99, 0.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.93, 0.46, 0.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.33, 0.33, 0.33, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.39, 0.39, 0.39, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.48, 0.48, 0.48, 1.00)
    colors[clr.CloseButton]            = colors[clr.FrameBg]
    colors[clr.CloseButtonHovered]     = colors[clr.FrameBgHovered]
    colors[clr.CloseButtonActive]      = colors[clr.FrameBgActive]
end
function bordTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4

    style.FrameRounding    = 4.0
    style.GrabRounding     = 4.0

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]         = ImVec4(0.73, 0.75, 0.74, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 0.94)
    colors[clr.ChildWindowBg]        = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.FrameBgHovered]       = ImVec4(0.84, 0.66, 0.66, 0.40)
    colors[clr.FrameBgActive]        = ImVec4(0.84, 0.66, 0.66, 0.67)
    colors[clr.TitleBg]              = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.TitleBgActive]        = ImVec4(0.47, 0.22, 0.22, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.MenuBarBg]            = ImVec4(0.34, 0.16, 0.16, 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.CheckMark]            = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.71, 0.39, 0.39, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(0.84, 0.66, 0.66, 1.00)
    colors[clr.Button]               = ImVec4(0.47, 0.22, 0.22, 0.65)
    colors[clr.ButtonHovered]        = ImVec4(0.71, 0.39, 0.39, 0.65)
    colors[clr.ButtonActive]         = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.Header]               = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.HeaderHovered]        = ImVec4(0.84, 0.66, 0.66, 0.65)
    colors[clr.HeaderActive]         = ImVec4(0.84, 0.66, 0.66, 0.00)
    colors[clr.Separator]            = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.SeparatorHovered]     = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.SeparatorActive]      = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGrip]           = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGripHovered]    = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.ResizeGripActive]     = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.CloseButton]          = ImVec4(0.41, 0.41, 0.41, 1.00)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
function greenTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4
  local ImVec2 = imgui.ImVec2

  style.WindowRounding         = 4.0
  style.WindowTitleAlign       = ImVec2(0.5, 0.5)
  style.ChildWindowRounding    = 2.0
  style.FrameRounding          = 4.0
  style.ItemSpacing            = ImVec2(10, 5)
  style.ScrollbarSize          = 15
  style.ScrollbarRounding      = 0
  style.GrabMinSize            = 9.6
  style.GrabRounding           = 1.0
  style.WindowPadding          = ImVec2(10, 10)
  style.AntiAliasedLines       = true
  style.AntiAliasedShapes      = true
  style.FramePadding           = ImVec2(5, 4)
  style.DisplayWindowPadding   = ImVec2(27, 27)
  style.DisplaySafeAreaPadding = ImVec2(5, 5)
  style.ButtonTextAlign        = ImVec2(0.5, 0.5)
  style.IndentSpacing          = 12.0
  style.Alpha                  = 1.0

    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(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    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.FrameBg]              = ImVec4(0.44, 0.44, 0.44, 0.60)
    colors[clr.FrameBgHovered]       = ImVec4(0.57, 0.57, 0.57, 0.70)
    colors[clr.FrameBgActive]        = ImVec4(0.76, 0.76, 0.76, 0.80)
    colors[clr.TitleBg]              = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]        = ImVec4(0.16, 0.16, 0.16, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.60)
    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.CheckMark]            = ImVec4(0.13, 0.75, 0.55, 0.80)
    colors[clr.SliderGrab]           = ImVec4(0.13, 0.75, 0.75, 0.80)
    colors[clr.SliderGrabActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Button]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ButtonHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ButtonActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Header]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.HeaderHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.HeaderActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Separator]            = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.SeparatorHovered]     = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.SeparatorActive]      = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.ResizeGrip]           = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ResizeGripHovered]    = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ResizeGripActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    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()
elseif HLcfg.main.theme == 4 then violetTheme()
elseif HLcfg.main.theme == 5 then orangeTheme()
elseif HLcfg.main.theme == 6 then bordTheme()
elseif HLcfg.main.theme == 7 then greenTheme()  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'Добавлять время во фразу', imgui.ImBool(HLcfg.main.texttime)) then HLcfg.main.texttime = not HLcfg.main.texttime end
        ShowHelpMarker(u8'Добавляет в вашу фразу время, за которое вы словили имущество.', 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())

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()
        if HLcfg.main.theme ~= 4 then violetTheme() end
        if imgui.Button(u8'Фиолетовая тема') then HLcfg.main.theme = 4; violetTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 5 then orangeTheme() end
        if imgui.Button(u8'Оранжевая тема', imgui.SameLine()) then HLcfg.main.theme = 5; orangeTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 6 then bordTheme() end
        if imgui.Button(u8'Тёмно - красная тема', imgui.SameLine()) then HLcfg.main.theme = 6; bordTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 7 then greenTheme() end
        if imgui.Button(u8'Зелёная') then HLcfg.main.theme = 7; greenTheme() 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 Kenez for {20B2AA}no name squad! {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
 

Gorskin

I shit on you
Проверенный
1,246
1,042
Посмотреть вложение 163250
Как убрать вкладки?
"Общие настройки, настройка чата, треня капчи"
что бы всё сразу было открыть, но вкладок не было
Lua:
script_name('HelperLovli')
script_author('kenez')
local version = '1.0'

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 = 'no name squad!',
        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 violetTheme()
        local style = imgui.GetStyle()
        local colors = style.Colors
        local clr = imgui.Col
        local ImVec4 = imgui.ImVec4
        colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
        colors[clr.TextDisabled]         = ImVec4(0.60, 0.60, 0.60, 1.00)
        colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.ChildWindowBg]        = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.PopupBg]              = ImVec4(0.09, 0.09, 0.09, 1.00)
        colors[clr.Border]               = ImVec4(0.71, 0.71, 0.71, 0.40)
        colors[clr.BorderShadow]         = ImVec4(9.90, 9.99, 9.99, 0.00)
        colors[clr.FrameBg]              = ImVec4(0.34, 0.30, 0.34, 0.30)
        colors[clr.FrameBgHovered]       = ImVec4(0.22, 0.21, 0.21, 0.40)
        colors[clr.FrameBgActive]        = ImVec4(0.20, 0.20, 0.20, 0.44)
        colors[clr.TitleBg]              = ImVec4(0.52, 0.27, 0.77, 0.82)
        colors[clr.TitleBgActive]        = ImVec4(0.55, 0.28, 0.75, 0.87)
        colors[clr.TitleBgCollapsed]     = ImVec4(9.99, 9.99, 9.90, 0.20)
        colors[clr.MenuBarBg]            = ImVec4(0.27, 0.27, 0.29, 0.80)
        colors[clr.ScrollbarBg]          = ImVec4(0.08, 0.08, 0.08, 0.60)
        colors[clr.ScrollbarGrab]        = ImVec4(0.54, 0.20, 0.66, 0.30)
        colors[clr.ScrollbarGrabHovered] = ImVec4(0.21, 0.21, 0.21, 0.40)
        colors[clr.ScrollbarGrabActive]  = ImVec4(0.80, 0.50, 0.50, 0.40)
        colors[clr.ComboBg]              = ImVec4(0.20, 0.20, 0.20, 0.99)
        colors[clr.CheckMark]            = ImVec4(0.89, 0.89, 0.89, 0.50)
        colors[clr.SliderGrab]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.SliderGrabActive]     = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Button]               = ImVec4(0.48, 0.25, 0.60, 0.60)
        colors[clr.ButtonHovered]        = ImVec4(0.67, 0.40, 0.40, 1.00)
        colors[clr.ButtonActive]         = ImVec4(0.80, 0.50, 0.50, 1.00)
        colors[clr.Header]               = ImVec4(0.56, 0.27, 0.73, 0.44)
        colors[clr.HeaderHovered]        = ImVec4(0.78, 0.44, 0.89, 0.80)
        colors[clr.HeaderActive]         = ImVec4(0.81, 0.52, 0.87, 0.80)
        colors[clr.Separator]            = ImVec4(0.42, 0.42, 0.42, 1.00)
        colors[clr.SeparatorHovered]     = ImVec4(0.57, 0.24, 0.73, 1.00)
        colors[clr.SeparatorActive]      = ImVec4(0.69, 0.69, 0.89, 1.00)
        colors[clr.ResizeGrip]           = ImVec4(1.00, 1.00, 1.00, 0.30)
        colors[clr.ResizeGripHovered]    = ImVec4(1.00, 1.00, 1.00, 0.60)
        colors[clr.ResizeGripActive]     = ImVec4(1.00, 1.00, 1.00, 0.89)
        colors[clr.CloseButton]          = ImVec4(0.33, 0.14, 0.46, 0.50)
        colors[clr.CloseButtonHovered]   = ImVec4(0.69, 0.69, 0.89, 0.60)
        colors[clr.CloseButtonActive]    = ImVec4(0.69, 0.69, 0.69, 1.00)
        colors[clr.PlotLines]            = ImVec4(1.00, 0.99, 0.99, 1.00)
        colors[clr.PlotLinesHovered]     = ImVec4(0.49, 0.00, 0.89, 1.00)
        colors[clr.PlotHistogram]        = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.PlotHistogramHovered] = ImVec4(9.99, 9.99, 9.90, 1.00)
        colors[clr.TextSelectedBg]       = ImVec4(0.54, 0.00, 1.00, 0.34)
        colors[clr.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.34)
    end
    function orangeTheme()
    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(4.0, 4.0)
    style.WindowRounding               = 7
    style.WindowTitleAlign             = ImVec2(0.5, 0.5)
    style.FramePadding                 = ImVec2(4.0, 3.0)
    style.ItemSpacing                  = ImVec2(8.0, 4.0)
    style.ItemInnerSpacing             = ImVec2(4.0, 4.0)
    style.ChildWindowRounding          = 7
    style.FrameRounding                = 7
    style.ScrollbarRounding            = 7
    style.GrabRounding                 = 7
    style.IndentSpacing                = 21.0
    style.ScrollbarSize                = 13.0
    style.GrabMinSize                  = 10.0
    style.ButtonTextAlign              = ImVec2(0.5, 0.5)
    colors[clr.WindowBg]               = ImVec4(0.06, 0.06, 0.06, 1.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.96)
    colors[clr.Border]                 = ImVec4(0.73, 0.36, 0.00, 0.00)
    colors[clr.FrameBg]                = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.FrameBgHovered]         = ImVec4(0.65, 0.32, 0.00, 1.00)
    colors[clr.FrameBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBg]                = ImVec4(0.15, 0.11, 0.09, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.15, 0.11, 0.09, 0.51)
    colors[clr.MenuBarBg]              = ImVec4(0.62, 0.31, 0.00, 1.00)
    colors[clr.CheckMark]              = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.84, 0.41, 0.00, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.98, 0.49, 0.00, 1.00)
    colors[clr.Button]                 = ImVec4(0.73, 0.36, 0.00, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.73, 0.36, 0.00, 1.00)
    colors[clr.ButtonActive]           = ImVec4(1.00, 0.50, 0.00, 1.00)
    colors[clr.Header]                 = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.HeaderHovered]          = ImVec4(0.70, 0.35, 0.01, 1.00)
    colors[clr.HeaderActive]           = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.SeparatorHovered]       = ImVec4(0.49, 0.24, 0.00, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.49, 0.24, 0.00, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.48, 0.23, 0.00, 1.00)
    colors[clr.ResizeGripHovered]      = ImVec4(0.78, 0.38, 0.00, 1.00)
    colors[clr.ResizeGripActive]       = ImVec4(1.00, 0.49, 0.00, 1.00)
    colors[clr.PlotLines]              = ImVec4(0.83, 0.41, 0.00, 1.00)
    colors[clr.PlotLinesHovered]       = ImVec4(1.00, 0.99, 0.00, 1.00)
    colors[clr.PlotHistogram]          = ImVec4(0.93, 0.46, 0.00, 1.00)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 0.00)
    colors[clr.ScrollbarBg]            = ImVec4(0.00, 0.00, 0.00, 0.53)
    colors[clr.ScrollbarGrab]          = ImVec4(0.33, 0.33, 0.33, 1.00)
    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.39, 0.39, 0.39, 1.00)
    colors[clr.ScrollbarGrabActive]    = ImVec4(0.48, 0.48, 0.48, 1.00)
    colors[clr.CloseButton]            = colors[clr.FrameBg]
    colors[clr.CloseButtonHovered]     = colors[clr.FrameBgHovered]
    colors[clr.CloseButtonActive]      = colors[clr.FrameBgActive]
end
function bordTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4

    style.FrameRounding    = 4.0
    style.GrabRounding     = 4.0

    colors[clr.Text]                 = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.TextDisabled]         = ImVec4(0.73, 0.75, 0.74, 1.00)
    colors[clr.WindowBg]             = ImVec4(0.09, 0.09, 0.09, 0.94)
    colors[clr.ChildWindowBg]        = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    colors[clr.Border]               = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.BorderShadow]         = ImVec4(0.00, 0.00, 0.00, 0.00)
    colors[clr.FrameBg]              = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.FrameBgHovered]       = ImVec4(0.84, 0.66, 0.66, 0.40)
    colors[clr.FrameBgActive]        = ImVec4(0.84, 0.66, 0.66, 0.67)
    colors[clr.TitleBg]              = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.TitleBgActive]        = ImVec4(0.47, 0.22, 0.22, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.47, 0.22, 0.22, 0.67)
    colors[clr.MenuBarBg]            = ImVec4(0.34, 0.16, 0.16, 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.CheckMark]            = ImVec4(1.00, 1.00, 1.00, 1.00)
    colors[clr.SliderGrab]           = ImVec4(0.71, 0.39, 0.39, 1.00)
    colors[clr.SliderGrabActive]     = ImVec4(0.84, 0.66, 0.66, 1.00)
    colors[clr.Button]               = ImVec4(0.47, 0.22, 0.22, 0.65)
    colors[clr.ButtonHovered]        = ImVec4(0.71, 0.39, 0.39, 0.65)
    colors[clr.ButtonActive]         = ImVec4(0.20, 0.20, 0.20, 0.50)
    colors[clr.Header]               = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.HeaderHovered]        = ImVec4(0.84, 0.66, 0.66, 0.65)
    colors[clr.HeaderActive]         = ImVec4(0.84, 0.66, 0.66, 0.00)
    colors[clr.Separator]            = ImVec4(0.43, 0.43, 0.50, 0.50)
    colors[clr.SeparatorHovered]     = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.SeparatorActive]      = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGrip]           = ImVec4(0.71, 0.39, 0.39, 0.54)
    colors[clr.ResizeGripHovered]    = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.ResizeGripActive]     = ImVec4(0.84, 0.66, 0.66, 0.66)
    colors[clr.CloseButton]          = ImVec4(0.41, 0.41, 0.41, 1.00)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
function greenTheme()
  imgui.SwitchContext()
  local style  = imgui.GetStyle()
  local colors = style.Colors
  local clr    = imgui.Col
  local ImVec4 = imgui.ImVec4
  local ImVec2 = imgui.ImVec2

  style.WindowRounding         = 4.0
  style.WindowTitleAlign       = ImVec2(0.5, 0.5)
  style.ChildWindowRounding    = 2.0
  style.FrameRounding          = 4.0
  style.ItemSpacing            = ImVec2(10, 5)
  style.ScrollbarSize          = 15
  style.ScrollbarRounding      = 0
  style.GrabMinSize            = 9.6
  style.GrabRounding           = 1.0
  style.WindowPadding          = ImVec2(10, 10)
  style.AntiAliasedLines       = true
  style.AntiAliasedShapes      = true
  style.FramePadding           = ImVec2(5, 4)
  style.DisplayWindowPadding   = ImVec2(27, 27)
  style.DisplaySafeAreaPadding = ImVec2(5, 5)
  style.ButtonTextAlign        = ImVec2(0.5, 0.5)
  style.IndentSpacing          = 12.0
  style.Alpha                  = 1.0

    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(0.00, 0.00, 0.00, 0.00)
    colors[clr.PopupBg]              = ImVec4(0.08, 0.08, 0.08, 0.94)
    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.FrameBg]              = ImVec4(0.44, 0.44, 0.44, 0.60)
    colors[clr.FrameBgHovered]       = ImVec4(0.57, 0.57, 0.57, 0.70)
    colors[clr.FrameBgActive]        = ImVec4(0.76, 0.76, 0.76, 0.80)
    colors[clr.TitleBg]              = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]        = ImVec4(0.16, 0.16, 0.16, 1.00)
    colors[clr.TitleBgCollapsed]     = ImVec4(0.00, 0.00, 0.00, 0.60)
    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.CheckMark]            = ImVec4(0.13, 0.75, 0.55, 0.80)
    colors[clr.SliderGrab]           = ImVec4(0.13, 0.75, 0.75, 0.80)
    colors[clr.SliderGrabActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Button]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ButtonHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ButtonActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Header]               = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.HeaderHovered]        = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.HeaderActive]         = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.Separator]            = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.SeparatorHovered]     = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.SeparatorActive]      = ImVec4(0.13, 0.75, 1.00, 0.80)
    colors[clr.ResizeGrip]           = ImVec4(0.13, 0.75, 0.55, 0.40)
    colors[clr.ResizeGripHovered]    = ImVec4(0.13, 0.75, 0.75, 0.60)
    colors[clr.ResizeGripActive]     = ImVec4(0.13, 0.75, 1.00, 0.80)
    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.TextSelectedBg]       = ImVec4(0.26, 0.59, 0.98, 0.35)
    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()
elseif HLcfg.main.theme == 4 then violetTheme()
elseif HLcfg.main.theme == 5 then orangeTheme()
elseif HLcfg.main.theme == 6 then bordTheme()
elseif HLcfg.main.theme == 7 then greenTheme()  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'Добавлять время во фразу', imgui.ImBool(HLcfg.main.texttime)) then HLcfg.main.texttime = not HLcfg.main.texttime end
        ShowHelpMarker(u8'Добавляет в вашу фразу время, за которое вы словили имущество.', 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())

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()
        if HLcfg.main.theme ~= 4 then violetTheme() end
        if imgui.Button(u8'Фиолетовая тема') then HLcfg.main.theme = 4; violetTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 5 then orangeTheme() end
        if imgui.Button(u8'Оранжевая тема', imgui.SameLine()) then HLcfg.main.theme = 5; orangeTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 6 then bordTheme() end
        if imgui.Button(u8'Тёмно - красная тема', imgui.SameLine()) then HLcfg.main.theme = 6; bordTheme() end
        GetTheme()
        if HLcfg.main.theme ~= 7 then greenTheme() end
        if imgui.Button(u8'Зелёная') then HLcfg.main.theme = 7; greenTheme() 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 Kenez for {20B2AA}no name squad! {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
Убирай imgui.TreeNode
 
  • Эм
Реакции: KOJIKOV

Zeusss

Активный
170
33
Как после получения своего айди с помощью
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
его использовать например тут?
Lua:
sampSendChat("/id "полученный айди")
 

Gorskin

I shit on you
Проверенный
1,246
1,042
Как после получения своего айди с помощью
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
его использовать например тут?
Lua:
sampSendChat("/id "полученный айди")
Lua:
sampSendChat("/id "..id)

Как получить текст с сайта и вывести его в print? Хочу получать чат ютуба:Посмотреть вложение 163217
Поднимаю
 
Последнее редактирование: