краш после sampSendClickTextdraw

- |2347| -

Активный
Автор темы
217
57
Screenshot_20240428-123943_ARIZONA ONLINE.jpg


скрипт


lua:
imgui = require 'mimgui' -- подключаем библиотеку мимгуи
encoding = require 'encoding' -- подключаем библиотеку для работы с разными кодировками
encoding.default = 'CP1251' -- задаём кодировку по умолчанию
u8 = encoding.UTF8 -- это позволит нам писать задавать названия/текст на кириллице
new = imgui.new -- создаём короткий псевдоним для удобства
f = require 'moonloader'.font_flag
font = renderCreateFont('Arial', 15, f.BOLD + f.SHADOW)
ev = require 'samp.events'



local WinState = new.bool(true)
local checkbox_standart = new.bool() -- Сундук рулетки
local checkbox_donate = new.bool() -- Сундук платиновой рулетки
local checkbox_tainik = new.bool() -- Сундук рулетки (донат)
local checkbox_mask = new.bool() -- Тайник Илона Маска
local checkbox_platina = new.bool() -- Тайник Лос Сантоса
local checkbox_vice = new.bool() -- Тайник Vice City
local timechestto = new.char[256]() -- создаём буфер для инпута
local delayedtimer = new.bool()
local textdraw = {
    [1] = {_, _, 1000},
    [2] = {_, _, 1000},
    [3] = {_, _, 1000},
    [4] = {_, _, 1000},
    [5] = {_, _, 1000},
    [6] = {_, _, 1000},
}
local Chest = new.bool()
local work = false
local workbotton = new.bool()
local timertrue = false

imgui.OnFrame(function() return WinState[0] end, function(player)
    imgui.SetNextWindowPos(imgui.ImVec2(500,500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(245, 270), imgui.Cond.Always)
    imgui.Begin('##Window', WinState, imgui.WindowFlags.NoResize)
        if imgui.Checkbox(u8'Сундук рулетки', checkbox_standart) then
        
        end
        --[[if imgui.Checkbox(u8'Сундук платиновой рулетки', checkbox_platina) then
        
        end
        if imgui.Checkbox(u8'Сундук рулетки (донат)', checkbox_donate) then
        
        end
        if imgui.Checkbox(u8'Тайник Илона Маска', checkbox_mask) then
      
        end   
        if imgui.Checkbox(u8'Тайник Лос Сантоса', checkbox_tainik) then
      
        end     
        if imgui.Checkbox(u8'Тайник Vice City', checkbox_vice) then
        
        end ]]
        
        if imgui.Checkbox(u8'Запустить Сундуки###777', workbotton) then
            work = true
      
        end
        

        imgui.Separator()
        imgui.Text(u8'Запустить через:')
        imgui.SameLine()
        imgui.PushItemWidth(30)
        imgui.InputText(u8"мин##15689", timechestto, 256, imgui.InputTextFlags.CharsDecimal)
      
      
      
        imgui.PopItemWidth()
        if imgui.Checkbox(u8'Отложенный Запуск', delayedtimer) then
        end

        
      
        
    imgui.End()
end)

function main()
    while true do
        wait(0)

        if work then
            wait(200)
            sampAddChatMessage('[Сhest] {FFFFFF}Сейчас откроется инвентарь.', 0xFFFF00)
            wait(1000)
            sampSendChat('/invent')
            wait(1000)
            for i = 1, 6 do
                if not work then break end
                sampSendClickTextdraw(textdraw[i][1])
                wait(textdraw[i][3])
                sampSendClickTextdraw(textdraw[i][2])
                wait(textdraw[i][3])
                print(textdraw[i][1])
            end
            wait(100)
            sampAddChatMessage('[Сhest] {FFFFFF}Запушен таймер на 1ч.', 0xFFFF00)
            startTime = os.time() + 60 * 60 -- перезапускаем таймер
            work = false
  
            startTime = os.time() + 60 * 60 -- Устанавливаем таймер на 5 минут
            while os.time() < startTime do
                wait(0)
                local timeRemaining = startTime - os.time()
                local minutes = math.floor(timeRemaining / 60)
                local seconds = timeRemaining % 60
              
                local timeString = string.format("%02d:%02d", minutes, seconds)
                renderFontDrawText(font,'Timer '..timeString, 200, 200, 0xFF00FF00, 0x90000000)
                
            end
            work = true -- Устанавливаем флаг work в true после завершения таймера
        end
    end
end


  
   function ev.onShowTextDraw(id, data)

       if work then
           if checkbox_standart[0] and data.modelId == 19918 then textdraw[1][1] = id  end
           if checkbox_platina[0] and data.modelId == 1353 then textdraw[2][1] = id  end
           if checkbox_mask[0] and data.modelId == 1733 then textdraw[3][1] = id  end
           if checkbox_donate[0] and data.modelId == 19613 then textdraw[4][1] = id  end
           if checkbox_tainik[0] and data.modelId == 2887 then textdraw[5][1] = id  end
           if checkbox_vice[0] and data.modelId == 1333 then textdraw[6][1] = id  end
           if data.text == 'USE' or data.text == '…CЊO‡’€O‹AЏ’' then
               textdraw[1][2] = id + 1
               textdraw[2][2] = id + 1
               textdraw[3][2] = id + 1
               textdraw[4][2] = id + 1
               textdraw[5][2] = id + 1
               textdraw[6][2] = id + 1
           end
       end
    end