- 2,105
- 1,641
- Версия SA-MP
-
- 0.3.7 (R1)
Lua:
local imgui = require 'imgui'
local inicfg = require 'inicfg'
local vkeys = require 'vkeys'
local rkeys = require 'rkeys'
imgui.HotKey = require('imgui_addons').HotKey
-- inicfg
local Load_Config = inicfg.load({
settings = {
key = vkeys.VK_J
},
}, '..\\config\\test.ini')
LS = Load_Config.settings
-- imgui
local imgui_window = imgui.ImBool(false)
local ActiveMenu = {
v = {LS.key}
}
local bindID = 0
function main()
sampRegisterChatCommand('test', function() imgui_window.v = not imgui_window.v end)
bindID = rkeys.registerHotKey(LS.key, true, function ()
imgui_window.v = not imgui_window.v
end)
while true do wait(0)
imgui.Process = imgui_window.v
end
end
function imgui.OnDrawFrame()
sw, sh = getScreenResolution()
if imgui_window.v then
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 400), imgui.Cond.FirstUseEver)
imgui.Begin('1')
if imgui.HotKey("##active", ActiveMenu.v, tLastKeys, 100) then
rkeys.changeHotKey(bindID, ActiveMenu.v)
end
imgui.Text('2')
imgui.End()
end
end
Нажимаю на клавишу или на Imgui.Button и клавиша сохраняется в .ini файл (клавиша которую я нажал)