- 33
- 2
- Версия MoonLoader
- Другое
Кароче, когда добавляю вторую строку - крашится
Если что, крашит из-за последней строчки imgui.InputText
Lua:
local imgui = require "imgui"
local key = require "vkeys"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8
local mains_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(4)
local text_buf = imgui.ImBuffer(4)
local text_buff = imgui.ImBuffer(30)
local text_buffe = imgui.ImBuffer(3)
local sw, sh = getScreenResolution()
local themes = import "Eternity\\imgui_themes.lua"
function main()
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("spec", cmd_specg)
imgui.SwitchContext()
themes.SwitchColorTheme(7)
imgui.Process = false
while true do
wait(0)
if mains_window_state.v == false then
imgui.Process = false
end
end
end
function cmd_specg()
mains_window_state.v = not mains_window_state.v
imgui.Process = mains_window_state.v
end
function imgui.OnDrawFrame()
if not mains_window_state.v then
imgui.Process = false
end
if mains_window_state.v then
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, -0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 200), imgui.Cond.FirstUseEver)
imgui.Begin("spec", mains_window_state, imgui.WindowFlags.NoResize)
imgui.PushItemWidth(50)
imgui.InputText(u8"ID Отправителя", text_buffer)
imgui.SameLine()
if imgui.Button(u8"Слапнуть") then
sampSendChat("/slap ".. text_buffer.v .."")
end
imgui.SameLine()
if imgui.Button(u8"Заспавнить") then
sampSendChat("/sethp ".. text_buffer.v .." 0")
end
if imgui.Button(u8"Следить") then
sampSendChat("/re ".. text_buffer.v .."")
end
imgui.SameLine()
if imgui.Button(u8"Работаю") then
sampSendChat("/pm ".. text_buffer.v .." Здравствуйте, начинаю работать по вашей жалобе")
end
imgui.SameLine()
if imgui.Button(u8"Закрыто") then
sampSendChat("/pm ".. text_buffer.v .." Заканчиваю работу по вашей жалобе. Закрыто")
end
imgui.SameLine()
if imgui.Button(u8"Наказан") then
sampSendChat("/pm ".. text_buffer.v .." Игрок Получил наказание. Закрыто")
end
imgui.Separator()
imgui.InputText(u8"ID Нарушителя", text_buf)
end
end