как сделать такую надпись

Kegwineye.

Участник
Автор темы
478
20
как сделать такую надпись ? "POLICE HELPER"
126209


@chapo @Dark.
 
Последнее редактирование:

Kegwineye.

Участник
Автор темы
478
20
@chapo как сделать отображение сторон света по этому https://www.blast.hk/threads/13380/post-290957 ?

Сделал так
Lua:
function direction()
    if sampIsLocalPlayerSpawned() then
        local angel = math.ceil(getCharHeading(PLAYER_PED))
        if angel then
            if (angel >= 0 and angel <= 30) or (angel <= 360 and angel >= 330) then
                return "Север"
            elseif (angel > 80 and angel < 100) then
                    return "Запад"
            elseif (angel > 260 and angel < 280) then
                    return "Восток"
            elseif (angel >= 170 and angel <= 190) then
                    return "Юг"
            elseif (angel >= 31 and angel <= 79) then
                    return "Северо-запад"
            elseif (angel >= 191 and angel <= 259) then
                    return "Юго-восток"
            elseif (angel >= 81 and angel <= 169) then
                    return "Юго-запад"
            elseif (angel >= 259 and angel <= 329) then
                    return "Северо-восток"
            else
                return angel
            end
        else
            return "Неизвестно"
        end
    else
        return "Неизвестно"
    end
end

function imgui.OnDrawFrame() -- не Flame а Frame!!

  if not main_window_state.v and not window_state.v then
    imgui.Process = false
  end

  if main_window_state.v then
  local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(900, 535))
        imgui.Begin('##localwindow',  main_window_state, imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoMove)
     imgui.NewLine()
     imgui.SetCursorPosY(0)
     imgui.NewLine()
     imgui.NewLine()
     imgui.NewLine()
     imgui.Text(fa.ICON_FA_USER_SHIELD .. "")
     imgui.SameLine()
     imgui.SetCursorPosY(20)
     imgui.PushFont(fontsize)
     imgui.TextColoredRGB("{0000CB}POLICE HELPER")
     imgui.PopFont()
     imgui.NewLine()
if menu == 0 then
        imgui.BeginChild('##localchild', imgui.ImVec2(890, 432), true)
        if imgui.Button(u8"Основное", imgui.ImVec2(291, 210)) then
            menu = 2 end
        imgui.SameLine()
        if imgui.Button(fa.ICON_FA_COG .. u8"Настройки", imgui.ImVec2(291, 210)) then
            menu = 3 end
        imgui.SameLine()
        if imgui.Button(u8"Донат", imgui.ImVec2(291, 210)) then
            menu = 4 end
        if imgui.Button(u8"Новости", imgui.ImVec2(291, 210)) then
            menu = 5 end
        imgui.SameLine()
        if imgui.Button(u8"Биндер", imgui.ImVec2(291, 210)) then
            menu = 6 end
        imgui.SameLine()
        if imgui.Button(u8"Мульти-настройки", imgui.ImVec2(291, 210)) then
            menu = 7 end
        imgui.EndChild()
    end
    if menu == 2 then
        imgui.BeginChild("", imgui.ImVec2(890, 402), true)
          imgui.Text("test")
          imgui.EndChild()
          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then
          menu = 0
        end
    end
        if menu == 3 then
        imgui.BeginChild("", imgui.ImVec2(890, 402), true)
        if imgui.Button(u8'Вкл/Выкл Статистику') then window_state.v = not window_state.v end
          if imgui.Checkbox('Nick', PrintNick) then end
          if imgui.Checkbox('ID', PrintID) then end
          if imgui.Checkbox('Ping', PrintPing) then end
          if imgui.Checkbox('Heart', PrintHeart) then end
          if imgui.Checkbox(u8'Сторону света', PrintSaw) then
            imgui.Text("Вы смотрите в " .. direction) end
          imgui.EndChild()
          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then
          menu = 0
        end
    end

выдает

[ML] (error) policehelper.lua: ...TA LOW PC SEANSIZE [REBUILT]\moonloader\policehelper.lua:291: attempt to concatenate global 'direction' (a function value)
stack traceback:
...TA LOW PC SEANSIZE [REBUILT]\moonloader\policehelper.lua:291: in function 'OnDrawFrame'
...p\GTA LOW PC SEANSIZE [REBUILT]\moonloader\lib\imgui.lua:1378: in function <...p\GTA LOW PC SEANSIZE [REBUILT]\moonloader\lib\imgui.lua:1367>
[ML] (error) policehelper.lua: Script died due to an error. (22429AF4)
 

Rice.

Известный
Модератор
1,753
1,660
@chapo как сделать отображение сторон света по этому https://www.blast.hk/threads/13380/post-290957 ?

Сделал так
Lua:
function direction()
    if sampIsLocalPlayerSpawned() then
        local angel = math.ceil(getCharHeading(PLAYER_PED))
        if angel then
            if (angel >= 0 and angel <= 30) or (angel <= 360 and angel >= 330) then
                return "Север"
            elseif (angel > 80 and angel < 100) then
                    return "Запад"
            elseif (angel > 260 and angel < 280) then
                    return "Восток"
            elseif (angel >= 170 and angel <= 190) then
                    return "Юг"
            elseif (angel >= 31 and angel <= 79) then
                    return "Северо-запад"
            elseif (angel >= 191 and angel <= 259) then
                    return "Юго-восток"
            elseif (angel >= 81 and angel <= 169) then
                    return "Юго-запад"
            elseif (angel >= 259 and angel <= 329) then
                    return "Северо-восток"
            else
                return angel
            end
        else
            return "Неизвестно"
        end
    else
        return "Неизвестно"
    end
end

function imgui.OnDrawFrame() -- не Flame а Frame!!

  if not main_window_state.v and not window_state.v then
    imgui.Process = false
  end

  if main_window_state.v then
  local sw, sh = getScreenResolution()
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(900, 535))
        imgui.Begin('##localwindow',  main_window_state, imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoMove)
     imgui.NewLine()
     imgui.SetCursorPosY(0)
     imgui.NewLine()
     imgui.NewLine()
     imgui.NewLine()
     imgui.Text(fa.ICON_FA_USER_SHIELD .. "")
     imgui.SameLine()
     imgui.SetCursorPosY(20)
     imgui.PushFont(fontsize)
     imgui.TextColoredRGB("{0000CB}POLICE HELPER")
     imgui.PopFont()
     imgui.NewLine()
if menu == 0 then
        imgui.BeginChild('##localchild', imgui.ImVec2(890, 432), true)
        if imgui.Button(u8"Основное", imgui.ImVec2(291, 210)) then
            menu = 2 end
        imgui.SameLine()
        if imgui.Button(fa.ICON_FA_COG .. u8"Настройки", imgui.ImVec2(291, 210)) then
            menu = 3 end
        imgui.SameLine()
        if imgui.Button(u8"Донат", imgui.ImVec2(291, 210)) then
            menu = 4 end
        if imgui.Button(u8"Новости", imgui.ImVec2(291, 210)) then
            menu = 5 end
        imgui.SameLine()
        if imgui.Button(u8"Биндер", imgui.ImVec2(291, 210)) then
            menu = 6 end
        imgui.SameLine()
        if imgui.Button(u8"Мульти-настройки", imgui.ImVec2(291, 210)) then
            menu = 7 end
        imgui.EndChild()
    end
    if menu == 2 then
        imgui.BeginChild("", imgui.ImVec2(890, 402), true)
          imgui.Text("test")
          imgui.EndChild()
          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then
          menu = 0
        end
    end
        if menu == 3 then
        imgui.BeginChild("", imgui.ImVec2(890, 402), true)
        if imgui.Button(u8'Вкл/Выкл Статистику') then window_state.v = not window_state.v end
          if imgui.Checkbox('Nick', PrintNick) then end
          if imgui.Checkbox('ID', PrintID) then end
          if imgui.Checkbox('Ping', PrintPing) then end
          if imgui.Checkbox('Heart', PrintHeart) then end
          if imgui.Checkbox(u8'Сторону света', PrintSaw) then
            imgui.Text("Вы смотрите в " .. direction) end
          imgui.EndChild()
          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then
          menu = 0
        end
    end

выдает

[ML] (error) policehelper.lua: ...TA LOW PC SEANSIZE [REBUILT]\moonloader\policehelper.lua:291: attempt to concatenate global 'direction' (a function value)
stack traceback:
...TA LOW PC SEANSIZE [REBUILT]\moonloader\policehelper.lua:291: in function 'OnDrawFrame'
...p\GTA LOW PC SEANSIZE [REBUILT]\moonloader\lib\imgui.lua:1378: in function <...p\GTA LOW PC SEANSIZE [REBUILT]\moonloader\lib\imgui.lua:1367>
[ML] (error) policehelper.lua: Script died due to an error. (22429AF4)
Lua:
imgui.Text("Вы смотрите в " .. direction()) end
 

Kegwineye.

Участник
Автор темы
478
20
@Rice.
почему кнопка 75 же K а не P а при входе в биндере кнопка P
Lua:
require "lib.moonloader"

local keys = require "vkeys"

local imgui = require 'imgui'

local inicfg = require "inicfg"

local encoding = require 'encoding'

encoding.default = 'CP1251'

u8 = encoding.UTF8

local fa = require 'fAwesome5'

local themes = import "resource/imgui_themes.lua"

local passwordline = imgui.ImBuffer(256)



local main_window_state = imgui.ImBool(false)

local menu = 0

local showpassword = false



local mainIni = inicfg.load({

 config =

{

password = "",

autologin = false

},   

 hotkey = {

        lock = "[76]", -- L

        key = "[75]" -- K

    }       

   }, "Helper-ARZ")

local rkeys = require 'rkeys'

imgui.HotKey = require('imgui_addons').HotKey

local bindID = 0

local tLastKeys = {} -- тут будут храниться предыдущие хоткеи при переактивации



local ActiveLockMenu = {

    v = decodeJson(mainIni.hotkey.lock)

}



local ActiveKeyMenu = {

    v = decodeJson(mainIni.hotkey.key)

}





local autologin = imgui.ImBool(mainIni.config.autologin)

local passwordline = imgui.ImBuffer(''..mainIni.config.password, 256)



function main()

    if not isSampLoaded() or not isSampfuncsLoaded() then return end

    while not isSampAvailable() do wait(100) end



        sampRegisterChatCommand('test', function() main_window_state.v = not main_window_state.v end)

        sampRegisterChatCommand("cc", cmd_cc)

        sampRegisterChatCommand('fh', fh)

    sampAddChatMessage('{FF7F50}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', -1)

    sampAddChatMessage('{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Helper by Batter - loaded.', -1)

    sampAddChatMessage('{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Script version - {FFD700}Beta 1.0.', -1)

    sampAddChatMessage('{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Thank you for using this script!', -1)

    sampAddChatMessage('{FF7F50}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', -1)







    _, myid = sampGetPlayerIdByCharHandle(PLAYER_PED)

    mynick = sampGetPlayerNickname(myid)



    imgui.Process = false -- его можно вынести до функции при желании



    lock = rkeys.registerHotKey(ActiveLockMenu.v, true, lockFunc)

    key = rkeys.registerHotKey(ActiveLockMenu.v, true, keyFunc)



  while true do

        wait(0)

        if isKeyDown(keys.VK_LMENU) and isKeyJustPressed(keys.VK_M) then

         main_window_state.v = not main_window_state.v

         imgui.Process = main_window_state.v

        end

        if main_window_state.v == false then

        imgui.Process = false -- зачем тебе их два?

        imgui.SwitchContext()

        themes.SwitchColorTheme(3)

    end

  end

end -- добавил ещё end который закрывает функцию маин

function cmdimgui() -- не правильный аргумент cmd_imgui заменен на cmdimgui и тут не обязательно вписывать (arg) можно обойтись и ()

     main_window_state.v = not main_window_state.v

     imgui.Process = main_window_state.v

 end



 function lockFunc()

    if not isPauseMenuActive() and not isSampfuncsConsoleActive() then

    sampSendChat("/lock")

    end

end



function keyFunc()

    sampSendChat("/key")

end



function imgui.OnDrawFrame() -- не Flame а Frame!!

  if main_window_state.v then

  local sw, sh = getScreenResolution()

        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))

        imgui.SetNextWindowSize(imgui.ImVec2(600, 440))

        imgui.Begin('##localwindow',  main_window_state, imgui.WindowFlags.AlwaysAutoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoTitleBar)

     imgui.SetCursorPosY(20)

     imgui.PushFont(fontsize)

     imgui.TextColoredRGB("{FF0000}Arizona{FFFFFF} - {00FFFF}Helper")

     imgui.PopFont()

     imgui.Text(u8"Благодарю вас за использавание ..")

     imgui.Text(u8"..данного хелпера!")

if menu == 0 then

        imgui.BeginChild('##localchild', imgui.ImVec2(590, 180), true)

        imgui.PushFont(fontsize)

        if imgui.Button(u8"Основное", imgui.ImVec2(291, 80)) then

            menu = 2 end

        imgui.SameLine()

        if imgui.Button(u8"Настройки", imgui.ImVec2(291, 80)) then

            menu = 3 end

        if imgui.Button(u8"Автологин", imgui.ImVec2(291, 80)) then

            menu = 4 end

            imgui.SameLine()

        if imgui.Button(u8"Биндер", imgui.ImVec2(291, 80)) then

            menu = 5 end

            imgui.PopFont()

        imgui.EndChild()

        if imgui.Button(u8'Сохранить настройки', imgui.ImVec2(194,50)) then -- Кнопка для сохранения настроек

mainIni.config.password = passwordline.v

mainIni.config.autologin = autologin.v

inicfg.save(mainIni, 'Helper-ARZ.ini')

sampAddChatMessage( "{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Настройки сохранены.", -1) end

imgui.SameLine()

if imgui.Button(u8"Перезагрузить скрипт", imgui.ImVec2(194,50)) then -- Кнопка для перезагрузки скрипта

thisScript():reload() sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Скрипт перезагружен.", -1) end

imgui.SameLine()

if imgui.Button(u8'Выключить скрипт', imgui.ImVec2(194, 50)) then

            showCursor(false)

            thisScript():unload() sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Скрипт выключен.", -1)

            end

    end

    if menu == 2 then

        imgui.BeginChild("", imgui.ImVec2(590, 250), true)

          if imgui.Button(u8'Очистить чат', imgui.ImVec2(120,20)) then sampSendChat "/cc" sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Чат очищен.", -1) end

          imgui.EndChild()

          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then

          menu = 0

        end

    end

        if menu == 3 then

        imgui.BeginChild("", imgui.ImVec2(590, 250), true)

           if   imgui.Button(u8'Зеленая') then

            themes.SwitchColorTheme(8) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №1.", -1) end

             imgui.SameLine()

         if   imgui.Button(u8'Берюзовая') then

            themes.SwitchColorTheme(6) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №2.", -1) end

            imgui.SameLine()

         if   imgui.Button(u8'Cерая')  then

            themes.SwitchColorTheme(5) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №3.", -1) end

            if   imgui.Button(u8'Синеватая') then

            themes.SwitchColorTheme(1) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №4.", -1) end

             imgui.SameLine()

         if   imgui.Button(u8'Фиолетовая') then

            themes.SwitchColorTheme(2) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №5.", -1) end

            imgui.SameLine()

         if   imgui.Button(u8'Сини-Черная') then

            themes.SwitchColorTheme(4) sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: {FFFFFF}Темой установлена тема №6.", -1) end

            imgui.NewLine()

            imgui.Separator()

            imgui.CenterTextColoredRGB('Автор скрипта: The Butterfly Bee')

            imgui.CenterTextColoredRGB('{868686}Нашли ошибку или есть предложение? Пишите сюда:')

            imgui.SetCursorPosX((imgui.GetWindowWidth() - 170) / 2)

            imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.03, 0.35, 0.75, 0.85))

            if imgui.Button(fa.ICON_FA_LINK..u8(" ВКонтакте"), imgui.ImVec2(90, 25)) then

            GHsms('Ссылка скопирована в буфер обмена!')

            setClipboardText("https://vk.com/kinginthedead") end

            imgui.PopStyleColor()

            imgui.SameLine()

            imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.00, 0.13, 0.25, 0.25))

            if imgui.Button(fa.ICON_FA_LINK..u8(" BlastHack"), imgui.ImVec2(90, 25)) then

            GHsms('Ссылка скопирована в буфер обмена!')

            setClipboardText("https://vk.com/kinginthedead") end

            imgui.PopStyleColor()

          imgui.EndChild()

          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then

          menu = 0

        end

    end

        if menu == 4 then

        imgui.BeginChild("", imgui.ImVec2(590, 250), true)

          imgui.Checkbox(u8 " Автологин", autologin)

        if showpassword then

imgui.InputText(u8"", passwordline) else

imgui.InputText(u8"", passwordline, imgui.InputTextFlags.Password) end

imgui.SameLine()

if imgui.Button(showpassword and fa.ICON_FA_EYE ..'' or fa.ICON_FA_EYE ..'') then

showpassword = not showpassword end

          imgui.EndChild()

          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then

          menu = 0

            end

        end

        imgui.NewLine()

        imgui.SameLine()

        if menu == 5 then

        imgui.BeginChild("", imgui.ImVec2(584, 250), true)

        imgui.Text(u8"Кнопка отвечающая за открытие машины (/lock)") imgui.SameLine()

          if imgui.HotKey("##1", ActiveLockMenu, tLastKeys, 100) then

            rkeys.changeHotKey(lock, ActiveLockMenu.v)

            sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: Успешно! Старое значение: {FF0000}" .. table.concat(rkeys.getKeysName(tLastKeys.v), " + ") .. "{ffffff} | Новое: {FF0000}" .. table.concat(rkeys.getKeysName(ActiveLockMenu.v), " + "), -1)

            sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: Строчное значение: {FF0000}" .. encodeJson(ActiveLockMenu.v), -1)



            mainIni.hotkey.bindClock = encodeJson(ActiveLockMenu.v)

            inicfg.save(mainIni, directIni)

        end

        imgui.Text(u8"Кнопка отвечающая за вставления ключей (/key)") imgui.SameLine()

        if imgui.HotKey("##2", ActiveKeyMenu, tLastKeys, 100) then

            rkeys.changeHotKey(key, ActiveKeyMenu.v)

            sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: Успешно! Старое значение: {FF0000}" .. table.concat(rkeys.getKeysName(tLastKeys.v), " + ") .. "{ffffff} | Новое: {FF0000}" .. table.concat(rkeys.getKeysName(ActiveKeyMenu.v), " + "), -1)

            sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: Строчное значение: {FF0000}" .. encodeJson(ActiveKeyMenu.v), -1)



            mainIni.hotkey.bindPass = encodeJson(ActiveKeyMenu.v)

            inicfg.save(mainIni, directIni)

        end

          imgui.EndChild()

          if imgui.Button(u8"< Назад", imgui.ImVec2(100, 30)) then

          menu = 0

            end

        end

    end

    imgui.End()

end



function onWindowMessage(msg, wparam, lparam)

    if msg == 0x100 or msg == 0x101 then

        if (wparam == keys.VK_ESCAPE and (main_window_state.v)) and not isPauseMenuActive() and not isSampfuncsConsoleActive() then

            consumeWindowMessage(true, false)

            if msg == 0x101 then

                main_window_state.v = false

            end

        end

    end

end



function imgui.CenterTextColoredRGB(text)

    local width = imgui.GetWindowWidth()

    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.ImColor(r, g, b, a):GetVec4()

    end



    local render_text = function(text_)

    for w in text_:gmatch('[^\r\n]+') do

    local textsize = w:gsub('{.-}', '')

    local text_width = imgui.CalcTextSize(u8(textsize))

    imgui.SetCursorPosX( width / 2 - text_width .x / 2 )

    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



local fa_font = nil

local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })

function imgui.BeforeDrawFrame()

    if fa_font == nil then

        local font_config = imgui.ImFontConfig()

        font_config.MergeMode = true



        fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fa-solid-900.ttf', 14.0, font_config, fa_glyph_ranges)

        if fontsize == nil then

        fontsize = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 47.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic()) -- вместо 30 любой нужный размеp

        end

    end

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.ImColor(r, g, b, a):GetVec4()

    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 imgui.SelectButton(name, bool, size)

    if Buttonaver.v then

        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.0, 0.6, 0.0, 0.40))

        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.0, 0.8, 0.0, 1.0))

        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(0.0, 1.0, 0.0, 1.0))

    else

        imgui.PushStyleColor(imgui.Col.Button, imgui.ImVec4(0.6, 0.0, 0.0, 0.40))

        imgui.PushStyleColor(imgui.Col.ButtonHovered, imgui.ImVec4(0.8, 0.0, 0.0, 1.0))

        imgui.PushStyleColor(imgui.Col.ButtonActive, imgui.ImVec4(1.0, 0.0, 0.0, 1.0))

    end

    if not size then size = imgui.ImVec2(0, 0) end

    local result = imgui.Button(name, size)

    imgui.PopStyleColor(3)

    if result then Buttonaver.v = not Buttonaver.v end

    return result

end

-- end он тут не нужен



function fh(arg)

var1 = string.match(arg, "(%d+)")

if var1 == nill or var1 == "" then

sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: Введите: /fh [айди дома]", -1)

else

sampSendChat("/findihouse "..var1) end end



function GHsms(text)

    sampAddChatMessage("{FFFFFF}[{FF0000}Arizona{FFFFFF} - {00FFFF}Helper{FFFFFF}]: "..text, 0x00FFFF)

end

    function imgui.Vopros()

    imgui.TextDisabled(fa.ICON_FA_QUESTION_CIRCLE)

end



function cmd_cc(arg)

for i=0,30 do

sampAddChatMessage('',-1) end end



function darkgreentheme()

    imgui.SwitchContext()

    local style = imgui.GetStyle()

    local colors = style.Colors

    local clr = imgui.Col

    local ImVec4 = imgui.ImVec4

    style.WindowPadding = imgui.ImVec2(8, 8)

    style.WindowRounding = 6

    style.ChildWindowRounding = 5

    style.FramePadding = imgui.ImVec2(5, 3)

    style.FrameRounding = 3.0

    style.ItemSpacing = imgui.ImVec2(5, 4)

    style.ItemInnerSpacing = imgui.ImVec2(4, 4)

    style.IndentSpacing = 21

    style.ScrollbarSize = 10.0

    style.ScrollbarRounding = 13

    style.GrabMinSize = 8

    style.GrabRounding = 1

    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)

    style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)

    colors[clr.Text]                   = ImVec4(0.90, 0.90, 0.90, 1.00)

    colors[clr.TextDisabled]           = ImVec4(0.60, 0.60, 0.60, 1.00)

    colors[clr.WindowBg]               = ImVec4(0.08, 0.08, 0.08, 1.00)

    colors[clr.ChildWindowBg]          = ImVec4(0.10, 0.10, 0.10, 1.00)

    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 1.00)

    colors[clr.Border]                 = ImVec4(0.70, 0.70, 0.70, 0.40)

    colors[clr.BorderShadow]           = ImVec4(0.00, 0.00, 0.00, 0.00)

    colors[clr.FrameBg]                = ImVec4(0.15, 0.15, 0.15, 1.00)

    colors[clr.FrameBgHovered]         = ImVec4(0.19, 0.19, 0.19, 0.71)

    colors[clr.FrameBgActive]          = ImVec4(0.34, 0.34, 0.34, 0.79)

    colors[clr.TitleBg]                = ImVec4(0.00, 0.69, 0.33, 0.80)

    colors[clr.TitleBgActive]          = ImVec4(0.00, 0.74, 0.36, 1.00)

    colors[clr.TitleBgCollapsed]       = ImVec4(0.00, 0.69, 0.33, 0.50)

    colors[clr.MenuBarBg]              = ImVec4(0.00, 0.80, 0.38, 1.00)

    colors[clr.ScrollbarBg]            = ImVec4(0.16, 0.16, 0.16, 1.00)

    colors[clr.ScrollbarGrab]          = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.ScrollbarGrabHovered]   = ImVec4(0.00, 0.82, 0.39, 1.00)

    colors[clr.ScrollbarGrabActive]    = ImVec4(0.00, 1.00, 0.48, 1.00)

    colors[clr.ComboBg]                = ImVec4(0.20, 0.20, 0.20, 0.99)

    colors[clr.CheckMark]              = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.SliderGrab]             = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.SliderGrabActive]       = ImVec4(0.00, 0.77, 0.37, 1.00)

    colors[clr.Button]                 = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.ButtonHovered]          = ImVec4(0.00, 0.82, 0.39, 1.00)

    colors[clr.ButtonActive]           = ImVec4(0.00, 0.87, 0.42, 1.00)

    colors[clr.Header]                 = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.HeaderHovered]          = ImVec4(0.00, 0.76, 0.37, 0.57)

    colors[clr.HeaderActive]           = ImVec4(0.00, 0.88, 0.42, 0.89)

    colors[clr.Separator]              = ImVec4(1.00, 1.00, 1.00, 0.40)

    colors[clr.SeparatorHovered]       = ImVec4(1.00, 1.00, 1.00, 0.60)

    colors[clr.SeparatorActive]        = ImVec4(1.00, 1.00, 1.00, 0.80)

    colors[clr.ResizeGrip]             = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.ResizeGripHovered]      = ImVec4(0.00, 0.76, 0.37, 1.00)

    colors[clr.ResizeGripActive]       = ImVec4(0.00, 0.86, 0.41, 1.00)

    colors[clr.CloseButton]            = ImVec4(0.00, 0.82, 0.39, 1.00)

    colors[clr.CloseButtonHovered]     = ImVec4(0.00, 0.88, 0.42, 1.00)

    colors[clr.CloseButtonActive]      = ImVec4(0.00, 1.00, 0.48, 1.00)

    colors[clr.PlotLines]              = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.PlotLinesHovered]       = ImVec4(0.00, 0.74, 0.36, 1.00)

    colors[clr.PlotHistogram]          = ImVec4(0.00, 0.69, 0.33, 1.00)

    colors[clr.PlotHistogramHovered]   = ImVec4(0.00, 0.80, 0.38, 1.00)

    colors[clr.TextSelectedBg]         = ImVec4(0.00, 0.69, 0.33, 0.72)

    colors[clr.ModalWindowDarkening]   = ImVec4(0.17, 0.17, 0.17, 0.48)

end

darkgreentheme()

еще бы хотел добавить /phone на P С возможностью сменить кнопку