помогите со скриптом

qqware

Участник
Автор темы
44
2
Версия SA-MP
  1. Другая
[error] [lua inv.lua] ./lua inv.lua:88: attempt to index global 'clr' (a nil value)
stack traceback:
./lua inv.lua:88: in function 'Theme'
./lua inv.lua:130: in function 'cb'
./lib/mimgui/init.lua:79: in function 'InitializeRenderer'
./lib/mimgui/init.lua:87: in function <./lib/mimgui/init.lua:84>
помогите пж я новичок пишу скрипты на телефоне

lua:
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local WinState = imgui.new.bool()

local tab = 1

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(800, 650), imgui.Cond.Always)
    imgui.Begin(u8'qqw & Lan', WinState, imgui.WindowFlags.NoResize)
    for numberTab,nameTab in pairs({'Персонаж','Машина','Авторы'}) do
        if imgui.Button(u8(nameTab), imgui.ImVec2(200,180)) then
            tab = numberTab
        end
    end
    imgui.SetCursorPos(imgui.ImVec2(210, 40))
    if imgui.BeginChild('Name##'..tab, imgui.ImVec2(600, 580), true) then
        if tab == 1 then
            imgui.Text(u8'Инвиз с ног.')
            if imgui.Button(u8'Кнопка 1') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 2') then
                sampAddChatMessage('Успешно!', -1)
            end
            if imgui.Button(u8'Кнопка 3') then
                sampAddChatMessage('Успешно!', -1)
            end
            if imgui.Button(u8'Кнопка 4') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 5') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 6') then
                sampAddChatMessage('Успешно! ', -1)
            end
        elseif tab == 2 then
            imgui.Text(u8'Инвиз в машине')
            if imgui.Button(u8'Кнопка 1') then
                sampAddChatMessage('Успешно!  ', -1)
            end
            if imgui.Button(u8'Кнопка 2') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 3') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 4') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 5') then
                sampAddChatMessage('Успешно!  ', -1)
            end
            if imgui.Button(u8'Кнопка 6') then
                sampAddChatMessage('Успешно! ', -1)
            end
        elseif tab == 3 then
            imgui.Text(u8'menu -> qqw')
            imgui.Text(u8'script -> lan')
            if imgui.Button(u8'наши тг') then
                sampAddChatMessage('tg -  qqw  tg - Lan '..tab, -1)
            end
        end
        imgui.EndChild()
    end
    imgui.End()
end)

-- раздал опиума
function imgui.Theme()
  imgui.SwitchContext()
  style = imgui.GetStyle()
 
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.FrameRounding = 3
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0
    style.WindowPadding = imgui.ImVec2(4.0, 4.0)
    style.FramePadding = imgui.ImVec2(3.5, 3.5)
    style.ButtonTextAlign = imgui.ImVec2(0.0, 0.5)
    colors[clr.WindowBg]              = ImVec4(0.14, 0.12, 0.16, 1.00);
    colors[clr.ChildWindowBg]         = ImVec4(0.30, 0.20, 0.39, 0.00);
    colors[clr.PopupBg]               = ImVec4(0.05, 0.05, 0.10, 0.90);
    colors[clr.Border]                = ImVec4(0.89, 0.85, 0.92, 0.30);
    colors[clr.BorderShadow]          = ImVec4(0.00, 0.00, 0.00, 0.00);
    colors[clr.FrameBg]               = ImVec4(0.30, 0.20, 0.39, 1.00);
    colors[clr.FrameBgHovered]        = ImVec4(0.41, 0.19, 0.63, 0.68);
    colors[clr.FrameBgActive]         = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.TitleBg]               = ImVec4(0.41, 0.19, 0.63, 0.45);
    colors[clr.TitleBgCollapsed]      = ImVec4(0.41, 0.19, 0.63, 0.35);
    colors[clr.TitleBgActive]         = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.MenuBarBg]             = ImVec4(0.30, 0.20, 0.39, 0.57);
    colors[clr.ScrollbarBg]           = ImVec4(0.30, 0.20, 0.39, 1.00);
    colors[clr.ScrollbarGrab]         = ImVec4(0.41, 0.19, 0.63, 0.31);
    colors[clr.ScrollbarGrabHovered]  = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.ScrollbarGrabActive]   = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.ComboBg]               = ImVec4(0.30, 0.20, 0.39, 1.00);
    colors[clr.CheckMark]             = ImVec4(0.56, 0.61, 1.00, 1.00);
    colors[clr.SliderGrab]            = ImVec4(0.41, 0.19, 0.63, 0.24);
    colors[clr.SliderGrabActive]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.Button]                = ImVec4(0.41, 0.19, 0.63, 0.44);
    colors[clr.ButtonHovered]         = ImVec4(0.41, 0.19, 0.63, 0.86);
    colors[clr.ButtonActive]          = ImVec4(0.64, 0.33, 0.94, 1.00);
    colors[clr.Header]                = ImVec4(0.41, 0.19, 0.63, 0.76);
    colors[clr.HeaderHovered]         = ImVec4(0.41, 0.19, 0.63, 0.86);
    colors[clr.HeaderActive]          = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.ResizeGrip]            = ImVec4(0.41, 0.19, 0.63, 0.20);
    colors[clr.ResizeGripHovered]     = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.ResizeGripActive]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.CloseButton]           = ImVec4(1.00, 1.00, 1.00, 0.75);
    colors[clr.CloseButtonHovered]    = ImVec4(0.88, 0.74, 1.00, 0.59);
    colors[clr.CloseButtonActive]     = ImVec4(0.88, 0.85, 0.92, 1.00);
    colors[clr.PlotLines]             = ImVec4(0.89, 0.85, 0.92, 0.63);
    colors[clr.PlotLinesHovered]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.PlotHistogram]         = ImVec4(0.89, 0.85, 0.92, 0.63);
    colors[clr.PlotHistogramHovered]  = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.TextSelectedBg]        = ImVec4(0.41, 0.19, 0.63, 0.43);
    colors[clr.ModalWindowDarkening]  = ImVec4(0.20, 0.20, 0.20, 0.35);

end

imgui.OnInitialize(function()
  imgui.Theme()
end)

function main()
    sampRegisterChatCommand('offset',function() WinState[0] = not WinState[0] end)
    wait(-1)
end
 

chromiusj

R&B-baby-queen
Модератор
5,589
3,893
1697311734445.png
 

chromiusj

R&B-baby-queen
Модератор
5,589
3,893
а дургие ошибки как
скорее всего это вытекающие из основной ошибки,либо ты используешь тему imgui,а не mimgui
Lua:
-- попробуй эту тему
function red_theme()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    local colors = style.Colors
    local clr = imgui.Col
    local ImVec4 = imgui.ImVec4

    imgui.GetStyle().WindowPadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().FramePadding = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemSpacing = imgui.ImVec2(5, 5)
    imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(2, 2)
    imgui.GetStyle().TouchExtraPadding = imgui.ImVec2(0, 0)
    imgui.GetStyle().IndentSpacing = 0
    imgui.GetStyle().ScrollbarSize = 10
    imgui.GetStyle().GrabMinSize = 10

    --==[ BORDER ]==--
    imgui.GetStyle().WindowBorderSize = 1
    imgui.GetStyle().ChildBorderSize = 1
    imgui.GetStyle().PopupBorderSize = 1
    imgui.GetStyle().FrameBorderSize = 1
    imgui.GetStyle().TabBorderSize = 1

    --==[ ROUNDING ]==--
    imgui.GetStyle().WindowRounding = 8
    imgui.GetStyle().ChildRounding = 8
    imgui.GetStyle().FrameRounding = 8
    imgui.GetStyle().PopupRounding = 8
    imgui.GetStyle().ScrollbarRounding = 8
    imgui.GetStyle().GrabRounding = 8
    imgui.GetStyle().TabRounding = 8

    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.ChildBg]          = ImVec4(1.00, 1.00, 1.00, 0.00)
    colors[clr.PopupBg]                = ImVec4(0.08, 0.08, 0.08, 0.94)
    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.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)
end
 

qqware

Участник
Автор темы
44
2
убери imgui в названии функции


А, бля. Скинь вообще код свой
error] [lua inv.lua] ./lua inv.lua:123: attempt to call global 'Theme' (a nil value)
stack traceback:
./lua inv.lua:123: in function 'cb'
./lib/mimgui/init.lua:79: in function 'InitializeRenderer'
./lib/mimgui/init.lua:87: in function <./lib/mimgui/init.lua:84>

error] [lua inv.lua] ./lua inv.lua:123: attempt to call global 'Theme' (a nil value)
stack traceback:
./lua inv.lua:123: in function 'cb'
./lib/mimgui/init.lua:79: in function 'InitializeRenderer'
./lib/mimgui/init.lua:87: in function <./lib/mimgui/init.lua:84>
не убралось
 

qqware

Участник
Автор темы
44
2
я уже писал, скинь код
lua:
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local WinState = imgui.new.bool()

local tab = 1

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(800, 650), imgui.Cond.Always)
    imgui.Begin(u8'qqw & Lan', WinState, imgui.WindowFlags.NoResize)
    for numberTab,nameTab in pairs({'Персонаж','Машина','Авторы'}) do
        if imgui.Button(u8(nameTab), imgui.ImVec2(200,180)) then
            tab = numberTab
        end
    end
    imgui.SetCursorPos(imgui.ImVec2(210, 40))
    if imgui.BeginChild('Name##'..tab, imgui.ImVec2(600, 580), true) then
        if tab == 1 then
            imgui.Text(u8'Инвиз с ног.')
            if imgui.Button(u8'Кнопка 1') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 2') then
                sampAddChatMessage('Успешно!', -1)
            end
            if imgui.Button(u8'Кнопка 3') then
                sampAddChatMessage('Успешно!', -1)
            end
            if imgui.Button(u8'Кнопка 4') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 5') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 6') then
                sampAddChatMessage('Успешно! ', -1)
            end
        elseif tab == 2 then
            imgui.Text(u8'Инвиз в машине')
            if imgui.Button(u8'Кнопка 1') then
                sampAddChatMessage('Успешно!  ', -1)
            end
            if imgui.Button(u8'Кнопка 2') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 3') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 4') then
                sampAddChatMessage('Успешно! ', -1)
            end
            if imgui.Button(u8'Кнопка 5') then
                sampAddChatMessage('Успешно!  ', -1)
            end
            if imgui.Button(u8'Кнопка 6') then
                sampAddChatMessage('Успешно! ', -1)
            end
        elseif tab == 3 then
            imgui.Text(u8'menu -> qqw')
            imgui.Text(u8'script -> lan')
            if imgui.Button(u8'наши тг') then
                sampAddChatMessage('tg -  qqw  tg - Lan '..tab, -1)
            end
        end
        imgui.EndChild()
    end
    imgui.End()
end)

-- раздал опиума
function imgui.Theme()
  imgui.SwitchContext()
  style = imgui.GetStyle()
 
    style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
    style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
    style.ScrollbarSize = 13.0
    style.ScrollbarRounding = 0
    style.GrabMinSize = 8.0
    style.GrabRounding = 1.0
    style.WindowPadding = imgui.ImVec2(4.0, 4.0)
    style.FramePadding = imgui.ImVec2(3.5, 3.5)
    style.ButtonTextAlign = imgui.ImVec2(0.0, 0.5)
    colors[clr.WindowBg]              = ImVec4(0.14, 0.12, 0.16, 1.00);
    colors[clr.ChildBg]         = ImVec4(0.30, 0.20, 0.39, 0.00);
    colors[clr.PopupBg]               = ImVec4(0.05, 0.05, 0.10, 0.90);
    colors[clr.Border]                = ImVec4(0.89, 0.85, 0.92, 0.30);
    colors[clr.BorderShadow]          = ImVec4(0.00, 0.00, 0.00, 0.00);
    colors[clr.FrameBg]               = ImVec4(0.30, 0.20, 0.39, 1.00);
    colors[clr.FrameBgHovered]        = ImVec4(0.41, 0.19, 0.63, 0.68);
    colors[clr.FrameBgActive]         = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.TitleBg]               = ImVec4(0.41, 0.19, 0.63, 0.45);
    colors[clr.TitleBgCollapsed]      = ImVec4(0.41, 0.19, 0.63, 0.35);
    colors[clr.TitleBgActive]         = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.MenuBarBg]             = ImVec4(0.30, 0.20, 0.39, 0.57);
    colors[clr.ScrollbarBg]           = ImVec4(0.30, 0.20, 0.39, 1.00);
    colors[clr.ScrollbarGrab]         = ImVec4(0.41, 0.19, 0.63, 0.31);
    colors[clr.ScrollbarGrabHovered]  = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.ScrollbarGrabActive]   = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.CheckMark]             = ImVec4(0.56, 0.61, 1.00, 1.00);
    colors[clr.SliderGrab]            = ImVec4(0.41, 0.19, 0.63, 0.24);
    colors[clr.SliderGrabActive]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.Button]                = ImVec4(0.41, 0.19, 0.63, 0.44);
    colors[clr.ButtonHovered]         = ImVec4(0.41, 0.19, 0.63, 0.86);
    colors[clr.ButtonActive]          = ImVec4(0.64, 0.33, 0.94, 1.00);
    colors[clr.Header]                = ImVec4(0.41, 0.19, 0.63, 0.76);
    colors[clr.HeaderHovered]         = ImVec4(0.41, 0.19, 0.63, 0.86);
    colors[clr.HeaderActive]          = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.ResizeGrip]            = ImVec4(0.41, 0.19, 0.63, 0.20);
    colors[clr.ResizeGripHovered]     = ImVec4(0.41, 0.19, 0.63, 0.78);
    colors[clr.ResizeGripActive]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.PlotLines]             = ImVec4(0.89, 0.85, 0.92, 0.63);
    colors[clr.PlotLinesHovered]      = ImVec4(0.41, 0.19, 0.63, 1.00);
    colors[clr.PlotHistogram]         = ImVec4(0.89, 0.85, 0.92, 0.63);
    colors[clr.PlotHistogramHovered]  = ImVec4(0.41, 0.19, 0.63, 1.00);

end

imgui.OnInitialize(function()
Theme()
end)

function main()
    sampRegisterChatCommand('offset',function() WinState[0] = not WinState[0] end)
    wait(-1)
end
 

qqware

Участник
Автор темы
44
2
Сука... Функцию ты должен вызывать именно с таким названием, с каким ты её создал. Там может быть хоть ХуйСобаки(), что угодно.
Lua:
function zalupaOsla()
    -- code
end

imgui.OnInitialize(function()
    zalupaOsla()
end)
это я понял а что с этим делать [error] [lua inv.lua] ./lua inv.lua:88: attempt to index global 'clr' (a nil value)
stack traceback:
./lua inv.lua:88: in function 'Theme'
./lua inv.lua:124: in function 'cb'
./lib/mimgui/init.lua:79: in function 'InitializeRenderer'
./lib/mimgui/init.lua:87: in function <./lib/mimgui/init.lua:84>