крашит при нажатии кнопки

Malenko

Новичок
Автор темы
18
3
Версия MoonLoader
.026-beta
script_name('AutoSobeska')
script_author('Artemka C Hruchevki <3')
script_description('Скрипт от пионера, пионеру. Для деланья собесок всяких.')
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
local sampev = require 'lib.samp.events'
local encoding = require "encoding"
encoding.default = 'CP1251'
u8 = encoding.UTF8
local tag = "[AutoSobeska]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local gov_time = 0
local real_time = 0
local govka = 0

local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(5)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('autosobes', cmd_imgui)
sampRegisterChatCommand('timesk', cmd_timesk)
imgui.Process = false
while true do
wait(0)
if main_window_state.v == false then
imgui.Process = false
end
end
end
function cmd_imgui(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
imgui.Begin("AutoSobeska", main_window_state)
imgui.InputText(u8'Тут час и минута говки в таком формате: 2359', text_buffer)
imgui.Text(text_buffer.v)
if imgui.Button(u8"Забить говку") then
--gov_hour = string.sub(text_buffer.v, 1, 2)
--gov_minute = string.sub(text_buffer.v, 3, 4)
gov_time = text_buffer.v
real_time = os.date("%H%M")
while real_time < gov_time do
if real_time == gov_time then
sampAddChatMessage('тутуту', -1)
end
end
end
imgui.End()
end
function cmd_timesk()
sampAddChatMessage(os.date("%H"), -1)
end


Меня крашит, скорее всего из за цикла, помогите плз.
 
  • Bug
Реакции: Vespan

Malenko

Новичок
Автор темы
18
3
Ты кодом или файлом скинь, бошка аж заболела
Lua:
script_name('AutoSobeska')
script_author('Artemka C Hruchevki <3')
script_description('Скрипт от пионера, пионеру. Для деланья собесок всяких.')

require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
local sampev = require 'lib.samp.events'
local encoding = require "encoding"
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[AutoSobeska]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local gov_time = 0
local real_time = 0
local govka = 0


local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(5)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('autosobes', cmd_imgui)
    sampRegisterChatCommand('timesk', cmd_timesk)

    imgui.Process = false

    while true do
        wait(0)
        if main_window_state.v == false then
            imgui.Process = false
        end
    end
end

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

function imgui.OnDrawFrame()
    imgui.Begin("AutoSobeska", main_window_state)
    imgui.InputText(u8'Тут час и минута говки в таком формате: 2359', text_buffer)
    imgui.Text(text_buffer.v)
    if imgui.Button(u8"Забить говку") then
        --gov_hour = string.sub(text_buffer.v, 1, 2)
        --gov_minute = string.sub(text_buffer.v, 3, 4)
        gov_time = text_buffer.v
        real_time = os.date("%H%M")
        while real_time < gov_time do
            if real_time == gov_time then
                sampAddChatMessage('тутуту', -1)
            end
        end
    end
    imgui.End()
end
function cmd_timesk()
    sampAddChatMessage(os.date("%H"), -1)
end
 

Vespan

loneliness
Проверенный
2,105
1,639
Lua:
script_name('AutoSobeska')
script_author('Artemka C Hruchevki <3')
script_description('Скрипт от пионера, пионеру. Для деланья собесок всяких.')

require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
local sampev = require 'lib.samp.events'
local encoding = require "encoding"
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[AutoSobeska]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local gov_time = 0
local real_time = 0
local govka = 0


local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(5)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    sampRegisterChatCommand('autosobes', cmd_imgui)
    sampRegisterChatCommand('timesk', cmd_timesk)

    imgui.Process = false

    while true do
        wait(0)
        if main_window_state.v == false then
            imgui.Process = false
        end
    end
end

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

function imgui.OnDrawFrame()
    imgui.Begin("AutoSobeska", main_window_state)
    imgui.InputText(u8'Тут час и минута говки в таком формате: 2359', text_buffer)
    imgui.Text(text_buffer.v)
    if imgui.Button(u8"Забить говку") then
        --gov_hour = string.sub(text_buffer.v, 1, 2)
        --gov_minute = string.sub(text_buffer.v, 3, 4)
        gov_time = text_buffer.v
        real_time = os.date("%H%M")
        while real_time < gov_time do
            if real_time == gov_time then
                sampAddChatMessage('тутуту', -1)
            end
        end
    end
    imgui.End()
end
function cmd_timesk()
    sampAddChatMessage(os.date("%H"), -1)
end
я надеюсь ты это для себя делаешь

циклы,wait() вне main() - https://wiki.blast.hk/ru/moonloader/lua/lua_thread