local rkeys = require 'rkeys'
local vkeys = require 'vkeys'
imgui.HotKey = require('imgui_addons').HotKey
local ActiveMenu = {
v = {vkeys.VK_F2}
}
local bindID = 0
function main()
if not isSampLoaded() then
return
end
while not isSampAvailable() do
wait(0)
end
sampRegisterChatCommand("test", function ()
window.v = not window.v
end)
bindID = rkeys.registerHotKey(ActiveMenu.v, true, function ()
window.v = not window.v
end)
while true do
wait(0)
imgui.Process = window.v
end
end
function imgui.OnDrawFrame()
local iScreenWidth, iScreenHeight = getScreenResolution()
local tLastKeys = {}
imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth / 2, iScreenHeight / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 200), imgui.Cond.FirstUseEver)
imgui.Begin("Test Window", window)
if imgui.HotKey("##active", ActiveMenu, tLastKeys, 100) then
rkeys.changeHotKey(bindID, ActiveMenu.v)
sampAddChatMessage("Успешно! Старое значение: " .. table.concat(rkeys.getKeysName(tLastKeys.v), " + ") .. " | Новое: " .. table.concat(rkeys.getKeysName(ActiveMenu.v), " + "), -1)
end
imgui.SameLine()
imgui.Text(u8("Открыть меню"))
end