помощь по imgui

Require

Участник
Автор темы
49
1
Версия MoonLoader
.026-beta
почему когда пытаюсь выводить меню ничего не происходит?
вот код:
Lua:
script_name('Function Compilation')
script_author('Hydra Reaper')
script_description('Function Compilation')
require 'lib.sampfuncs'
require 'lib.moonloader'
local sampev = require 'lib.samp.events'
local imgui = require 'imgui'

local fixInteriorEntry = false
local antiRagdoll = false
local autoDoorOpen = false
local timeValue = 12 -- значение времени (0-23)
local weatherValue = 1 -- значение погоды (1-12)
local prefix = "[Function Compilation]: "
local main_window_state = {v = false}
local highSpeedThreshold = 30 -- Пороговое значение для определения очень высокой скорости
local maxAllowedSpeed = 20 -- Максимальная разрешенная скорость
local ffi = require 'ffi'
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local new, str = imgui.new, ffi.string

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand("st", function(arg)
        local newTime = tonumber(arg)
        if newTime then
            setTime(newTime, 0) -- Устанавливаем новое время
        else
            sampAddChatMessage("Использование: /st [время 0-23]", 0xFFFFFFFF)
        end
    end)

    sampRegisterChatCommand("sw", function(arg)
        local newWeather = tonumber(arg)
        if newWeather then
            setWeather(newWeather) -- Устанавливаем новую погоду
        else
            sampAddChatMessage("Использование: /sw [погода 1-12]", 0xFFFFFFFF)
        end
    end)

    sampRegisterChatCommand("func", function(arg)
        main_window_state.v = not main_window_state.v
        imgui.Process = main_window_state.v
    end)

    sampAddChatMessage(prefix.. 'Script created by {8b00ff}Hydra Reaper', 0xffffff)
end

function onDrawImGui()
    if imgui.Begin("Настройки") then
        if imgui.Checkbox("Фикс входа в интерьер", fixInteriorEntry) then
            fixInteriorEntry = not fixInteriorEntry
        end
        if imgui.Checkbox("Антирванка", antiRagdoll) then
            handleAntiRagdollCheckboxChange() -- вызов функции при изменении состояния чекбокса
        end
        if imgui.Checkbox("Авто открытие дверей", autoDoorOpen) then
            autoDoorOpen = not autoDoorOpen
        end
        if imgui.CollapsingHeader("Помощь") then
            imgui.Text("Список доступных команд:")
            imgui.BulletText("/st [время] - установить время")
            imgui.BulletText("/sw [погода] - установить погоду")
        end
    end
    imgui.End()
end
 

Дядя Энрик.

Активный
319
75
Lua:
local WinState = imgui.new.bool()
imgui.OnFrame(function() return WinState[0] end, function()
    imgui.Begin(' ', WinState)
    imgui.End()
end)
sampRegisterChatCommand('test', WinState[0] = not WinState[0])
подключил мимгуи, но делаешь код для имгуи.

ааа.. у тебя шакал код вообще какой-то, имгуи + мимгуи сразу, мимгуи оставь и всё
 

Masayuki

Участник
21
6
Lua:
script_name('Function Compilation')
script_author('Hydra Reaper')
script_description('Function Compilation')

require 'lib.sampfuncs'
local sampev = require 'lib.samp.events'
local ffi = require 'ffi'
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local main_window_state = imgui.new.bool()
local fixInteriorEntry = imgui.new.bool()
local antiRagdoll = imgui.new.bool()
local autoDoorOpen = imgui.new.bool()

local timeValue = 12 -- значение времени (0-23)
local weatherValue = 1 -- значение погоды (1-12)
local prefix = "[Function Compilation]: "
local highSpeedThreshold = 30 -- Пороговое значение для определения очень высокой скорости
local maxAllowedSpeed = 20 -- Максимальная разрешенная скорость

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(prefix.. 'Script created by {8b00ff}Hydra Reaper', 0xffffff)
    sampRegisterChatCommand("st", function(arg)
        if tonumber(arg) then
            setTime(arg)
        else
            sampAddChatMessage("Использование: /st [время 0-23]", 0xFFFFFFFF)
        end
    end)
    sampRegisterChatCommand('sw', function(arg)
        if tonumber(arg) then
            setWeather(arg)
        else
            sampAddChatMessage("Использование: /st [время 0-23]", 0xFFFFFFFF)
        end
    end)
    
    sampRegisterChatCommand("func", function(arg)
        main_window_state[0] = not main_window_state[0]
    end) 
    wait(-1)
end

imgui.OnFrame(function() return main_window_state[0] end, function(player)
    if imgui.Begin(u8'Настройки', main_window_state) then
        imgui.Checkbox(u8'Фикс входа в интерьер', fixInteriorEntry)
        imgui.Checkbox(u8'Антирванка', antiRagdoll)
        imgui.Checkbox(u8'Авто открытие дверей', autoDoorOpen)

        if imgui.CollapsingHeader(u8'Помощь') then
            imgui.Text(u8'Список доступных команд:')
            imgui.Text(u8'/st [время] - установить время')
            imgui.Text(u8'/sw [погода] - установить погоду')
        end
    end
    imgui.End()
end)
 

Require

Участник
Автор темы
49
1
Lua:
script_name('Function Compilation')
script_author('Hydra Reaper')
script_description('Function Compilation')

require 'lib.sampfuncs'
local sampev = require 'lib.samp.events'
local ffi = require 'ffi'
local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local main_window_state = imgui.new.bool()
local fixInteriorEntry = imgui.new.bool()
local antiRagdoll = imgui.new.bool()
local autoDoorOpen = imgui.new.bool()

local timeValue = 12 -- значение времени (0-23)
local weatherValue = 1 -- значение погоды (1-12)
local prefix = "[Function Compilation]: "
local highSpeedThreshold = 30 -- Пороговое значение для определения очень высокой скорости
local maxAllowedSpeed = 20 -- Максимальная разрешенная скорость

function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(prefix.. 'Script created by {8b00ff}Hydra Reaper', 0xffffff)
    sampRegisterChatCommand("st", function(arg)
        if tonumber(arg) then
            setTime(arg)
        else
            sampAddChatMessage("Использование: /st [время 0-23]", 0xFFFFFFFF)
        end
    end)
    sampRegisterChatCommand('sw', function(arg)
        if tonumber(arg) then
            setWeather(arg)
        else
            sampAddChatMessage("Использование: /st [время 0-23]", 0xFFFFFFFF)
        end
    end)
   
    sampRegisterChatCommand("func", function(arg)
        main_window_state[0] = not main_window_state[0]
    end)
    wait(-1)
end

imgui.OnFrame(function() return main_window_state[0] end, function(player)
    if imgui.Begin(u8'Настройки', main_window_state) then
        imgui.Checkbox(u8'Фикс входа в интерьер', fixInteriorEntry)
        imgui.Checkbox(u8'Антирванка', antiRagdoll)
        imgui.Checkbox(u8'Авто открытие дверей', autoDoorOpen)

        if imgui.CollapsingHeader(u8'Помощь') then
            imgui.Text(u8'Список доступных команд:')
            imgui.Text(u8'/st [время] - установить время')
            imgui.Text(u8'/sw [погода] - установить погоду')
        end
    end
    imgui.End()
end)
спс теперь у меня каракули:)