- Версия MoonLoader
- Другое
как бы не пробывал не получалось сохранять клавишу в ini. Help!!
рабочий код без ini:
рабочий код без ini:
Lua:
local vkeys = require 'vkeys'
local wm = require 'lib.windows.message'
local imgui = require 'imgui'
local encoding = require 'encoding'
local rkeys = require 'rkeys'
imgui.ToggleButton = require('imgui_addons').ToggleButton
imgui.HotKey = require('imgui_addons').HotKey
imgui.Spinner = require('imgui_addons').Spinner
imgui.BufferingBar = require('imgui_addons').BufferingBar
encoding.default = 'CP1251'
u8 = encoding.UTF8
local window = imgui.ImBool(false)
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, 400), imgui.Cond.FirstUseEver)
imgui.Begin(u8"Установление клавишы", windowmazafiker, imgui.WindowFlags.NoCollapse)
if imgui.HotKey("##active", ActiveMenu, tLastKeys, 100) then
rkeys.changeHotKey(bindID, ActiveMenu.v)
end
imgui.SameLine()
imgui.Text(u8("Клавиша активации"))
imgui.End()
end