проблема в игмуи

Kegwineye.

Участник
Автор темы
478
20
Подскажи-ка как исправить вот это..

то что после закрытия imgui окна мышь остоёться на экране + в коде прописано типо imgui.Text("Основные функции:") и там в combo Написано на русском , в игре выдаёт символы. Перед ('Данная функция в разработке..', -1) в sampAddChatMessage ставлю u8 и ничего не меняется, так и остаються символы хоть в коде и прописано

local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
 
Последнее редактирование:

Kegwineye.

Участник
Автор темы
478
20
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[My First Script]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local menu = 1

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

local checkbox1 = imgui.ImBool(false)
local checkbox2 = imgui.ImBool(false)
local checkbox3 = imgui.ImBool(false)

local selected_item = imgui.ImInt(1)
local items = {'Начало собеседования.', 'Конец собеседования.', 'В разработке.'}


-- for combo
local combo_select = imgui.ImInt(1)
local arr_str = {"test1", "test2", "test3"}

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

sampRegisterChatCommand("mclv", cmdimgui)

handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)

imgui.Process = false

while true do
wait(0)

if checkbox1.v then
for handle, v in pairs(getAllObjects()) do
local asd
if sampGetObjectSampIdByHandle(v) ~= -1 then
asd = sampGetObjectSampIdByHandle(v)
end
if isObjectOnScreen(v) then
local result, oX, oY, oZ = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(oX,oY,oZ)
local objmodel = getObjectModel(v)
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
distance = string.format("%.0f", getDistanceBetweenCoords3d(oX,oY,oZ, x2, y2, z2))
if objmodel == 3930 then renderDrawLine(x10, y10, x1, y1, 2, 0xFFFFFF) renderFontDrawText(font,"{FFFF00}Resource:FF0000}"..distance, x1, y1, -1) end
end
end
end
end -- function
end

if main_window_state.v == false then
imgui.Process = false
end
function cmdimgui()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
if main_window_state.v then
imgui.ShowCursor = true
imgui.Begin("Helper to MCLV.", main_window_state)
imgui.BeginChild("##left", imgui.ImVec2(200, 85), true)
if imgui.Button('Menu', imgui.ImVec2(180, 20)) then menu = 1 end
if imgui.Button('Settings', imgui.ImVec2(180, 20)) then menu = 2 end
if imgui.Button('Author', imgui.ImVec2(180, 20)) then menu = 3 end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild("##right", imgui.ImVec2(400, 150), true)
if menu == 1 then
imgui.Text('Основные функции скрипта:')
imgui.Combo('Подача гос. волны.', selected_item, items, #items)
if imgui.Button('Подать гос. волну.') then
if selected_item.v == 0 then
sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
end
if selected_item.v == 1 then
sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
end
if selected_item.v == 2 then
sampAddChatMessage(u8'Данная функция в разработке..', -1)
end
end
end
if menu == 2 then
imgui.Text('Settings')
imgui.Combo("", combo_select, arr_str, #arr_str)
end
if menu == 3 then
imgui.Text('Автор скрипта - han(Handerson_Onfroy)')
end
imgui.EndChild()
imgui.End()
end
end

 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,778
11,221
сделай так, а то нихуя не понятно без табуляции
1636998781131.png
 

Kegwineye.

Участник
Автор темы
478
20
Lua:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[My First Script]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local menu = 1

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

local checkbox1 = imgui.ImBool(false)
local checkbox2 = imgui.ImBool(false)
local checkbox3 = imgui.ImBool(false)

local selected_item = imgui.ImInt(1)
local items = {'Начало собеседования.', 'Конец собеседования.', 'В разработке.'}


-- for combo
local combo_select = imgui.ImInt(1)
local arr_str = {"test1", "test2", "test3"}

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

    sampRegisterChatCommand("mclv", cmdimgui)

    handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)

    imgui.Process = false

  while true do
        wait(0)
        
        if checkbox1.v then
    for handle, v in pairs(getAllObjects()) do
                local asd
                if sampGetObjectSampIdByHandle(v) ~= -1 then
                    asd = sampGetObjectSampIdByHandle(v)
                end
                if isObjectOnScreen(v) then
                    local result, oX, oY, oZ = getObjectCoordinates(v)
                    local x1, y1 = convert3DCoordsToScreen(oX,oY,oZ)
                    local objmodel = getObjectModel(v)
                    local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
                    local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
                    distance = string.format("%.0f", getDistanceBetweenCoords3d(oX,oY,oZ, x2, y2, z2))
                    if objmodel == 3930 then renderDrawLine(x10, y10, x1, y1, 2, 0xFFFFFF) renderFontDrawText(font,"{FFFF00}Resource:FF0000}"..distance, x1, y1, -1) end
                end
            end
        end
    end  -- function
end

        if main_window_state.v == false then
        imgui.Process = false
        end
function cmdimgui()
     main_window_state.v = not main_window_state.v
     imgui.Process = main_window_state.v
 end
 
function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.ShowCursor = true
        imgui.Begin("Helper to MCLV.", main_window_state)
            imgui.BeginChild("##left", imgui.ImVec2(200, 85), true)
                if imgui.Button('Menu', imgui.ImVec2(180, 20)) then menu = 1 end
                if imgui.Button('Settings', imgui.ImVec2(180, 20)) then menu = 2 end
                if imgui.Button('Author', imgui.ImVec2(180, 20)) then menu = 3 end
            imgui.EndChild()
                imgui.SameLine()
            imgui.BeginChild("##right", imgui.ImVec2(400, 150), true)
                if menu == 1 then
                    imgui.Text('Основные функции скрипта:')
                    imgui.Combo('Подача гос. волны.', selected_item, items, #items)
                    if imgui.Button('Подать гос. волну.') then
                        if selected_item.v == 0 then
                            sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 1 then
                            sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 2 then
                            sampAddChatMessage(u8'Данная функция в разработке..', -1)
                        end
                    end
                end
                if menu == 2 then
                    imgui.Text('Settings')
                    imgui.Combo("", combo_select, arr_str, #arr_str)
                end
                if menu == 3 then
                    imgui.Text('Автор скрипта - han(Handerson_Onfroy)')
                end
            imgui.EndChild()
        imgui.End()
    end
end

сделай так, а то нихуя не понятно без табуляции
Что там, брат ?
 
Последнее редактирование:

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,778
11,221
Lua:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[My First Script]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local menu = 1

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

local checkbox1 = imgui.ImBool(false)
local checkbox2 = imgui.ImBool(false)
local checkbox3 = imgui.ImBool(false)

local selected_item = imgui.ImInt(1)
local items = {'Начало собеседования.', 'Конец собеседования.', 'В разработке.'}


-- for combo
local combo_select = imgui.ImInt(1)
local arr_str = {"test1", "test2", "test3"}

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

    sampRegisterChatCommand("mclv", cmdimgui)

    handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)

    imgui.Process = false

  while true do
        wait(0)
       
        if checkbox1.v then
    for handle, v in pairs(getAllObjects()) do
                local asd
                if sampGetObjectSampIdByHandle(v) ~= -1 then
                    asd = sampGetObjectSampIdByHandle(v)
                end
                if isObjectOnScreen(v) then
                    local result, oX, oY, oZ = getObjectCoordinates(v)
                    local x1, y1 = convert3DCoordsToScreen(oX,oY,oZ)
                    local objmodel = getObjectModel(v)
                    local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
                    local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
                    distance = string.format("%.0f", getDistanceBetweenCoords3d(oX,oY,oZ, x2, y2, z2))
                    if objmodel == 3930 then renderDrawLine(x10, y10, x1, y1, 2, 0xFFFFFF) renderFontDrawText(font,"{FFFF00}Resource:FF0000}"..distance, x1, y1, -1) end
                end
            end
        end
    end  -- function
end

        if main_window_state.v == false then
        imgui.Process = false
        end
function cmdimgui()
     main_window_state.v = not main_window_state.v
     imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
    if main_window_state.v then
        imgui.ShowCursor = true
        imgui.Begin("Helper to MCLV.", main_window_state)
            imgui.BeginChild("##left", imgui.ImVec2(200, 85), true)
                if imgui.Button('Menu', imgui.ImVec2(180, 20)) then menu = 1 end
                if imgui.Button('Settings', imgui.ImVec2(180, 20)) then menu = 2 end
                if imgui.Button('Author', imgui.ImVec2(180, 20)) then menu = 3 end
            imgui.EndChild()
                imgui.SameLine()
            imgui.BeginChild("##right", imgui.ImVec2(400, 150), true)
                if menu == 1 then
                    imgui.Text('Основные функции скрипта:')
                    imgui.Combo('Подача гос. волны.', selected_item, items, #items)
                    if imgui.Button('Подать гос. волну.') then
                        if selected_item.v == 0 then
                            sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 1 then
                            sampAddChatMessage(u8'Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 2 then
                            sampAddChatMessage(u8'Данная функция в разработке..', -1)
                        end
                    end
                end
                if menu == 2 then
                    imgui.Text('Settings')
                    imgui.Combo("", combo_select, arr_str, #arr_str)
                end
                if menu == 3 then
                    imgui.Text('Автор скрипта - han(Handerson_Onfroy)')
                end
            imgui.EndChild()
        imgui.End()
    end
end


Что там, брат ?
перед любым русским текстом в имгуи надо писать u8, например u8'Автор скрипта - han(Handerson_Onfroy)' или u8('Автор скрипта - han(Handerson_Onfroy)')
 

Kegwineye.

Участник
Автор темы
478
20
перед любым русским текстом в имгуи надо писать u8, например u8'Автор скрипта - han(Handerson_Onfroy)' или u8('Автор скрипта - han(Handerson_Onfroy)')
Я типо так и пишу мне выдает
перед любым русским текстом в имгуи надо писать u8, например u8'Автор скрипта - han(Handerson_Onfroy)' или u8('Автор скрипта - han(Handerson_Onfroy)')
encoding.lua:60: in function 'u8'
...\Winter GTA by lovec stew\moonloader\helper-for-mclv.lua:91: in function 'OnDrawFrame'

 
Последнее редактирование:

Kegwineye.

Участник
Автор темы
478
20
что ты добавил ? Расскажи. Чтоб я понял

у меня в сублиме вот как твоё ваще отображается.
local items = {u8'Íà÷àëî ñîáåñåäîâàíèÿ.', u8'Êîíåö ñîáåñåäîâàíèÿ.', u8' ðàçðàáîòêå.'}
 

(^O_O^)

Активный
114
27
Последнее редактирование:
  • Нравится
Реакции: Kegwineye.

Kegwineye.

Участник
Автор темы
478
20
Переделал свойскрипт, не открывается имгуи.



Lua:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'C1251'
u8 = encoding.UTF8

local tag = "[My First Script]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local menu = 1

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

local checkbox1 = imgui.ImBool(false)
local checkbox2 = imgui.ImBool(false)
local checkbox3 = imgui.ImBool(false)

local selected_item = imgui.ImInt(1)
local items = {'Начать собеседование.', 'Окончить собеседование.', 'В разработке...'}


-- for combo
local combo_select = imgui.ImInt(1)
local arr_str = {"test1", "test2", "test3"}

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

    sampRegisterChatCommand("helper", cmdimgui)

    handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)

    imgui.Process = false

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


        if checkbox1.v then

        end
    end  -- function
end
function cmdimgui()
     main_window_state.v = not main_window_state.v
     imgui.Process = main_window_state.v
end

function imgui.OnDrawFrame()
    if main_window_state.v then

        imgui.Begin("Helper to MCLV.", main_window_state)
            imgui.BeginChild("##left", imgui.ImVec2(200, 85), true)
                if imgui.Button('Menu', imgui.ImVec2(180, 20)) then menu = 1 end
                if imgui.Button('Settings', imgui.ImVec2(180, 20)) then menu = 2 end
                if imgui.Button('Author', imgui.ImVec2(180, 20)) then menu = 3 end
            imgui.EndChild()
                imgui.SameLine()
            imgui.BeginChild("##right", imgui.ImVec2(400, 150), true)
                if menu == 1 then
                    imgui.Text('Основные функции скрипта:')
                    if imgui.Button('Выполнить выбранное действие.') then
                        if selected_item.v == 0 then
                            sampAddChatMessage('Вы начали отправлять сообщение о начале собеседования..', -1)
                        end
                        if selected_item.v == 1 then
                            sampAddChatMessage('Вы начали отправлять сообщение о конце собеседования..', -1)
                        end
                        if selected_item.v == 2 then
                            sampAddChatMessage('Разработка..', -1)
                        end
                    end
                end
                if menu == 2 then
                    imgui.Text('Settings')
                    imgui.Combo("", combo_select, arr_str, #arr_str)
                end
                if menu == 3 then
                    imgui.Text('Автором скрипта является - han(Handerson_Onfroy)')
                end
            imgui.EndChild()
        imgui.End()
    end
end

@astap.php
moonloader\helper-for-mclv.lua:111: 'end' expected (to close 'function' at line 72) near '<eof>'
[ML] (error) helper-for-mclv.lua: Script died due to an error. (190018FC)

 
Последнее редактирование:

Kegwineye.

Участник
Автор темы
478
20
у меня после закрытия скрипта не пропадает курсор @astap.php

даже добавил
if main_window_state.v then
imgui.Process = true
imgui.ShowCursor = true
else
imgui.Process = false
imgui.ShowCursor = false
end
все равно не закрывает

код вот, помоги пофиксить плез

Lua:
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = "[My First Script]:"
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"
local menu = 1

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

local checkbox1 = imgui.ImBool(false)
local checkbox2 = imgui.ImBool(false)
local checkbox3 = imgui.ImBool(false)

local checked_radio = imgui.ImInt(1)
local selected_item = imgui.ImInt(1)
local items = {u8'Начало собеседования.', u8'Конец собеседования.', u8'В разработке.'}

local themes = import "resource/imgui_themes.lua"


-- for combo
local combo_select = imgui.ImInt(1)
local arr_str = {"test1", "test2", "test3"}

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

    sampRegisterChatCommand("mclv", cmdimgui)

    handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)

    imgui.Process = false

    imgui.SwitchContext()
    themes.SwitchColorTheme(1)

  while true do
        wait(0)
        
    
    end  -- function
end

        if main_window_state.v == false then
        imgui.Process = false
        imguiShowCursor = false
        else
        imgui.Process = false
        imgui.ShowCursor = false
        end
function cmdimgui()
     main_window_state.v = not main_window_state.v
     imgui.Process = main_window_state.v
 end
 
function imgui.OnDrawFrame()
    if main_window_state.v then

        imgui.Begin("Helper to MCLV.", main_window_state)
            imgui.BeginChild("##left", imgui.ImVec2(200, 85), true)
                if imgui.Button('Menu', imgui.ImVec2(180, 20)) then menu = 1 end
                if imgui.Button('Settings', imgui.ImVec2(180, 20)) then menu = 2 end
                if imgui.Button('Author', imgui.ImVec2(180, 20)) then menu = 3 end
            imgui.EndChild()
                imgui.SameLine()
            imgui.BeginChild("##right", imgui.ImVec2(400, 150), true)
                if menu == 1 then
                    imgui.Text(u8'Основные функции скрипта:')
                    imgui.Combo(u8'Подача гос. волны.', selected_item, items, #items)
                    if imgui.Button(u8'Подать гос. волну.') then
                        if selected_item.v == 0 then
                            sampAddChatMessage('Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 1 then
                            sampAddChatMessage('Вы запустили подачу гос. волны.', -1)
                        end
                        if selected_item.v == 2 then
                            sampAddChatMessage('Данная функция в разработке..', -1)
                        end
                  
                end
                if menu == 2 then
                    imgui.Text('Settings')
                    for i, value in ipairs(themes.colorThemes) do
                   if imgui.RadioButton(value, checked_radio, i) then
                      themes.SwitchColorTheme(i)
                   end
               end
                if menu == 3 then
                    imgui.Text(u8'Автор скрипта - han(Handerson_Onfroy)')
                end
            imgui.EndChild()
        imgui.End()
    end
end
 
Последнее редактирование: