Скрипт крашится. именно при активации самп вылетает

BUGIUA

Известный
Автор темы
55
5
Версия MoonLoader
.026-beta
Код:
local imgui = require 'imgui'
local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(512)
local encoding = require'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end while not isSampAvailable() do wait(100) end
    sampAddChatMessage("{8E7CC3}[SCOREBOARDL]{FFFFFF}:{D5A6BD}Загружен!Приятного использование!", -1)
    sampAddChatMessage('{8E7CC3}[SCOREBOARDL]{FFFFFF}:{D5A6BD}Команда для активации: {FF9900}/sl', -1)
    wait(0)
    sampRegisterChatCommand('sl', sl)
    imgui.Process = false

    while true do
        wait(0)

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

function sl()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end



function imgui.OnDrawFrame()
imgui.Begin(u8'Окно старшего состава', main_window_state)
imgui.Text(u8'Состав')
if imgui.Button(u8'Поиск') then
    sampAddChatMessage('Horosh', -1)
imgui.End()
end
end