local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local WinState = imgui.new.bool()
local tab = 1
— locals
local active_script = imgui.new.bool()
imgui.OnFrame(function() return WinState[0] end, function(player)
imgui.SetNextWindowPos(imgui.ImVec2(500, 500), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 120), imgui.Cond.Always)
imgui.Begin(u8'Пример', WinState, imgui.WindowFlags.NoResize)
for numberTab,nameTab in pairs({'Основное','Настройки','Инфа', 'Тест'}) do
if imgui.Button(u8(nameTab), imgui.ImVec2(80,24)) then
tab = numberTab
end
end
imgui.SetCursorPos(imgui.ImVec2(95, 28))
if imgui.BeginChild('Name##'..tab, imgui.ImVec2(300, 80), true) then
—Содержимое вкладок
if tab == 1 then
if imgui.Checkbox(u8'Включение/выключение', active_script) then
if active_script[0] then
if wasKeyPressed(0x31) and not sampIsChatInputActive() and not sampIsDialogActive() then
local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if result then
_, id = sampGetPlayerIdByCharHandle(ped)
sampSendChat('/me передал бандану')
wait(1000)
sampSendChat('/givecbook '..id..' 100')
sampSendChat('/invite '..id)
setVirtualKeyDown(13, true)
wait(100)
setVirtualKeyDown(13, false)
accept = true
end
end
end
end
end
elseif tab == 2 then
— что то будет
end
imgui.End()
end)
function main()
sampRegisterChatCommand('cmdd', function() WinState[0] = not WinState[0] end)
wait(-1)
end