local imgui = require('imgui')
local encoding = require 'encoding'
local sampev = require 'lib.samp.events'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local window = imgui.ImBool(false)
function main()
while not isSampAvailable() do wait(200) end
imgui.Process = true
sampRegisterChatCommand('setleader', function(arg)
if #arg == 0 then
sampAddChatMessage('Вы не ввели ID игрока', -1)
else
window.v = not window.v
id = arg
end
end)
apply_custom_style()
while true do
wait(0)
if not window.v then imgui.ShowCursor = false end
end
end
function imgui.OnDrawFrame()
if window.v then
imgui.ShowCursor = true
local resX, resY = getScreenResolution()
local sizeX, sizeY = 207, 337
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
imgui.Begin('/setleader - ' .. sampGetPlayerNickname(id), window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
local size = imgui.ImVec2(193, 30)
if imgui.Button(u8'Минздрав', size) then
sampSendChat('/setleader '.. id )
minzdrav = true
end
if imgui.Button(u8'ФСБ', size) then
sampSendChat('/setleader '.. id )
fsb = true
end
if imgui.Button(u8'Министерство Обороны', size) then
sampSendChat('/setleader '.. id )
MO = true
end
if imgui.Button(u8'МВД', size) then
sampSendChat('/setleader '.. id )
MVD = true
end
if imgui.Button(u8'Новостная Сеть', size) then
sampSendChat('/setleader '.. id )
news = true
end
if imgui.Button(u8'Администрация Президента', size) then
sampSendChat('/setleader '.. id )
AP = true
end
if imgui.Button(u8'Тамбовская ОПГ', size) then
sampSendChat('/setleader '.. id )
tamb = true
end
if imgui.Button(u8'Курганская ОПГ', size) then
sampSendChat('/setleader '.. id )
kurgan = true
end
if imgui.Button(u8'Измайловская ОПГ', size) then
sampSendChat('/setleader '.. id )
izmail = true
end
imgui.End()
end
end
function sampev.onShowDialog(id, style, title, button1, button2, text)
if title:match('(%a+_%a+)') then
if fsb then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 11, nil)
sampCloseCurrentDialogWithButton(0)
fsb = false
end
if minzdrav then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 1, nil)
sampCloseCurrentDialogWithButton(0)
minzdrav = false
end
if MO then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 7, nil)
sampCloseCurrentDialogWithButton(0)
MO = false
end
if MVD then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 8, nil)
sampCloseCurrentDialogWithButton(0)
MVD = false
end
if news then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 9, nil)
sampCloseCurrentDialogWithButton(0)
news = false
end
if AP then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 10, nil)
sampCloseCurrentDialogWithButton(0)
AP = false
end
if tamb then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 12, nil)
sampCloseCurrentDialogWithButton(0)
tamb = false
end
if kurgan then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 13, nil)
sampCloseCurrentDialogWithButton(0)
kurgan = false
end
if izmail then
sampSendDialogResponse(sampGetCurrentDialogId(), 1, 14, nil)
sampCloseCurrentDialogWithButton(0)
izmail = false
end
end
end
function apply_custom_style()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 2.0
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
style.ChildWindowRounding = 2.0
style.FrameRounding = 2.0
style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
style.ScrollbarSize = 13.0
style.ScrollbarRounding = 0
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
colors[clr.FrameBg] = ImVec4(0.16, 0.29, 0.48, 0.54)
colors[clr.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.16, 0.29, 0.48, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.SliderGrab] = ImVec4(0.24, 0.52, 0.88, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Button] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.26, 0.59, 0.98, 0.31)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Separator] = colors[clr.Border]
colors[clr.SeparatorHovered] = ImVec4(0.26, 0.59, 0.98, 0.78)
colors[clr.SeparatorActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95)
colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
colors[clr.ChildWindowBg] = ImVec4(1.00, 1.00, 1.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.ComboBg] = colors[clr.PopupBg]
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end