local imgui = require 'imgui'
local on = require'lib.samp.events'
local inicfg = require 'inicfg'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local anotherIni = inicfg.load(nil, "stat")
if anotherIni == nil then
local anotherIni = inicfg.load({
st = {
['stat'] = false,
},
})
inicfg.save(anotherIni, "stat")
print('перезагрузи скрипт')
end
local Buffer = imgui.ImBuffer(256)
local dial, but1, but2, tt = '', 'ОК', 'НЕ ОК', 'Nick_Nick'
local report_window_state = imgui.ImBool(true)
function on.onShowDialog(did, style, title, b1, b2, text)
if did == 6370 and style == 1 and text:find('Жалоба/Вопрос от (%w+_%w+)%[(%d+)%]') then
dial, but1, but2, tt = did, b1, b2, text:gsub('{%P+}','')
report_window_state.v = true
end
end
function imgui.OnDrawFrame()
if report_window_state.v and anotherIni.st.stat == true then
imgui.SetNextWindowSize(imgui.ImVec2(250, 150), imgui.Cond.FirstUseEver)
imgui.Begin(u8'Ответ на вопрос '..tt:match('(%w+_%w+)'), report_window_state, imgui.WindowFlags.NoResize)
imgui.Text(u8(tt))
imgui.PushItemWidth(230)
imgui.InputText(' ', Buffer)
imgui.PopItemWidth()
if imgui.Button(u8(but1),imgui.ImVec2(112, 20)) and Buffer.v ~= nil and Buffer.v ~= '' then
sampSendDialogResponse(dial,1, _,u8:decode(Buffer.v))
sampCloseCurrentDialogWithButton(0)
Buffer.v = ''
--report_window_state.v = false
end
imgui.SameLine()
if imgui.Button(u8(but2),imgui.ImVec2(113, 20)) then
sampCloseCurrentDialogWithButton(0)
Buffer.v = ''
report_window_state.v = false
end
imgui.End()
end
end
function main()
function on.onSendSpawn() anotherIni.st.stat = true inicfg.save(anotherIni, "stat") end
sampRegisterChatCommand('cmd',function() report_window_state.v = not report_window_state.v print(report_window_state.v) end)
while true do wait(0)
imgui.Process = report_window_state.v
imgui.ShowCursor = report_window_state.v
end
end
function onQuitGame() anotherIni.st.stat = false inicfg.save(anotherIni, "bind") end