Баг с окном

RICJS29_JSJA

Участник
Автор темы
93
4
Версия MoonLoader
Другое
1714686186485.png

огроменное слишком, как исправить?
Lua:
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 600, 500
 

RICJS29_JSJA

Участник
Автор темы
93
4
Lua:
script_name('DrivingShool_Helper')
script_author('Marcus_Kransov')
script_version('1.0')
script_version_number(1.0)

---------

require('lib.moonloader')

------

local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local ffi = require('ffi')
local new = imgui.new
local tegscript = '{4682b4}[Driving Shool Helper]{ffffff}'
local keys = require("vkeys")
local inicfg = require("inicfg")
local cfg = inicfg.load({
    config = {
        rank = '',
        number = '',
        otdel = ''
    },
    RpOtigrovki = {
        sms_message = '',
        privetstvie = '',
        badge = '',
        cena_license = '',
        bodycam_true = '',
        bodycam_status = '',
        bodycam_false = ''
    }
}, 'DrivingShool_Helper.ini')

local Menu_Script = new.bool()
local Menu_InfoScript = new.bool()
local Menu_Glavnoe = new.bool()

local peremennie = {
    ['{full_name}'] = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)),
    ['{fullname}'] = sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))):gsub('_', ' ')
}
local jam = require 'jamicons'
local font = {}

imgui.OnInitialize(function()
    imagestart = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\D-Shool_Helper\\images\\DrivingShoolMenuStart.jpg")
    imagescriptinfo = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\D-Shool_Helper\\images\\DrivingShoolMenuInfoScript.jpg")
    blue_theme()
    ----
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic()
    example = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14)..'\\impact.ttf', 16, _, glyph_ranges)
    ----
    local font_config = imgui.ImFontConfig()
    font_config.SizePixels = 20;
    local iconRanges = new.ImWchar[3](jam.min_range, jam.max_range, 0)
    font['jam'] = imgui.GetIO().Fonts:AddFontFromMemoryCompressedBase85TTF(jam.get_font_data_base85(), 24, font_config, iconRanges)
end)
------
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

local ZMENU = [[
    '1' — Приветствие
    '2' — Бейджик
    '3' — Попросить паспорт
    '4' — Попросить мед.карту (Лицензия на оружие)
    '5' — Попросить паспорт и мед.карту
]]
local BMENU = [[
    '1' — Оформить лицензию
    '2' — Назвать цену на лицензию.
    '3' — Отказать (Нет мед.карты)
    '4' — Поправить бейдж (/clist)
    '5' — Включить Body Cam
    '6' — Состояние Body Cam
    '7' — Выключить Body Cam
]]
------

function main()

    sampRegisterChatCommand('dsh', function() Menu_Script[0] = not Menu_Script[0] end)
    sampRegisterChatCommand('ddd', function() Menu_InfoScript[0] = not Menu_InfoScript[0] end)
    sampAddChatMessage(tegscript .. ' Загружен. Активация: /dsh', -1)
    while true do
        wait(0)
------
local current_dialog = sampHasDialogRespond()
local result, button, list, input = sampHasDialogRespond(current_dialog)
    if current_dialog == 10 then
        if result and button == 1 and list == 0 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 1 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 2  then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 3 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        end
    end
------

    if isKeyDown(keys.VK_Z) then
    local lineHeight = renderGetFontDrawHeight(my_font)
    local y = 400
    for line in ZMENU:gmatch("[^\r\n]+") do
        renderFontDrawText(my_font, line, 10, y, 0xFFFFFFFF)
        y = y + lineHeight
    end
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_1) then
        sampSendChat('Здравствуйте. Я сотрудник автошколы ' .. nick() .. ', чем могу помочь?')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_2) then
        sampSendChat('/do На груди бейджик: ' .. nick() .. ' | Управляющий | Тел: ')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_3) then
        sampSendChat('Хорошо. Ваш паспорт пожалуйста.')
    wait(1500)
        sampSendChat('/showpass id')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_4) then
        sampSendChat('Хорошо. Покажите вашу медицинскую карту.')
    wait(1500)
        sampSendChat('/b /showmc id')
    end
    if isKeyDown(keys.VK_B) then
        local lineHeight = renderGetFontDrawHeight(my_font)
        local y = 400
        for line in BMENU:gmatch("[^\r\n]+") do
            renderFontDrawText(my_font, line, 10, y, 0xFFFFFFFF)
            y = y + lineHeight
        end
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_1) then
        sampSendChat('/do Инструктор открыл(а) кейс и достал бланк лицензии.')
    wait(1500)
        sampSendChat('/me заполнил(а) бланк на выдачу соответствующей лицензии')
    wait(1500)
        sampSendChat('/me поставил(а) подпись и штамп "Instructors"')
    wait(1500)
        sampSetChatInputEnabled(true)
        sampSetChatInputText("/givelicense")
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_2) then
        sampSendChat('Стоимость лицензии составит - вирт. Готовы оплатить?')
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_3) then
        sampSendChat('Увы, но вынужден Вам отказать в продаже так как у вас отсутствует мед. карта.')
    wait(1500)
        sampSendChat('Её можно получить в центре здравоохранения, после её получения ожидаем Вас.')
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_4) then
        sampSendChat('/me поправил(а) бейджик')
    wait(1500)
        sampSendChat('/clist 16')
    wait(1500)
        sampSendChat('/do Бейджик на груди — « Instructors | ' .. nick() .. ' | ' .. u8:decode(cfg.config.rank) .. ' | ' .. u8:decode(cfg.config.otdel) .. ' »')
    end
    end
end
------
local smsmessage = new.char[256](u8(cfg.RpOtigrovki.sms_message))
local privetstvie = new.char[256](u8(cfg.RpOtigrovki.privetstvie))
local badge = new.char[256](u8(cfg.RpOtigrovki.badge))
local cena_license = new.char[256](u8(cfg.RpOtigrovki.cena_license))
local bodycam_true = new.char[256](u8(cfg.RpOtigrovki.bodycam_true))
local bodycam_status = new.char[256](u8(cfg.RpOtigrovki.bodycam_status))
local bodycam_false = new.char[256](u8(cfg.RpOtigrovki.bodycam_false))
------
local DSH_OScripte = 'Комбинация\tФункция\tКоманда\n{4682b4}Z + 1{ffffff}\tПриветствие\t{4682b4}/qq{ffffff}\n{4682b4}Z + 2{ffffff}\tПоказывает бейдж\t{4682b4}/badge{ffffff}\n{4682b4}Z + 3{ffffff}\tПопросить паспорт\t{4682b4}/dpasp{ffffff}\n{4682b4}Z + 4{ffffff}\tПопросить мед.карту\t{4682b4}/dmedk{ffffff}\n \nt'

local newFrame = imgui.OnFrame(
    function() return Menu_Script[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(200, 299), imgui.Cond.FirstUseEver)
        imgui.Begin('Driving Shool Helper', Menu_Script, imgui.WindowFlags.NoResize)
        imgui.Image(imagestart, imgui.ImVec2(520, 200))
imgui.SetCursorPos(imgui.ImVec2(95,95))
    if imgui.Button(u8'\t\t\t\t\t\t\t\tМеню скрипта\t\t\t\t\t\t\t    ') then
        Menu_Glavnoe[0] = true
        Menu_Script[0] = false
    end
imgui.SetCursorPos(imgui.ImVec2(95,125))
    if imgui.Button(u8'          Перезагрузить\t\t ') then
        thisScript():reload()
    end
imgui.SameLine()
    if imgui.Button(u8'          Выключить\t\t    ') then
            sampAddChatMessage(tegscript ..' Выключен. (( Для включения зажмите CTRL + R ))')
        thisScript():unload()
    end
imgui.SetCursorPos(imgui.ImVec2(95,153))
    if imgui.Button(u8'                           Подробней о скрипте                         ') then
        sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        Menu_Script[0] = false
    end
        imgui.End()
    end
)

local tab = 1

local newFrame2 = imgui.OnFrame(
    function() return Menu_Glavnoe[0] end,
    function(self)
   
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 200, 299
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Driving Shool Helper', Menu_Glavnoe, imgui.WindowFlags.NoScrollbar)
-------------------------------
    if imgui.Button(u8'Главное меню', imgui.ImVec2(145,40)) then tab = 1 end
    if imgui.Button(u8'Настройки', imgui.ImVec2(145,40)) then tab = 2 end
    if imgui.Button(u8'Отыгровки', imgui.ImVec2(145,40)) then tab = 3 end
    if imgui.Button(u8'FAQ', imgui.ImVec2(145,40)) then tab = 4 end
    if imgui.Button(u8'Unload', imgui.ImVec2(70,26)) then
        sampAddChatMessage(tegscript .. ' Выключен', -1)
        thisScript():unload()
    end
imgui.SameLine()
    if imgui.Button(u8'Reload', imgui.ImVec2(70,26)) then
        thisScript():reload()
    end

    if tab == 1 then
imgui.SetCursorPos(imgui.ImVec2(155,40))
        imgui.Text('s')
    elseif tab == 2 then

    elseif tab == 3 then
imgui.SetCursorPos(imgui.ImVec2(155,40))
    imgui.Text(u8'Отыгровка при получении SMS:')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Только если включена функция в настройках')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,60))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['HISTORY'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(smsmessage, '/seeDo ' .. u8('>> Пришло новое сообщение на iPhone 15 Pro Max <<'))
        cfg.RpOtigrovki.sms_message = u8:decode(ffi.string(smsmessage))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Восстановит стандартную отыгровку')
        imgui.EndTooltip()
    end
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##test', smsmessage, 256) then
        cfg.RpOtigrovki.sms_message = u8:decode(ffi.string(smsmessage))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,90))
    imgui.Text(u8'Отыгровка приветствия:')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Изменяет отыгровку в бинде\n(Z + 1 | /salam)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,110))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['REDO'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(privetstvie, u8('Здравствуйте. Я сотрудник автошколы M.Kransov, чем могу помочь?'))
        cfg.RpOtigrovki.privetstvie = u8:decode(ffi.string(privetstvie))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Восстановит стандартную отыгровку')
        imgui.EndTooltip()
    end
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testt', privetstvie, 256) then
        cfg.RpOtigrovki.privetstvie = u8:decode(ffi.string(privetstvie))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,140))
    imgui.Text(u8'Бейджик: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Изменяет отыгровку бейджика на груди\n(Z + 2 | /badge)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,160))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['STOP_SIGN'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(badge, u8('/do На груди бейджик: Name | Rank | Тел: number'))
        cfg.RpOtigrovki.badge = u8:decode(ffi.string(badge))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testtt', badge, 256) then
        cfg.RpOtigrovki.badge = u8:decode(ffi.string(badge))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,190))
    imgui.Text(u8'Отыгровка Боди-Камеры [Включить]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыграет включение камеры\n(B + 5)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,210))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['UNDO'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_true, u8('/me нажал на кнопку на нагрудной камере «Body Cam G-101» и включил запись.'))
        cfg.RpOtigrovki.bodycam_true = u8:decode(ffi.string(bodycam_true))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testttt', bodycam_true, 256) then
        cfg.RpOtigrovki.bodycam_true = u8:decode(ffi.string(bodycam_true))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,240))
    imgui.Text(u8'Отыгровка Боди-Камеры [Состояние]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыгрывает состояние камеры\n(B + 6)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,260))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['TRASH'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_status, u8('/do Нагрудная камера «Body Cam G-101» ведет запись с передачей на SD-карту.'))
        cfg.RpOtigrovki.bodycam_status = u8:decode(ffi.string(bodycam_status))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##tessst', bodycam_status, 256) then
        cfg.RpOtigrovki.bodycam_status = u8:decode(ffi.string(bodycam_status))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,290))
    imgui.Text(u8'Отыгровка Боди-Камеры [Выключение]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыгрывает выключение камеры\n(B + 7)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,310))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['CLOSE'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_false, u8('/me нажал на кнопку на нагрудной камере и выключил запись.'))
        cfg.RpOtigrovki.bodycam_false = u8:decode(ffi.string(bodycam_false))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##tttesst', bodycam_false, 256) then
        cfg.RpOtigrovki.bodycam_false = u8:decode(ffi.string(bodycam_false))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
    elseif tab == 4 then

    end
-------------------------------

        imgui.End()
    end
)

-----Функции-----

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

    imgui.GetStyle().WindowPadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2)
    imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0)
    imgui.GetStyle().IndentSpacing = 0
    imgui.GetStyle().ScrollbarSize = 10
    imgui.GetStyle().GrabMinSize = 10
    imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    --==[ BORDER ]==--
    imgui.GetStyle().WindowBorderSize = 1
    imgui.GetStyle().ChildBorderSize = 1
    imgui.GetStyle().PopupBorderSize = 1
    imgui.GetStyle().FrameBorderSize = 1
    imgui.GetStyle().TabBorderSize = 1

    --==[ ROUNDING ]==--
    imgui.GetStyle().WindowRounding = 8
    imgui.GetStyle().ChildRounding = 8
    imgui.GetStyle().FrameRounding = 8
    imgui.GetStyle().PopupRounding = 8
    imgui.GetStyle().ScrollbarRounding = 8
    imgui.GetStyle().GrabRounding = 8
    imgui.GetStyle().TabRounding = 8

    colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 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.ChildBg]          = ImVec4(1.00, 1.00, 1.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.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.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)
end
function imgui.CenterText(text)
    imgui.SetCursorPosX(imgui.GetWindowWidth()/2-imgui.CalcTextSize(u8(text)).x/2)
    imgui.Text(u8(text))
end
function imgui.TextColoredRGB(text)
    local style = imgui.GetStyle()
    local colors = style.Colors
    local ImVec4 = imgui.ImVec4
    local explode_argb = function(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local getcolor = function(color)
        if color:sub(1, 6):upper() == 'SSSSSS' then
            local r, g, b = colors[1].x, colors[1].y, colors[1].z
            local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
            return ImVec4(r, g, b, a / 255)
        end
        local color = type(color) == 'string' and tonumber(color, 16) or color
        if type(color) ~= 'number' then return end
        local r, g, b, a = explode_argb(color)
        return imgui.ImVec4(r/255, g/255, b/255, a/255)
    end
    local render_text = function(text_)
        for w in text_:gmatch('[^\r\n]+') do
            local text, colors_, m = {}, {}, 1
            w = w:gsub('{(......)}', '{%1FF}')
            while w:find('{........}') do
                local n, k = w:find('{........}')
                local color = getcolor(w:sub(n + 1, k - 1))
                if color then
                    text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
                    colors_[#colors_ + 1] = color
                    m = n
                end
                w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
            end
            if text[0] then
                for i = 0, #text do
                    imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
                    imgui.SameLine(nil, 0)
                end
                imgui.NewLine()
            else imgui.Text(u8(w)) end
        end
    end
    render_text(text)
end
function nick()
    return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))):gsub('_', ' ')
end
Что там?
 
Последнее редактирование:

Masayuki

Участник
26
8
Код:
script_name('DrivingShool_Helper')
script_author('Marcus_Kransov')
script_version('1.0')
script_version_number(1.0)

---------

require('lib.moonloader')

------

local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local ffi = require('ffi')
local new = imgui.new
local tegscript = '{4682b4}[Driving Shool Helper]{ffffff}'
local keys = require("vkeys")
local inicfg = require("inicfg")
local cfg = inicfg.load({
    config = {
        rank = '',
        number = '',
        otdel = ''
    },
    RpOtigrovki = {
        sms_message = '',
        privetstvie = '',
        badge = '',
        cena_license = '',
        bodycam_true = '',
        bodycam_status = '',
        bodycam_false = ''
    }
}, 'DrivingShool_Helper.ini')

local Menu_Script = new.bool()
local Menu_InfoScript = new.bool()
local Menu_Glavnoe = new.bool()

local peremennie = {
    ['{full_name}'] = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)),
    ['{fullname}'] = sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))):gsub('_', ' ')
}
local jam = require 'jamicons'
local font = {}

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil;
    imagestart = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\D-Shool_Helper\\images\\DrivingShoolMenuStart.jpg")
    imagescriptinfo = imgui.CreateTextureFromFile(getGameDirectory() .. "\\moonloader\\D-Shool_Helper\\images\\DrivingShoolMenuInfoScript.jpg")
    blue_theme()
    ----
    local glyph_ranges = imgui.GetIO().Fonts:GetGlyphRangesCyrillic()
    example = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14)..'\\impact.ttf', 16, _, glyph_ranges)
    ----
    local font_config = imgui.ImFontConfig()
    font_config.SizePixels = 20;
    local iconRanges = new.ImWchar[3](jam.min_range, jam.max_range, 0)
    font['jam'] = imgui.GetIO().Fonts:AddFontFromMemoryCompressedBase85TTF(jam.get_font_data_base85(), 24, font_config, iconRanges)
end)
------
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

local ZMENU = [[
    '1' — Приветствие
    '2' — Бейджик
    '3' — Попросить паспорт
    '4' — Попросить мед.карту (Лицензия на оружие)
    '5' — Попросить паспорт и мед.карту
]]
local BMENU = [[
    '1' — Оформить лицензию
    '2' — Назвать цену на лицензию.
    '3' — Отказать (Нет мед.карты)
    '4' — Поправить бейдж (/clist)
    '5' — Включить Body Cam
    '6' — Состояние Body Cam
    '7' — Выключить Body Cam
]]
------

function main()

    sampRegisterChatCommand('dsh', function() Menu_Script[0] = not Menu_Script[0] end)
    sampRegisterChatCommand('ddd', function() Menu_InfoScript[0] = not Menu_InfoScript[0] end)
    sampAddChatMessage(tegscript .. ' Загружен. Активация: /dsh', -1)
    while true do
        wait(0)
------
local current_dialog = sampHasDialogRespond()
local result, button, list, input = sampHasDialogRespond(current_dialog)
    if current_dialog == 10 then
        if result and button == 1 and list == 0 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 1 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 2  then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        elseif result and button == 1 and list == 3 then
            sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        end
    end
------

    if isKeyDown(keys.VK_Z) then
    local lineHeight = renderGetFontDrawHeight(my_font)
    local y = 400
    for line in ZMENU:gmatch("[^\r\n]+") do
        renderFontDrawText(my_font, line, 10, y, 0xFFFFFFFF)
        y = y + lineHeight
    end
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_1) then
        sampSendChat('Здравствуйте. Я сотрудник автошколы ' .. nick() .. ', чем могу помочь?')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_2) then
        sampSendChat('/do На груди бейджик: ' .. nick() .. ' | Управляющий | Тел: ')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_3) then
        sampSendChat('Хорошо. Ваш паспорт пожалуйста.')
    wait(1500)
        sampSendChat('/showpass id')
    end
    if isKeyDown(keys.VK_Z) and isKeyJustPressed(keys.VK_4) then
        sampSendChat('Хорошо. Покажите вашу медицинскую карту.')
    wait(1500)
        sampSendChat('/b /showmc id')
    end
    if isKeyDown(keys.VK_B) then
        local lineHeight = renderGetFontDrawHeight(my_font)
        local y = 400
        for line in BMENU:gmatch("[^\r\n]+") do
            renderFontDrawText(my_font, line, 10, y, 0xFFFFFFFF)
            y = y + lineHeight
        end
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_1) then
        sampSendChat('/do Инструктор открыл(а) кейс и достал бланк лицензии.')
    wait(1500)
        sampSendChat('/me заполнил(а) бланк на выдачу соответствующей лицензии')
    wait(1500)
        sampSendChat('/me поставил(а) подпись и штамп "Instructors"')
    wait(1500)
        sampSetChatInputEnabled(true)
        sampSetChatInputText("/givelicense")
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_2) then
        sampSendChat('Стоимость лицензии составит - вирт. Готовы оплатить?')
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_3) then
        sampSendChat('Увы, но вынужден Вам отказать в продаже так как у вас отсутствует мед. карта.')
    wait(1500)
        sampSendChat('Её можно получить в центре здравоохранения, после её получения ожидаем Вас.')
    end
    if isKeyDown(keys.VK_B) and isKeyJustPressed(keys.VK_4) then
        sampSendChat('/me поправил(а) бейджик')
    wait(1500)
        sampSendChat('/clist 16')
    wait(1500)
        sampSendChat('/do Бейджик на груди — « Instructors | ' .. nick() .. ' | ' .. u8:decode(cfg.config.rank) .. ' | ' .. u8:decode(cfg.config.otdel) .. ' »')
    end
    end
end
------
local smsmessage = new.char[256](u8(cfg.RpOtigrovki.sms_message))
local privetstvie = new.char[256](u8(cfg.RpOtigrovki.privetstvie))
local badge = new.char[256](u8(cfg.RpOtigrovki.badge))
local cena_license = new.char[256](u8(cfg.RpOtigrovki.cena_license))
local bodycam_true = new.char[256](u8(cfg.RpOtigrovki.bodycam_true))
local bodycam_status = new.char[256](u8(cfg.RpOtigrovki.bodycam_status))
local bodycam_false = new.char[256](u8(cfg.RpOtigrovki.bodycam_false))
------
local DSH_OScripte = 'Комбинация\tФункция\tКоманда\n{4682b4}Z + 1{ffffff}\tПриветствие\t{4682b4}/qq{ffffff}\n{4682b4}Z + 2{ffffff}\tПоказывает бейдж\t{4682b4}/badge{ffffff}\n{4682b4}Z + 3{ffffff}\tПопросить паспорт\t{4682b4}/dpasp{ffffff}\n{4682b4}Z + 4{ffffff}\tПопросить мед.карту\t{4682b4}/dmedk{ffffff}\n \nt'

local newFrame = imgui.OnFrame(
    function() return Menu_Script[0] end,
    function(self)
        local resX, resY = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(400, 299), imgui.Cond.FirstUseEver)
        imgui.Begin('Driving Shool Helper##1', Menu_Script, imgui.WindowFlags.NoResize)
        imgui.Image(imagestart, imgui.ImVec2(520, 200))
imgui.SetCursorPos(imgui.ImVec2(95,95))
    if imgui.Button(u8'\t\t\t\t\t\t\t\tМеню скрипта\t\t\t\t\t\t\t    ') then
        Menu_Glavnoe[0] = true
        Menu_Script[0] = false
    end
imgui.SetCursorPos(imgui.ImVec2(95,125))
    if imgui.Button(u8'          Перезагрузить\t\t ') then
        thisScript():reload()
    end
imgui.SameLine()
    if imgui.Button(u8'          Выключить\t\t    ') then
            sampAddChatMessage(tegscript ..' Выключен. (( Для включения зажмите CTRL + R ))')
        thisScript():unload()
    end
imgui.SetCursorPos(imgui.ImVec2(95,153))
    if imgui.Button(u8'                           Подробней о скрипте                         ') then
        sampShowDialog(10, '                       Driving Shool Helper | Подробней о скрипте', DSH_OScripte, 'Назад', 'Дальше', 5)
        Menu_Script[0] = false
    end
        imgui.End()
    end
)

local tab = 1

local newFrame2 = imgui.OnFrame(
    function() return Menu_Glavnoe[0] end,
    function(self)
  
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 200, 299
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Driving Shool Helper##2', Menu_Glavnoe, imgui.WindowFlags.NoScrollbar)
-------------------------------
    if imgui.Button(u8'Главное меню', imgui.ImVec2(145,40)) then tab = 1 end
    if imgui.Button(u8'Настройки', imgui.ImVec2(145,40)) then tab = 2 end
    if imgui.Button(u8'Отыгровки', imgui.ImVec2(145,40)) then tab = 3 end
    if imgui.Button(u8'FAQ', imgui.ImVec2(145,40)) then tab = 4 end
    if imgui.Button(u8'Unload', imgui.ImVec2(70,26)) then
        sampAddChatMessage(tegscript .. ' Выключен', -1)
        thisScript():unload()
    end
imgui.SameLine()
    if imgui.Button(u8'Reload', imgui.ImVec2(70,26)) then
        thisScript():reload()
    end

    if tab == 1 then
imgui.SetCursorPos(imgui.ImVec2(155,40))
        imgui.Text('s')
    elseif tab == 2 then

    elseif tab == 3 then
imgui.SetCursorPos(imgui.ImVec2(155,40))
    imgui.Text(u8'Отыгровка при получении SMS:')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Только если включена функция в настройках')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,60))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['HISTORY'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(smsmessage, '/seeDo ' .. u8('>> Пришло новое сообщение на iPhone 15 Pro Max <<'))
        cfg.RpOtigrovki.sms_message = u8:decode(ffi.string(smsmessage))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Восстановит стандартную отыгровку')
        imgui.EndTooltip()
    end
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##test', smsmessage, 256) then
        cfg.RpOtigrovki.sms_message = u8:decode(ffi.string(smsmessage))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,90))
    imgui.Text(u8'Отыгровка приветствия:')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Изменяет отыгровку в бинде\n(Z + 1 | /salam)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,110))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['REDO'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(privetstvie, u8('Здравствуйте. Я сотрудник автошколы M.Kransov, чем могу помочь?'))
        cfg.RpOtigrovki.privetstvie = u8:decode(ffi.string(privetstvie))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Восстановит стандартную отыгровку')
        imgui.EndTooltip()
    end
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testt', privetstvie, 256) then
        cfg.RpOtigrovki.privetstvie = u8:decode(ffi.string(privetstvie))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,140))
    imgui.Text(u8'Бейджик: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Изменяет отыгровку бейджика на груди\n(Z + 2 | /badge)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,160))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['STOP_SIGN'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(badge, u8('/do На груди бейджик: Name | Rank | Тел: number'))
        cfg.RpOtigrovki.badge = u8:decode(ffi.string(badge))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testtt', badge, 256) then
        cfg.RpOtigrovki.badge = u8:decode(ffi.string(badge))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,190))
    imgui.Text(u8'Отыгровка Боди-Камеры [Включить]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыграет включение камеры\n(B + 5)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,210))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['UNDO'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_true, u8('/me нажал на кнопку на нагрудной камере «Body Cam G-101» и включил запись.'))
        cfg.RpOtigrovki.bodycam_true = u8:decode(ffi.string(bodycam_true))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##testttt', bodycam_true, 256) then
        cfg.RpOtigrovki.bodycam_true = u8:decode(ffi.string(bodycam_true))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,240))
    imgui.Text(u8'Отыгровка Боди-Камеры [Состояние]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыгрывает состояние камеры\n(B + 6)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,260))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['TRASH'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_status, u8('/do Нагрудная камера «Body Cam G-101» ведет запись с передачей на SD-карту.'))
        cfg.RpOtigrovki.bodycam_status = u8:decode(ffi.string(bodycam_status))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##tessst', bodycam_status, 256) then
        cfg.RpOtigrovki.bodycam_status = u8:decode(ffi.string(bodycam_status))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(155,290))
    imgui.Text(u8'Отыгровка Боди-Камеры [Выключение]: ')
imgui.SameLine()
    imgui.TextDisabled('(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.Text(u8'Отыгрывает выключение камеры\n(B + 7)')
        imgui.EndTooltip()
    end
imgui.SetCursorPos(imgui.ImVec2(155,310))
imgui.PushFont(font['jam'])
    if imgui.Button(jam['CLOSE'], imgui.ImVec2(36,29)) then
        imgui.StrCopy(bodycam_false, u8('/me нажал на кнопку на нагрудной камере и выключил запись.'))
        cfg.RpOtigrovki.bodycam_false = u8:decode(ffi.string(bodycam_false))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopFont()
imgui.SameLine()
imgui.PushItemWidth(330)
    if imgui.InputText('##tttesst', bodycam_false, 256) then
        cfg.RpOtigrovki.bodycam_false = u8:decode(ffi.string(bodycam_false))
        inicfg.save(cfg, 'DrivingShool_Helper.ini')
    end
imgui.PopItemWidth()
    elseif tab == 4 then

    end
-------------------------------

        imgui.End()
    end
)

-----Функции-----

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

    imgui.GetStyle().WindowPadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2)
    imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0)
    imgui.GetStyle().IndentSpacing = 0
    imgui.GetStyle().ScrollbarSize = 10
    imgui.GetStyle().GrabMinSize = 10
    imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    --==[ BORDER ]==--
    imgui.GetStyle().WindowBorderSize = 1
    imgui.GetStyle().ChildBorderSize = 1
    imgui.GetStyle().PopupBorderSize = 1
    imgui.GetStyle().FrameBorderSize = 1
    imgui.GetStyle().TabBorderSize = 1

    --==[ ROUNDING ]==--
    imgui.GetStyle().WindowRounding = 8
    imgui.GetStyle().ChildRounding = 8
    imgui.GetStyle().FrameRounding = 8
    imgui.GetStyle().PopupRounding = 8
    imgui.GetStyle().ScrollbarRounding = 8
    imgui.GetStyle().GrabRounding = 8
    imgui.GetStyle().TabRounding = 8

    colors[clr.FrameBg]                = ImVec4(0.16, 0.29, 0.48, 0.54)
    colors[clr.FrameBgHovered]         = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.FrameBgActive]          = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.TitleBg]                = ImVec4(0.04, 0.04, 0.04, 1.00)
    colors[clr.TitleBgActive]          = ImVec4(0.16, 0.29, 0.48, 1.00)
    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.00, 0.00, 0.51)
    colors[clr.CheckMark]              = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.SliderGrab]             = ImVec4(0.24, 0.52, 0.88, 1.00)
    colors[clr.SliderGrabActive]       = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Button]                 = ImVec4(0.26, 0.59, 0.98, 0.40)
    colors[clr.ButtonHovered]          = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ButtonActive]           = ImVec4(0.06, 0.53, 0.98, 1.00)
    colors[clr.Header]                 = ImVec4(0.26, 0.59, 0.98, 0.31)
    colors[clr.HeaderHovered]          = ImVec4(0.26, 0.59, 0.98, 0.80)
    colors[clr.HeaderActive]           = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.Separator]              = colors[clr.Border]
    colors[clr.SeparatorHovered]       = ImVec4(0.26, 0.59, 0.98, 0.78)
    colors[clr.SeparatorActive]        = ImVec4(0.26, 0.59, 0.98, 1.00)
    colors[clr.ResizeGrip]             = ImVec4(0.26, 0.59, 0.98, 0.25)
    colors[clr.ResizeGripHovered]      = ImVec4(0.26, 0.59, 0.98, 0.67)
    colors[clr.ResizeGripActive]       = ImVec4(0.26, 0.59, 0.98, 0.95)
    colors[clr.TextSelectedBg]         = ImVec4(0.26, 0.59, 0.98, 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.ChildBg]          = ImVec4(1.00, 1.00, 1.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.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.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)
end
function imgui.CenterText(text)
    imgui.SetCursorPosX(imgui.GetWindowWidth()/2-imgui.CalcTextSize(u8(text)).x/2)
    imgui.Text(u8(text))
end
function imgui.TextColoredRGB(text)
    local style = imgui.GetStyle()
    local colors = style.Colors
    local ImVec4 = imgui.ImVec4
    local explode_argb = function(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local getcolor = function(color)
        if color:sub(1, 6):upper() == 'SSSSSS' then
            local r, g, b = colors[1].x, colors[1].y, colors[1].z
            local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
            return ImVec4(r, g, b, a / 255)
        end
        local color = type(color) == 'string' and tonumber(color, 16) or color
        if type(color) ~= 'number' then return end
        local r, g, b, a = explode_argb(color)
        return imgui.ImVec4(r/255, g/255, b/255, a/255)
    end
    local render_text = function(text_)
        for w in text_:gmatch('[^\r\n]+') do
            local text, colors_, m = {}, {}, 1
            w = w:gsub('{(......)}', '{%1FF}')
            while w:find('{........}') do
                local n, k = w:find('{........}')
                local color = getcolor(w:sub(n + 1, k - 1))
                if color then
                    text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
                    colors_[#colors_ + 1] = color
                    m = n
                end
                w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
            end
            if text[0] then
                for i = 0, #text do
                    imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
                    imgui.SameLine(nil, 0)
                end
                imgui.NewLine()
            else imgui.Text(u8(w)) end
        end
    end
    render_text(text)
end
function nick()
    return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))):gsub('_', ' ')
end