script_name('Shawty Helper')
script_author('shawtyglock')
require "lib.moonloader"
local imgui = require 'imgui'
local inicfg = require 'inicfg'
local sampev = require 'lib.samp.events'
local hook = require 'lib.samp.events'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local main_window_state = imgui.ImBool(false)
local rkeys = require 'rkeys'
imgui.HotKey = require('imgui_addons').HotKey
local fa = require 'faIcons'
local fonts = renderCreateFont("Arial", 9, 5)
local themes = import "resource/imgui_themes.lua"
local directIni = 'Shawty Helper.ini'
local mainIni = inicfg.load(inicfg.load({
config = {
CommandAct = 'sh',
SizeFont = 9,
FlagFont = 5,
famzone = false,
fastrep = false,
probiv = false
},
HotKey = {
armour = encodeJson({nil}),
mask = encodeJson({nil}),
drugs = encodeJson({nil}),
cure = encodeJson({nil}),
lock = encodeJson({nil})
}
}, directIni))
inicfg.save(mainIni, directIni)
local tLastKeys = {}
local ActiveArmour = {
v = decodeJson(mainIni.HotKey.armour)
}
local ActiveMask = {
v = decodeJson(mainIni.HotKey.mask)
}
local ActiveLock = {
v = decodeJson(mainIni.HotKey.lock)
}
local ActiveDrugs = {
v = decodeJson(mainIni.HotKey.drugs)
}
local ActiveCure = {
v = decodeJson(mainIni.HotKey.cure)
}
local font = renderCreateFont("Arial", mainIni.config.SizeFont, mainIni.config.FlagFont)
--ImGui
-- local checkkill = imgui.ImBool(config.Kill)
-- local checkstats = imgui.ImBool(config.Stats)
-- local checkhphud = imgui.ImBool(config.HPHud)
-- local checkbell = imgui.ImBool(config.Bell)
local commandact = imgui.ImBuffer(mainIni.config.CommandAct,256)
local sizefont = imgui.ImInt(mainIni.config.SizeFont)
local flagfont = imgui.ImInt(mainIni.config.FlagFont)
-- Checkbox
-- local choose_Kill = imgui.ImBool(false)
-- local choose_Stats = imgui.ImBool(false)
-- local choose_HPHud = imgui.ImBool(false)
-- local choose_Bell = imgui.ImBool(false)
local famzone = imgui.ImBool(mainIni.config.famzone)
local fastrep = imgui.ImBool(mainIni.config.fastrep)
local probiv = imgui.ImBool(mainIni.config.probiv)
function CherryTheme()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
style.WindowPadding = ImVec2(8, 8)
style.WindowRounding = 6.0
style.FramePadding = ImVec2(5, 3)
style.FrameRounding = 3.0
style.ItemSpacing = imgui.ImVec2(5, 4)
style.ItemInnerSpacing = imgui.ImVec2(4, 4)
style.IndentSpacing = 21
style.ScrollbarSize = 10.0
style.ScrollbarRounding = 13
style.GrabMinSize = 8
style.GrabRounding = 1
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)
style.WindowTitleAlign = ImVec2(0.5, 0.5)
colors[clr.Text] = ImVec4(0.860, 0.930, 0.890, 0.78)
colors[clr.TextDisabled] = ImVec4(0.860, 0.930, 0.890, 0.28)
colors[clr.WindowBg] = ImVec4(0.13, 0.14, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.200, 0.220, 0.270, 0.58)
colors[clr.PopupBg] = ImVec4(0.200, 0.220, 0.270, 0.9)
colors[clr.Border] = ImVec4(0.31, 0.31, 1.00, 0.00)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.200, 0.220, 0.270, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.FrameBgActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.TitleBg] = ImVec4(0.232, 0.201, 0.271, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.502, 0.075, 0.256, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.200, 0.220, 0.270, 0.75)
colors[clr.MenuBarBg] = ImVec4(0.200, 0.220, 0.270, 0.47)
colors[clr.ScrollbarBg] = ImVec4(0.200, 0.220, 0.270, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.09, 0.15, 0.1, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.ScrollbarGrabActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.CheckMark] = ImVec4(0.71, 0.22, 0.27, 1.00)
colors[clr.SliderGrab] = ImVec4(0.47, 0.77, 0.83, 0.14)
colors[clr.SliderGrabActive] = ImVec4(0.71, 0.22, 0.27, 1.00)
colors[clr.Button] = ImVec4(0.47, 0.77, 0.83, 0.14)
colors[clr.ButtonHovered] = ImVec4(0.455, 0.198, 0.301, 0.86)
colors[clr.ButtonActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.Header] = ImVec4(0.455, 0.198, 0.301, 0.76)
colors[clr.HeaderHovered] = ImVec4(0.455, 0.198, 0.301, 0.86)
colors[clr.HeaderActive] = ImVec4(0.502, 0.075, 0.256, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.47, 0.77, 0.83, 0.04)
colors[clr.ResizeGripHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.ResizeGripActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.PlotLines] = ImVec4(0.860, 0.930, 0.890, 0.63)
colors[clr.PlotLinesHovered] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.860, 0.930, 0.890, 0.63)
colors[clr.PlotHistogramHovered] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.455, 0.198, 0.301, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(0.200, 0.220, 0.270, 0.73)
end
CherryTheme()
local menu = 1
local fa_font = nil
local sizefont = nil
-- KillStatus
-- local kills = 0
-- local deaths = 0
-- local ratio = 0
-- local dead_players = {}
-- local current = 0
-- local total = 0
function imgui.TextQuestion(text)
imgui.SameLine()
imgui.TextDisabled("(?)")
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.TextUnformatted(u8(text))
imgui.EndTooltip()
end
end
function imgui.CenterTextColoredRGB(text)
local width = imgui.GetWindowWidth()
local style = imgui.GetStyle()
local colors = style.Colors
local ImVec4 = imgui.ImVec4
local explode_argb = function(argb)
local a = bit.band(bit.rshift(argb, 24), 0xFF)
local r = bit.band(bit.rshift(argb, 16), 0xFF)
local g = bit.band(bit.rshift(argb, 8), 0xFF)
local b = bit.band(argb, 0xFF)
return a, r, g, b
end
local getcolor = function(color)
if color:sub(1, 6):upper() == 'SSSSSS' then
local r, g, b = colors[1].x, colors[1].y, colors[1].z
local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
return ImVec4(r, g, b, a / 255)
end
local color = type(color) == 'string' and tonumber(color, 16) or color
if type(color) ~= 'number' then return end
local r, g, b, a = explode_argb(color)
return imgui.ImColor(r, g, b, a):GetVec4()
end
local render_text = function(text_)
for w in text_:gmatch('[^\r\n]+') do
local textsize = w:gsub('{.-}', '')
local text_width = imgui.CalcTextSize(u8(textsize))
imgui.SetCursorPosX( width / 2 - text_width .x / 2 )
local text, colors_, m = {}, {}, 1
w = w:gsub('{(......)}', '{%1FF}')
while w:find('{........}') do
local n, k = w:find('{........}')
local color = getcolor(w:sub(n + 1, k - 1))
if color then
text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
colors_[#colors_ + 1] = color
m = n
end
w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
end
if text[0] then
for i = 0, #text do
imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else
imgui.Text(u8(w))
end
end
end
render_text(text)
end
function hook.onShowDialog(dialogId, dialogStyle, dialogTitle, okButtonText, cancelButtonText, dialogText)
if fastrep.v then
if dialogId == 32 then
return false
end
end
end
function fastreport(text)
if fastrep.v then
if #text == 0 then
sampAddChatMessage('{ff6347}[Shawty Helper]:{ffffff} Введите ваш репорт', 0xff6347)
else
sampSendChat('/rep')
sampSendDialogResponse(32, 1, 0, text)
end
else
sampSendChat('/rep')
end
end
function findfamzone()
if famzone.v then
lua_thread.create(function()
sampSendChat("/fammenu")
wait(150)
sampSendClickTextdraw(2077)
wait(150)
sampSendDialogResponse(15208, 1, 1, nil)
wait(150)
sampSendDialogResponse(15226, 1, 0, nil)
wait(150)
sampSendDialogResponse(15227, 1, 0, nil)
wait(50)
setVirtualKeyDown(27, true)
end)
end
end
function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampAddChatMessage('{de3163}[Shawty Helper] {ffffff}Успешно загружен! Открыть меню:{de3163} /'..mainIni.config.CommandAct, -1)
sampRegisterChatCommand("sh", function()
main_window_state.v = not main_window_state.v end)
sampRegisterChatCommand(mainIni.config.CommandAct, function()
main_window_state.v = not main_window_state.v end)
sampRegisterChatCommand('rep', fastreport)
sampRegisterChatCommand('probiv', cmd_probiv)
sampRegisterChatCommand('famzone', findfamzone)
bind = rkeys.registerHotKey(ActiveArmour.v, true, function()
if not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat("/armour")
end
end)
bind = rkeys.registerHotKey(ActiveMask.v, true, function()
if not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat("/mask")
end
end)
bind = rkeys.registerHotKey(ActiveLock.v, true, function()
if not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat("/lock")
end
end)
bind = rkeys.registerHotKey(ActiveDrugs.v, true, function()
hp = getCharHealth(PLAYER_PED)
if hp < 120 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat('/usedrugs 3')
elseif hp >= 120 and hp < 140 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat('/usedrugs 2')
elseif hp >= 140 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsScoreboardOpen() and not isSampfuncsConsoleActive() then
sampSendChat('/usedrugs 1')
end
end)
bind = rkeys.registerHotKey(ActiveCure.v, true, function()
local veh, ped = storeClosestEntities(PLAYER_PED)
local _, id = sampGetPlayerIdByCharHandle(ped)
if id then
if id == -1 then sampAddChatMessage('{de3163}[Shawty Helper]{FFFFFF} Ошибка, рядом никого нет!', -1) else
sampSendChat('/cure '..id)
end
end
end)
while true do
wait(0)
imgui.Process = main_window_state.v
end
end
function cmd_probiv(id)
if probiv.v then
lua_thread.create(function()
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
wait(500)
sampAddChatMessage('{de3163}[Shawty Helper] {ffffff}Авто-Пробив начат.', -1)
wait(2000)
sampSendChat("/time")
wait(500)
sampSendChat("/id "..id.."")
sampSendChat("/id "..id.."")
sampSendChat("/id "..id.."")
wait(1000)
setVirtualKeyDown(VK_TAB, false)
wait(1000)
setVirtualKeyDown(VK_TAB, false)
wait(500)
setVirtualKeyDown(116, true)
wait(3100)
setVirtualKeyDown(116, false)
wait(600)
sampSendChat("/skill")
wait(600)
sampSendChat("/stats")
wait(600)
sampSendChat("/donate")
wait(600)
setVirtualKeyDown(27, true)
wait(500)
sampSendChat("/invent")
wait(1500)
sampSendClickTextdraw(2078)
wait(2000)
setVirtualKeyDown(27, true)
wait(500)
sampAddChatMessage('{de3163}[Shawty Helper] {ffffff}Авто-Пробив завершён.', -1)
end)
end
end
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
function imgui.BeforeDrawFrame()
if fa_font == nil then
local font_config = imgui.ImFontConfig()
font_config.MergeMode = true
fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fontawesome-webfont.ttf', 14.0, font_config, fa_glyph_ranges)
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(750, 400), imgui.Cond.FirstUseEver)
imgui.Begin(u8"Shawty Helper", main_window_state, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoScrollWithMouse +
imgui.WindowFlags.NoTitleBar)
imgui.BeginChild('##up1',
imgui.ImVec2(200, 50), true, imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoScrollWithMouse)
imgui.Spacing()
imgui.Spacing()
imgui.Spacing()
imgui.CenterTextColoredRGB('Shawty Helper v0.1.1')
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild('##up2',
imgui.ImVec2(528, 50), true, imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoScrollWithMouse)
imgui.Spacing()
imgui.Spacing()
imgui.Spacing()
imgui.CenterTextColoredRGB('Информация')
imgui.EndChild()
imgui.BeginChild('##left',
imgui.ImVec2(200, 328), true, imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoScrollWithMouse)
if imgui.Button(u8('Информация'), imgui.ImVec2(-1, 75)) then
menu = 1
end
if imgui.Button(u8('Функции'), imgui.ImVec2(-1, 75)) then
menu = 2
end
if imgui.Button(u8('Биндер'), imgui.ImVec2(-1, 75)) then
menu = 3
end
if imgui.Button(u8('Настройки'), imgui.ImVec2(-1, 75)) then
menu = 4
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild('##right', imgui.ImVec2(528, 328), true, imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoScrollWithMouse)
if menu == 1 then
imgui.CenterTextColoredRGB('Автор данного скрипта - shawtyglock\nЕсли желаете добавить в скрипт что-то для его доработки\nили нашли ошибки в скрипте, пишите мне в Discord: FluffyBeast#8186')
end
if menu == 2 then
if imgui.Checkbox(u8"Быстрый репорт", fastrep) then
mainIni.config.fastrep = fastrep.v
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.TextQuestion("Быстрый репорт в формате:\n/rep *текст репорта*")
if imgui.Checkbox(u8"Авто-Пробив", probiv) then
mainIni.config.probiv = probiv.v
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.TextQuestion("Автоматически пробивает ваш айди, тайм, таб, \nдонат, скиллы, обвесы, F5. Активация: /probiv")
if imgui.Checkbox(u8"Нахождение территории", famzone) then
mainIni.config.famzone = famzone.v
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.TextQuestion("Автоматически находит территорию ближайшего семейного капта.\nНе включать, если используете пункт *WAR FOR TERRITORY*. Активация: /famzone")
end
if menu == 3 then
if imgui.HotKey("##1", ActiveLock, tLastKeys, 50) then
rkeys.changeHotKey(bindLock, ActiveLock.v)
mainIni.HotKey.lock = encodeJson(ActiveLock.v)
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.Text(u8"Открытие машины")
imgui.TextQuestion("Открывает машину на указанную вами клавишу/комбинацию клавиш")
if imgui.HotKey("##2", ActiveArmour, tLastKeys, 50) then
rkeys.changeHotKey(bindArmour, ActiveArmour.v)
mainIni.HotKey.armour = encodeJson(ActiveArmour.v)
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.Text(u8"Использование армора")
imgui.TextQuestion("Использует армор на указанную вами клавишу/комбинацию клавиш")
if imgui.HotKey("##3", ActiveMask, tLastKeys, 50) then
rkeys.changeHotKey(bindMask, ActiveMask.v)
mainIni.HotKey.mask = encodeJson(ActiveMask.v)
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.Text(u8"Использование маски")
imgui.TextQuestion("Использует маску на указанную вами клавишу/комбинацию клавиш")
if imgui.HotKey("##4", ActiveCure, tLastKeys, 50) then
rkeys.changeHotKey(bindCure, ActiveCure.v)
mainIni.HotKey.cure = encodeJson(ActiveCure.v)
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.Text(u8"Поднятие ближайшего игрока")
imgui.TextQuestion("Поднимает ближайшего игрока в стадии смерти уколом\nадреналина на указанную вами клавишу/комбинацию клавиш")
if imgui.HotKey("##5", ActiveDrugs, tLastKeys, 50) then
rkeys.changeHotKey(bindDrugs, ActiveDrugs.v)
mainIni.HotKey.drugs = encodeJson(ActiveDrugs.v)
inicfg.save(mainIni, 'Shawty Helper.ini')
end
imgui.SameLine()
imgui.Text(u8"Использование наркотиков")
imgui.TextQuestion("Использует наркотики в зависимости от количества вашего\nздоровья на указанную вами клавишу/комбинацию клавиш")
end
if menu == 4 then
imgui.Text(u8'Команда активации')
imgui.SameLine()
if imgui.InputText('', commandact) then
mainIni.config.CommandAct = commandact.v
inicfg.save(mainIni,'Shawty Helper.ini')
end
end
imgui.EndChild()
imgui.End()
end
end