local vkeys = require 'vkeys'
local on = require('lib.samp.events')
local imgui = require 'mimgui'
local ffi = require 'ffi'
local wm = require 'windows.message'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof
local renderWindow = new.bool()
local inputField = new.char[256]()
local int = imgui.new.int(1)
local sizeX, sizeY = getScreenResolution()
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
end)
local newFrame = imgui.OnFrame(
function() return renderWindow[0] end,
function(player)
imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(220, 200), imgui.Cond.FirstUseEver)
imgui.Begin("Main Window", renderWindow)
imgui.InputText("##69", inputField, sizeof(inputField))
imgui.InputInt(u8"##4", int)
imgui.End()
end
)
function on.onServerMessage(clr,msg)
if string.match(msg,u8:decode(str(inputField))) then
for i = 1, int[0] do
sampAddChatMessage('Ммм... Хуита!',-1)
end
end
end
function main()
addEventHandler('onWindowMessage', function(msg, wparam, lparam)
if msg == wm.WM_KEYDOWN or msg == wm.WM_SYSKEYDOWN then
if not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then
if wparam == vkeys.VK_X then
renderWindow[0] = not renderWindow[0]
end
end
end
end)
wait(-1)
end