Что тут не так?

Fabregoo

Известный
Автор темы
656
128
Версия MoonLoader
Другое
Что не так в коде?
Lua:
 local main_window_state = imgui.ImBool(false)

function imgui.OnDrawFrame()

  if main_window_state.v then

    imgui.SetNextWindowSize(imgui.ImVec2(1200, 600), imgui.Cond.FirstUseEver) -- меняем размер

imgui.Begin('Mini_Helper', main_window_state)

imgui.Text('Menu')

        if imgui.Button('Report') then

        activation = not activation

        sampSendChat('/report')

    end

end

        imgui.End()







function hook.onShowDialog(dialogId, style, title ,button1, button2, text)

    lua_thread.create(function()

      if activation then

        wait(100)

        if dialogId == (32) and ac then

        sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')

        ac = false

        return false

    end)

end

end



function main()

  while true do

    wait(0)

    if testCheat("RPRP") then

        main_window_state.v = not main_window_state.v -- переключаем статус активности окна, не забываем про .v

    end

    imgui.Process = main_window_state.v -- теперь значение imgui.Process всегда будет задаваться в зависимости от активности основного окна

  end

end
Выписка с лога
ML] (error) sdf - копия.lua: D:\GTA San Andreas - копия\moonloader\sdf - копия.lua:62: ')' expected (to close '(' at line 54) near 'end'
[ML] (error) sdf - копия.lua: Script died due to an error. (064F555C)
 
Решение
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
    lua_thread.create(function()
      if activation then
        wait(100)
        if dialogId == (32) and ac then
            sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
            ac = false
            return false
        end
    end)
end

Fabregoo

Известный
Автор темы
656
128
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
    lua_thread.create(function()
      if activation then
        wait(100)
        if dialogId == (32) and ac then
            sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
            ac = false
            return false
        end
    end)
end
Сейчас проверю
Спасиб заранее.
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
    lua_thread.create(function()
      if activation then
        wait(100)
        if dialogId == (32) and ac then
            sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
            ac = false
            return false
        end
    end)
end
Теперь выдает вот ето..
[ML] (error) sdf - копия.lua: D:\GTA San Andreas - копия\moonloader\sdf - копия.lua:62: ')' expected (to close '(' at line 54) near 'end'
[ML] (error) sdf - копия.lua: Script died due to an error. (0644F59C)
 
Последнее редактирование:

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
Сейчас проверю
Спасиб заранее.

Теперь выдает вот ето..
[ML] (error) sdf - копия.lua: D:\GTA San Andreas - копия\moonloader\sdf - копия.lua:62: ')' expected (to close '(' at line 54) near 'end'
[ML] (error) sdf - копия.lua: Script died due to an error. (0644F59C)
а если так?
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
    lua_thread.create(function()
      if activation then
        wait(100)
        if dialogId == (32) and ac then
            sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
            ac = false
            return false
           end
       end
    end)
end
 
  • Нравится
Реакции: Fabregoo

Fabregoo

Известный
Автор темы
656
128
а если так?
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
    lua_thread.create(function()
      if activation then
        wait(100)
        if dialogId == (32) and ac then
            sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
            ac = false
            return false
           end
       end
    end)
end
Ничего не изменилось...
Просто открывается репорт, не закрывается имгуи, и все.
Какой функцией реконнектится на сервер?И выствалять задержку в ini, или прям через команду.
 
Последнее редактирование:

karimoff

Участник
37
11
Lua:
function hook.onShowDialog(dialogId, style, title ,button1, button2, text)
   if activation and dialogId == 32 and ac then
        sampSendDialogResponse(dialogId, 1, sampGetCurrentDialogListItem(), '123123 TEST')
        main_window_state.v = false
        ac = false
        return false
   end
end
С телефона писал, попробуй.
upd. для реконекта setgamestate(int)
 
Последнее редактирование: