Исправьте скрипт плиз, у меня краш в строке с вызовом thread

Malenko

Новичок
Автор темы
18
3
Версия MoonLoader
.026-beta
samp:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
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}"

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

    sampRegisterChatCommand("normal", cmd_normal)

    sampRegisterChatCommand('optimal', cmd_optimal)

    if label == 1 then
        sampAddChatMessage(tag .. " text", 0xFFFF00)
    else
        sampAddChatMessage(tag .. " text", 0xFFFFFF)
    end

    while true do
        wait(0)

    end
end

function cmd_normal(arg)
    sampAddChatMessage("text", main_color)
end
function cmd_optimal(arg)
    var1, var2 = string.match(arg, '(.+) (.+)')
    if var1 == nil or var1 == '' then
        sampAddChatMessage('Неплохо, у вас уже 2 аргумента, но вы их не ввели :(', 0xFFFFFF)
    else
        sampAddChatMessage('Вы ввели команду и 2 аргумента. 1ый: '  .. var1 .. ', 2-ой: '  .. var2 , 0xFFFFFF)
    end
end
local imgui = require('imgui')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
       
local window = imgui.ImBool(false)
       
function main1()
    while not isSampAvailable() do wait(200) end
    imgui.Process = true
    window.v = true  --show window on start
    while true do
        wait(0)
        imgui.Process = window.v
    end
end
       
function imgui.OnDrawFrame()
    if window.v then
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 300, 300 -- WINDOW SIZE
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Autosobeska', window)
        imgui.Text('Fartumasti')
        imgui.End()
    end
end

samp:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
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}"

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

    sampRegisterChatCommand("normal", cmd_normal)

    sampRegisterChatCommand('optimal', cmd_optimal)

    if label == 1 then
        sampAddChatMessage(tag .. " text", 0xFFFF00)
    else
        sampAddChatMessage(tag .. " text", 0xFFFFFF)
    end

    while true do
        wait(0)

    end
end

function cmd_normal(arg)
    sampAddChatMessage("text", main_color)
end
function cmd_optimal(arg)
    var1, var2 = string.match(arg, '(.+) (.+)')
    if var1 == nil or var1 == '' then
        sampAddChatMessage('Неплохо, у вас уже 2 аргумента, но вы их не ввели :(', 0xFFFFFF)
    else
        sampAddChatMessage('Вы ввели команду и 2 аргумента. 1ый: '  .. var1 .. ', 2-ой: '  .. var2 , 0xFFFFFF)
    end
end
local imgui = require('imgui')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
      
local window = imgui.ImBool(false)
      
function main1()
    while not isSampAvailable() do wait(200) end
    imgui.Process = true
    window.v = true  --show window on start
    while true do
        wait(0)
        imgui.Process = window.v
    end
end
      
function imgui.OnDrawFrame()
    if window.v then
        local resX, resY = getScreenResolution()
        local sizeX, sizeY = 300, 300 -- WINDOW SIZE
        imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
        imgui.Begin('Autosobeska', window)
        imgui.Text('Fartumasti')
        imgui.End()
    end
end
Я не тот скинул
 
Последнее редактирование: