script_author('FixZer')
script_name('GhettoHelper')
script_description('Хелпер сделанный специально для гетто')
require "lib.moonloader"
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local imgui = require 'imgui'
local keys = require 'vkeys'
local rkeys = require 'rkeys'
imgui.HotKey = require('imgui_addons').HotKey
local encoding = require "encoding"
encoding.default = 'CP1251'
u8 = encoding.UTF8, dialogId, style, title, button1, button2, text
local sw, sh = getScreenResolution()
local scriptname = '[{FF6600}Ghetto Helper{FFFFFF}]: '
local main_window = imgui.ImBool(false)
local settings = imgui.ImBool(false)
local mainIni = inicfg.load({
config = {
a = false,
}
}, 'GhettoHelper/settings.ini')
local directIni = "moonloader\\config\\PoliceHelper\\hotkey.ini"
local hotIni = inicfg.load(nil, directIni)
if hotIni.bind == nil then -- если отсутствует секция hotkey в ини файле
hotIni.bind = {
bindMenu = {vkeys.VK_K},
}
end
local ActiveMainMenu = {v = hotIni.bind.bindMenu}
local tLastKeys = {}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
if not doesFileExist('moonloader/GhettoHelper/settings.ini') then inicfg.save(mainIni, 'GhettoHelper/settings.ini') end
sampAddChatMessage(scriptname..'Хелпер успешно запустился!', -1)
sampRegisterChatCommand('gh', function()
main_window.v = not main_window.v
imgui.Process = main_window.v
end)
bindMenu = rkeys.registerHotKey(ActiveMainMenu.v, true, function()
main_window.v = not main_window.v
imgui.Process = main_window.v
end)
imgui.Process = false
while true do
wait(0)
end
end
function imgui.OnDrawFrame()
if not main_window.v then imgui.Process = false end
if main_window.v then
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(650, 400), imgui.Cond.FirstUseEver)
imgui.Begin('Ghetto Helper', main_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoCollapse)
imgui.BeginChild('LeftMenu', imgui.ImVec2(150, 370), true)
if imgui.Button(u8'Управление', imgui.ImVec2(142, 40)) then settings.v = not settings.v end
--imgui.Button(u8'Интсрументы', imgui.ImVec2(142, 40))
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild('RightMenu', imgui.ImVec2(485, 370), true)
if settings.v then
imgui.SetCursorPos(imgui.ImVec2(200, 0))
imgui.Text(u8"Управление")
imgui.PushItemWidth(480)
if imgui.HotKey("##activemainmenu", ActiveMainMenu, tLastKeys, 100) then
rkeys.changeHotKey(bindMenu, ActiveMainMenu.v)
hotIni.bind.bindMenu = ActiveMainMenu.v
inicfg.save(hotIni, directIni)
end
end
imgui.EndChild()
imgui.End()
end
end
function onWindowMessage(msg, wparam, lparam)
if msg == 0x100 or msg == 0x101 then
if (wparam == keys.VK_ESCAPE and main_window.v) and not isPauseMenuActive() then
consumeWindowMessage(true, false)
if msg == 0x101 then
main_window.v = false
end
end
end
end
function Changetheme()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 2
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ChildWindowRounding = 4.0
style.FrameRounding = 3
style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
style.ScrollbarSize = 13.0
style.ScrollbarRounding = 0
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
style.WindowPadding = imgui.ImVec2(4.0, 4.0)
style.FramePadding = imgui.ImVec2(3.5, 3.5)
--style.ButtonTextAlign = imgui.ImVec2(0.0, 0.5)
colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.TitleBg] = ImVec4(0.76, 0.31, 0.00, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
colors[clr.TitleBgActive] = ImVec4(0.80, 0.33, 0.00, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
colors[clr.CheckMark] = ImVec4(1.00, 0.42, 0.00, 0.53)
colors[clr.SliderGrab] = ImVec4(1.00, 0.42, 0.00, 0.53)
colors[clr.SliderGrabActive] = ImVec4(1.00, 0.42, 0.00, 1.00)
colors[clr.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
colors[clr.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
colors[clr.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
colors[clr.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
Changetheme()