require "moonloader"
local sampev = require "lib.samp.events"
function main()
while not isSampAvailable() do wait(100) end -- Ждем загрузки SAMP
local menu = {
{name = "Опция 1", func = function() sampSendChat("/say Привет, я выбрал опцию 1") end},
{name = "Опция 2", func = function() sampSendChat("/say Привет, я выбрал опцию 2") end},
{name = "Опция 3", func = function() sampSendChat("/say Привет, я выбрал опцию 3") end},
{name = "Закрыть", func = function() end},
}
local menuIsOpen = false
local menuIndex = 1
while true do
wait(0)
if isKeyDown(VK_F5) and not menuIsOpen then
sampShowDialog(1, "Меню", "", "Выбрать", "Закрыть", 1, menu[menuIndex].name)
menuIsOpen = true
end
if menuIsOpen and sampIsDialogActive(1) then
local button, list, input = sampHasDialogRespond(1)
if button then
if button == 1 then
menu[menuIndex].func()
end
sampHideDialog(1)
menuIsOpen = false
elseif list then
menuIndex = list - 1
sampSetDialogText(1, menu[menuIndex].name)
end
end
end
end
function sampev.onServerMessage(color, text)
if string.find(text, "!binds") then
sampAddChatMessage("[Биндер] Доступные бинды: F5", -1)
end
end