[HELP]Ошибка в коде

Ваня К

Новичок
Автор темы
11
0
Форматирование кода

Привет, хотел добавить новый сундук в боте /rlta, не получается добавить сундук "Сундук Лос Сантоса" Кто шарит хорошо, помогите пж.

КОД:

Lua:
local use = false
local close = false
local use1 = false
local close1 = false

require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)

function main()
  while not isSampAvailable() do wait(0) end wait(1)
  sampRegisterChatCommand('rlta', rlta)
  print('{ffffff}јвтор - rlta {fff000}FooOoott')
    while true do
    wait(0)
    if checked_test.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active = true
      sampSendChat("/invent")
      wait(zadervka.v*60000)
    end
    if checked_test2.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active1 = true
      sampSendChat("/invent")
      wait(zadervka1.v*60000)
    end
    if checked_test3.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active2 = true
      sampSendChat("/invent")
      wait(zadervka2.v*60000)
    end
    if checked_test4.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active3 = true
      sampSendChat("/invent")
      wait(zadervka3.v*60000)
    end
    if checked_test5.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active4 = true
      sampSendChat("/invent")
      wait(zadervka3.v*60000)
    end
  end
end

function imgui.TextQuestion(text)
    imgui.TextDisabled(u8'(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end


function rlta(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end




function imgui.OnDrawFrame()

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

    if main_window_state.v then
    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)

  imgui.Begin(u8"—борщик рулеток", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
  imgui.Checkbox(u8'јктиваци¤', checked_test)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ обычного сундука')
  imgui.Checkbox(u8'јктиваци¤##2', checked_test2)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ донатного сундука')
  imgui.Checkbox(u8'јктиваци¤##3', checked_test3)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ платинового сундука')
  imgui.Checkbox(u8'јктиваци¤##4', checked_test4)
  imgui.SameLine()
   imgui.TextQuestion(u8'ƒл¤ тaйник лос сантоса')
  imgui.Checkbox(u8'јктиваци¤##5', checked_test5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ сундука »лона')
  imgui.SliderInt(u8'«адержка ',zadervka,5, 5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ обычного сундука')
  imgui.SliderInt(u8'«адержка##2 ',zadervka1,5, 5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ донатного сундука')
  imgui.SliderInt(u8'«адержка##3 ',zadervka2,5, 5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ платинового сундука')
  imgui.SliderInt(u8'«адержка##4 ',zadervka3,5, 5)
  imgui.SameLine()
    imgui.TextQuestion(u8'ƒл¤ тaйник лос сантоса')
  imgui.SliderInt(u8'«адержка##5 ',zadervka3,5, 5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ сундука »лона')
  if imgui.Button('BugFix') then
      sampAddChatMessage('{66ff66}Fixed. {FFB140}»спользуйте {66ff66}/rlta {FFB140}чтобы открыть окно и/или убрать курсор.', 0x66ff66)
      thisScript():reload()
  end
  imgui.End()
    end
end


function samp.onShowTextDraw(id, data)
  if checked_test.v and active then
    lua_thread.create(function()
      if data.modelId == 19918 then
        wait(111)
        sampSendClickTextdraw(id)
        use = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use = false
        close = true
      end
      if close then
        wait(111)
        sampSendClickTextdraw(65535)
        close = false
        active = false
      end
    end)
  end
  if checked_test2.v and active1 then
    lua_thread.create(function()
      if data.modelId == 19613 then
        wait(111)
        sampSendClickTextdraw(id)
        use1 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use1 = false
        close1 = true
      end
      if close1 then
        wait(111)
        sampSendClickTextdraw(65535)
        close1 = false
        active1 = false
      end
    end)
  end
  if checked_test3.v and active2 then
    lua_thread.create(function()
      if data.modelId == 1353 then
        wait(111)
        sampSendClickTextdraw(id)
        use2 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use2 = false
        close2 = true
      end
      if close2 then
        wait(111)
        sampSendClickTextdraw(65535)
        close2 = false
        active2 = false
      end
    end)
  end
  if checked_test4.v and active3 then
    lua_thread.create(function()
      if data.modelId == 1733 then
        wait(111)
        sampSendClickTextdraw(id)
        use3 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use3 = false
        close3 = true
      end
      if close3 then
        wait(111)
        sampSendClickTextdraw(65535)
        close3 = false
        active3 = false
      end
    end)
  end
  if checked_test5.v and active3 then
    lua_thread.create(function()
      if data.modelId == 1733 then
        wait(111)
        sampSendClickTextdraw(id)
        use3 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use3 = false
        close3 = true
      end
      if close3 then
        wait(111)
        sampSendClickTextdraw(65535)
        close3 = false
        active3 = false
      end
    end)
  end
end

function apply_custom_style()
    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
apply_custom_style()

 
Последнее редактирование модератором:
  • Bug
Реакции: qdIbp

qdIbp

Автор темы
Проверенный
1,387
1,139
Во первых
Снимок экрана (541).png

Не то запарился с табуляцией

Во вторых нах использовать
Lua:
lua_thread.create(function()
    --хрень
end)
по 100 раз подряд, если можно в начало функции засунуть и в конце end) поставить


В третьих
Lua:
require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8

local use = false
local cl = false
local use1 = false
local close1 = false

local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local checked_test5 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)
local zadervka4 = imgui.ImInt(1)

function main()
    while not isSampAvailable() do wait(0) end wait(1)
        sampRegisterChatCommand('rlta', function() main_window_state.v = not main_window_state.v print(main_window_state.v and 'Вкл' or 'Выкл') end)
        print('{ffffff}Автор - rlta {fff000}FooOoott')
    while true do wait(0)
        imgui.Process = main_window_state.v
        if checked_test.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active = true
            sampSendChat("/invent")
            wait(zadervka.v*60000)
        end
        if checked_test2.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active1 = true
            sampSendChat("/invent")
            wait(zadervka1.v*60000)
        end
        if checked_test3.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active2 = true
            sampSendChat("/invent")
            wait(zadervka2.v*60000)
        end
        if checked_test4.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active3 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
        if checked_test5.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active4 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
    end
end

function imgui.TextQuestion(text)
    imgui.TextDisabled(u8'(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Сборщик рулеток", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
            imgui.Checkbox(u8'Активация', checked_test)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.Checkbox(u8'Активация##2', checked_test2)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.Checkbox(u8'Активация¤##3', checked_test3)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.Checkbox(u8'Активация¤##4', checked_test4)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.Checkbox(u8'Активация¤##5', checked_test5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука »лона')
            imgui.SliderInt(u8'Задержка ',zadervka,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.SliderInt(u8'Задержка##2 ',zadervka1,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.SliderInt(u8'Задержка##3 ',zadervka2,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.SliderInt(u8'Задержка##4 ',zadervka3,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.SliderInt(u8'Задержка##5 ',zadervka4,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука Слона')
            if imgui.Button('BugFix') then
                sampAddChatMessage('{66ff66}Fixed. {FFB140}Используйте {66ff66}/rlta {FFB140}чтобы открыть окно.', 0x66ff66)
                imgui.ShowCursor = false
                showCursor(false)
                thisScript():reload()
            end
        imgui.End()
    elseif not main_window_state.v then
        imgui.Process = false
    end
end

function samp.onShowTextDraw(id, data)
    lua_thread.create(function()
        if checked_test.v and active then
            if data.modelId == 19918 then
                wait(111)
                sampSendClickTextdraw(id)
                use = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use = false
                cl = true
            end
            if cl then
                wait(111)
                sampSendClickTextdraw(65535)
                cl = false
                active = false
            end
        end
        if checked_test2.v and active1 then
            if data.modelId == 19613 then
                wait(111)
                sampSendClickTextdraw(id)
                use1 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use1 = false
                close1 = true
            end
            if close1 then
                wait(111)
                sampSendClickTextdraw(65535)
                close1 = false
                active1 = false
            end
        end
        if checked_test3.v and active2 then
            if data.modelId == 1353 then
                wait(111)
                sampSendClickTextdraw(id)
                use2 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use2 = false
                close2 = true
            end
            if close2 then
                wait(111)
                sampSendClickTextdraw(65535)
                close2 = false
                active2 = false
            end
        end
        if checked_test4.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
        if checked_test5.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
    end)
end

function apply_custom_style()
    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
apply_custom_style()

Скинул бы лог ошибки, так бы еще что-нибудь сказал, а так все косяки которые увидел были исправлены
 
  • Нравится
Реакции: SomaGnoma

SomaGnoma

Известный
442
152
Во первых
Посмотреть вложение 138554
Не то запарился с табуляцией

Во вторых нах использовать
Lua:
lua_thread.create(function()
    --хрень
end)
по 100 раз подряд, если можно в начало функции засунуть и в конце end) поставить


В третьих
Lua:
require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8

local use = false
local cl = false
local use1 = false
local close1 = false

local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local checked_test5 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)
local zadervka4 = imgui.ImInt(1)

function main()
    while not isSampAvailable() do wait(0) end wait(1)
        sampRegisterChatCommand('rlta', function() main_window_state.v = not main_window_state.v print(main_window_state.v and 'Вкл' or 'Выкл') end)
        print('{ffffff}Автор - rlta {fff000}FooOoott')
    while true do wait(0)
        imgui.Process = main_window_state.v
        if checked_test.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active = true
            sampSendChat("/invent")
            wait(zadervka.v*60000)
        end
        if checked_test2.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active1 = true
            sampSendChat("/invent")
            wait(zadervka1.v*60000)
        end
        if checked_test3.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active2 = true
            sampSendChat("/invent")
            wait(zadervka2.v*60000)
        end
        if checked_test4.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active3 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
        if checked_test5.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active4 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
    end
end

function imgui.TextQuestion(text)
    imgui.TextDisabled(u8'(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Сборщик рулеток", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
            imgui.Checkbox(u8'Активация', checked_test)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.Checkbox(u8'Активация##2', checked_test2)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.Checkbox(u8'Активация¤##3', checked_test3)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.Checkbox(u8'Активация¤##4', checked_test4)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.Checkbox(u8'Активация¤##5', checked_test5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука »лона')
            imgui.SliderInt(u8'Задержка ',zadervka,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.SliderInt(u8'Задержка##2 ',zadervka1,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.SliderInt(u8'Задержка##3 ',zadervka2,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.SliderInt(u8'Задержка##4 ',zadervka3,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.SliderInt(u8'Задержка##5 ',zadervka4,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука Слона')
            if imgui.Button('BugFix') then
                sampAddChatMessage('{66ff66}Fixed. {FFB140}Используйте {66ff66}/rlta {FFB140}чтобы открыть окно.', 0x66ff66)
                imgui.ShowCursor = false
                showCursor(false)
                thisScript():reload()
            end
        imgui.End()
    elseif not main_window_state.v then
        imgui.Process = false
    end
end

function samp.onShowTextDraw(id, data)
    lua_thread.create(function()
        if checked_test.v and active then
            if data.modelId == 19918 then
                wait(111)
                sampSendClickTextdraw(id)
                use = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use = false
                cl = true
            end
            if cl then
                wait(111)
                sampSendClickTextdraw(65535)
                cl = false
                active = false
            end
        end
        if checked_test2.v and active1 then
            if data.modelId == 19613 then
                wait(111)
                sampSendClickTextdraw(id)
                use1 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use1 = false
                close1 = true
            end
            if close1 then
                wait(111)
                sampSendClickTextdraw(65535)
                close1 = false
                active1 = false
            end
        end
        if checked_test3.v and active2 then
            if data.modelId == 1353 then
                wait(111)
                sampSendClickTextdraw(id)
                use2 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use2 = false
                close2 = true
            end
            if close2 then
                wait(111)
                sampSendClickTextdraw(65535)
                close2 = false
                active2 = false
            end
        end
        if checked_test4.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
        if checked_test5.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
    end)
end

function apply_custom_style()
    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
apply_custom_style()

Скинул бы лог ошибки, так бы еще что-нибудь сказал, а так все косяки которые увидел были исправлены
Не понимаю тебя, автор темы неуважительно отнесся к пользователям форума, а ты ему готовый код пишешь и тратишь время🤨
 
  • Вау
Реакции: GeniyAss

qdIbp

Автор темы
Проверенный
1,387
1,139
Не понимаю тебя, автор темы неуважительно отнесся к пользователям форума, а ты ему готовый код пишешь и тратишь время🤨
Что взять со ♂️slave♂️
Даю ему надежду стать️♂️full master♂️
 
  • Нравится
Реакции: SomaGnoma

Ваня К

Новичок
Автор темы
11
0
Во первых
Посмотреть вложение 138554
Не то запарился с табуляцией

Во вторых нах использовать
Lua:
lua_thread.create(function()
    --хрень
end)
по 100 раз подряд, если можно в начало функции засунуть и в конце end) поставить


В третьих
Lua:
require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8

local use = false
local cl = false
local use1 = false
local close1 = false

local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local checked_test5 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)
local zadervka4 = imgui.ImInt(1)

function main()
    while not isSampAvailable() do wait(0) end wait(1)
        sampRegisterChatCommand('rlta', function() main_window_state.v = not main_window_state.v print(main_window_state.v and 'Вкл' or 'Выкл') end)
        print('{ffffff}Автор - rlta {fff000}FooOoott')
    while true do wait(0)
        imgui.Process = main_window_state.v
        if checked_test.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active = true
            sampSendChat("/invent")
            wait(zadervka.v*60000)
        end
        if checked_test2.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active1 = true
            sampSendChat("/invent")
            wait(zadervka1.v*60000)
        end
        if checked_test3.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active2 = true
            sampSendChat("/invent")
            wait(zadervka2.v*60000)
        end
        if checked_test4.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active3 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
        if checked_test5.v then
            sampSendClickTextdraw(65535)
            wait(355)
            active4 = true
            sampSendChat("/invent")
            wait(zadervka3.v*60000)
        end
    end
end

function imgui.TextQuestion(text)
    imgui.TextDisabled(u8'(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Сборщик рулеток", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
            imgui.Checkbox(u8'Активация', checked_test)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.Checkbox(u8'Активация##2', checked_test2)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.Checkbox(u8'Активация¤##3', checked_test3)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.Checkbox(u8'Активация¤##4', checked_test4)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.Checkbox(u8'Активация¤##5', checked_test5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука »лона')
            imgui.SliderInt(u8'Задержка ',zadervka,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для обычного сундука')
            imgui.SliderInt(u8'Задержка##2 ',zadervka1,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для донатного сундука')
            imgui.SliderInt(u8'Задержка##3 ',zadervka2,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для платинового сундука')
            imgui.SliderInt(u8'Задержка##4 ',zadervka3,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для тaйник лос сантоса')
            imgui.SliderInt(u8'Задержка##5 ',zadervka4,5, 5)
                imgui.SameLine()
            imgui.TextQuestion(u8'Для сундука Слона')
            if imgui.Button('BugFix') then
                sampAddChatMessage('{66ff66}Fixed. {FFB140}Используйте {66ff66}/rlta {FFB140}чтобы открыть окно.', 0x66ff66)
                imgui.ShowCursor = false
                showCursor(false)
                thisScript():reload()
            end
        imgui.End()
    elseif not main_window_state.v then
        imgui.Process = false
    end
end

function samp.onShowTextDraw(id, data)
    lua_thread.create(function()
        if checked_test.v and active then
            if data.modelId == 19918 then
                wait(111)
                sampSendClickTextdraw(id)
                use = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use = false
                cl = true
            end
            if cl then
                wait(111)
                sampSendClickTextdraw(65535)
                cl = false
                active = false
            end
        end
        if checked_test2.v and active1 then
            if data.modelId == 19613 then
                wait(111)
                sampSendClickTextdraw(id)
                use1 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use1 = false
                close1 = true
            end
            if close1 then
                wait(111)
                sampSendClickTextdraw(65535)
                close1 = false
                active1 = false
            end
        end
        if checked_test3.v and active2 then
            if data.modelId == 1353 then
                wait(111)
                sampSendClickTextdraw(id)
                use2 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use2 = false
                close2 = true
            end
            if close2 then
                wait(111)
                sampSendClickTextdraw(65535)
                close2 = false
                active2 = false
            end
        end
        if checked_test4.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
        if checked_test5.v and active3 then
            if data.modelId == 1733 then
                wait(111)
                sampSendClickTextdraw(id)
                use3 = true
            end
            if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
                clickID = id + 1
                sampSendClickTextdraw(clickID)
                use3 = false
                close3 = true
            end
            if close3 then
                wait(111)
                sampSendClickTextdraw(65535)
                close3 = false
                active3 = false
            end
        end
    end)
end

function apply_custom_style()
    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
apply_custom_style()

Скинул бы лог ошибки, так бы еще что-нибудь сказал, а так все косяки которые увидел были исправлены
Твой тоже не робитх и больше ошибки появились. Пробуй мой код, всё норм сделал но так и не нажимает на тайник лос сантоса, когда активирую в место тайник лосантоса нажимает на илона
moonloader:
local use = false
local close = false
local use1 = false
local close1 = false

require "lib.moonloader"
local samp = require 'samp.events'
local key = require 'vkeys'
local imgui = require 'imgui'
local encoding = require("encoding")
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sw, sh = getScreenResolution()
local checked_test = imgui.ImBool(false)
local checked_test2 = imgui.ImBool(false)
local checked_test3 = imgui.ImBool(false)
local checked_test4 = imgui.ImBool(false)
local checked_test5 = imgui.ImBool(false)
local main_window_state = imgui.ImBool(false)
local zadervka = imgui.ImInt(1)
local zadervka1 = imgui.ImInt(1)
local zadervka2 = imgui.ImInt(1)
local zadervka3 = imgui.ImInt(1)
local zadervka4 = imgui.ImInt(1)
local zadervka5 = imgui.ImInt(1)


function main()
  while not isSampAvailable() do wait(0) end wait(1)
  sampRegisterChatCommand('rlta', rlta)
  print('{ffffff}јвтор - {fff000}FooOoott')
    while true do
    wait(0)
    if checked_test.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active = true
      sampSendChat("/invent")
      wait(zadervka.v*60000)
    end
    if checked_test2.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active1 = true
      sampSendChat("/invent")
      wait(zadervka1.v*60000)
    end
    if checked_test3.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active2 = true
      sampSendChat("/invent")
      wait(zadervka2.v*60000)
    end
    if checked_test4.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active3 = true
      sampSendChat("/invent")
      wait(zadervka3.v*60000)
    end
     if checked_test5.v then
      sampSendClickTextdraw(65535)
      wait(355)
      active5 = true
      sampSendChat("/invent")
      wait(zadervka5.v*60000)
    end
  end
end

function imgui.TextQuestion(text)
    imgui.TextDisabled(u8'(?)')
    if imgui.IsItemHovered() then
        imgui.BeginTooltip()
        imgui.PushTextWrapPos(450)
        imgui.TextUnformatted(text)
        imgui.PopTextWrapPos()
        imgui.EndTooltip()
    end
end


function rlta(arg)
  main_window_state.v = not main_window_state.v
  imgui.Process = main_window_state.v
end




function imgui.OnDrawFrame()

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

    if main_window_state.v then
    imgui.SetNextWindowPos(imgui.ImVec2(sw / 2 , sh / 2), imgui.Cond.FirsUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)

  imgui.Begin(u8"—борщик рулеток Arizona", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove)
  imgui.Checkbox(u8'јктиваци¤', checked_test)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ обычного сундука')
  imgui.Checkbox(u8'јктиваци¤##2', checked_test2)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ донатного сундука')
  imgui.Checkbox(u8'јктиваци¤##3', checked_test3)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ платинового сундука')
  imgui.Checkbox(u8'јктиваци¤##4', checked_test4)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ тайник лос сантоса')
  imgui.Checkbox(u8'јктиваци¤##5', checked_test5)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ сундука »лона')
  imgui.SliderInt(u8'«адержка ',zadervka,1, 30)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ обычного сундука')
  imgui.SliderInt(u8'«адержка##2 ',zadervka1,1, 30)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ донатного сундука')
  imgui.SliderInt(u8'«адержка##3 ',zadervka2,1, 30)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ платинового сундука')
  imgui.SliderInt(u8'«адержка##3 ',zadervka3,1, 30)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ тайник лос сантоса')
  imgui.SliderInt(u8'«адержка##5 ',zadervka5,1, 30)
  imgui.SameLine()
  imgui.TextQuestion(u8'ƒл¤ сундука »лона')
  if imgui.Button('BugFix') then
      sampAddChatMessage('{66ff66}Fixed. {FFB140}»спользуйте {66ff66}/rlta {FFB140}чтобы открыть окно и/или убрать курсор.', 0x66ff66)
      thisScript():reload()
  end
  imgui.End()
    end
end


function samp.onShowTextDraw(id, data)
  if checked_test.v and active then
    lua_thread.create(function()
      if data.modelId == 19918 then
        wait(111)
        sampSendClickTextdraw(id)
        use = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use = false
        close = true
      end
      if close then
        wait(111)
        sampSendClickTextdraw(65535)
        close = false
        active = false
      end
    end)
  end
  if checked_test2.v and active1 then
    lua_thread.create(function()
      if data.modelId == 19613 then
        wait(111)
        sampSendClickTextdraw(id)
        use1 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use1 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use1 = false
        close1 = true
      end
      if close1 then
        wait(111)
        sampSendClickTextdraw(65535)
        close1 = false
        active1 = false
      end
    end)
  end
  if checked_test3.v and active2 then
    lua_thread.create(function()
      if data.modelId == 1353 then
        wait(111)
        sampSendClickTextdraw(id)
        use2 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use2 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use2 = false
        close2 = true
      end
      if close2 then
        wait(111)
        sampSendClickTextdraw(65535)
        close2 = false
        active2 = false
      end
    end)
  end
  if checked_test4.v and active3 then
    lua_thread.create(function()
      if data.modelId == 1733 then
        wait(111)
        sampSendClickTextdraw(id)
        use3 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use3 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use3 = false
        close3 = true
      end
      if close3 then
        wait(111)
        sampSendClickTextdraw(65535)
        close3 = false
        active3 = false
      end
    end)
  end
   if checked_test5.v and active5 then
    lua_thread.create(function()
      if data.modelId == 65535 then
        wait(111)
        sampSendClickTextdraw(id)
        use5 = true
      end
      if data.text == 'USE' or data.text == 'ЕCМOЗТИOЛAПТ' and use5 then
        clickID = id + 1
        sampSendClickTextdraw(clickID)
        use5 = false
        close5 = true
      end
      if close5 then
        wait(111)
        sampSendClickTextdraw(65535)
        close5 = false
        active5 = false
      end
    end)
  end
end

function apply_custom_style()
    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
apply_custom_style()
 

Похожие темы

  1. Ответы
    7
    Просмотры
    2K
  2. Ответы
    33
    Просмотры
    13K
  3. D
    Ответы
    0
    Просмотры
    330
    Помощь
    deleted-user-503633
    D