local ev = require("lib.samp.events")
local imgui = require("imgui")
local encoding = require ("encoding")
encoding.default = 'CP1251'
local u8 = encoding.UTF8
function imgui.BeforeDrawFrame()
if font28 == nil then
font28 = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 28.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic())
end
if font24 == nil then
font24 = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 24.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic())
end
if font20 == nil then
font20 = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 20.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic())
end
if font18 == nil then
font18 = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 18.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic())
end
end
local bot = {
menu = imgui.ImBool(false),
active = imgui.ImBool(false),
laps = imgui.ImInt(999),
jump_bot = imgui.ImBool(false),
sprint_bot = imgui.ImBool(false)
}
local bstatus = 0
local STATUS = {
CARRIAGE = 1,
unload = 2
}
local stat = {
laps_all = 0
}
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("bbot", function()
bot.menu.v = not bot.menu.v
imgui.Process = bot.menu.v
end)
while true do wait(0)
if not bot.active.v then stat.laps_all = 0 end
if bot.active.v then
for _, v in pairs(getAllObjects()) do
if sampGetObjectSampIdByHandle(v) ~= -1 then
if getObjectModel(v) == 1415 then
setObjectCollision(v, false)
end
end
end
math.randomseed(os.time())
local rand = math.random(1, 2)
if rand == 1 then
if bstatus == STATUS.CARRIAGE then
sampAddChatMessage("{1F1F1F}| [Ru{171717}dBo{111111}t] : {C1C1C1} Я начал новй круг. Может, уже хаватит?", 0xA9A9A9)
BeginToPoint(-494.0812, -163.6125, 78.3988, 1.000000, -255, true)
BeginToPoint(-512.6366, -190.9383, 78.2589, 1.000000, -255, false)
BeginToPoint(-498.5284, -152.9090, 75.4740, 1.000000, -255, true)
BeginToPoint(-512.6366, -190.9383, 78.2589, 1.000000, -255, false)
BeginToPoint(-523.4792, -152.0980, 75.4329, 1.000000, -255, true)
BeginToPoint(-512.6366, -190.9383, 78.2589, 1.000000, -255, false)
BeginToPoint(-525.3253, -130.7178, 69.7273, 1.000000, -255, true)
BeginToPoint(-512.6366, -190.9383, 78.2589, 1.000000, -255, false)
BeginToPoint(-497.5557, -116.2624, 64.8875, 1.000000, -255, true)
BeginToPoint(-512.6366, -190.9383, 78.2589, 1.000000, -255, false)
bstatus = STATUS.CARRIAGE
end
elseif rand == 2 then
return false
end
end
end
end
function ev.onShowTextDraw(id, data)
if bot.active.v then
if data.modelId == 541 or 542 or 543 then
sampSendClickTextdraw(541 or 542 or 543)
end
end
end
function imgui.OnDrawFrame()
if not bot.menu.v then imgui.Process = false end
if bot.menu.v then
local r,g,b,a = rainbow(1, 1)
local a = a / 1
local r = r / 1
local g = g / 1
local b = b / 1
local sizeX, sizeY = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 300), imgui.Cond.FirstUseEver)
imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(r, g, b, 1.00))
imgui.Begin(u8"##Loader BOT by Scar & Downesa", bot.menu, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
imgui.PushFont(font28)
imgui.CenterTextColoredRGB(("DebilBot"))
imgui.PopFont()
imgui.NewLine()
imgui.PushStyleColor(imgui.Col.Text, imgui.ImVec4(0.86, 0.93, 0.89, 1.00))
imgui.BeginChild(u8"##Child", imgui.ImVec2(384, 200), true)
imgui.NewLine()
imgui.PushFont(font24)
imgui.PushItemWidth(366)
imgui.InputInt(u8"##laps", bot.laps)
imgui.PopItemWidth()
imgui.NewLine()
imgui.NewLine()
if not bot.active.v then
if imgui.Button(u8"Включить", imgui.ImVec2(366, 45)) then
bot.active.v = not bot.active.v
bstatus = STATUS.CARRIAGE
stat.laps_all = 0
end
else
if imgui.Button(u8"Выключить", imgui.ImVec2(366, 45)) then
bot.active.v = not bot.active.v
bstatus = 0
stat.laps_all = 0
end
end
imgui.PopFont()
imgui.NewLine()
imgui.EndChild("##Child")
imgui.PopStyleColor(1)
imgui.End()
imgui.PopStyleColor(1)
end
end
function rainbow(speed, alpha)
return math.floor(math.sin(os.clock() * speed) * 127 + 128), math.floor(math.sin(os.clock() * speed + 2) * 127 + 128), math.floor(math.sin(os.clock() * speed + 4) * 127 + 128), alpha
end
function join_argb(a, r, g, b)
local argb = b
argb = bit.bor(argb, bit.lshift(g, 8))
argb = bit.bor(argb, bit.lshift(r, 16))
argb = bit.bor(argb, bit.lshift(a, 24))
return argb
end
function imgui.TextColoredRGB(text)
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 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 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 renderLine(x2, y2, z2)
if isPointOnScreen(x2, y2, z2, 0.0) then
local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
local x3, y3 = convert3DCoordsToScreen(x1, y1, z1)
local x4, y4 = convert3DCoordsToScreen(x2, y2, z2)
renderDrawLine(x3, y3, x4, y4, 3, 0xFFDC2B2B)
renderDrawPolygon(x3, y3, 8, 8, 16, 0.0, 0xFFDC2B2B)
renderDrawPolygon(x4, y4, 8, 8, 16, 0.0, 0xFFDC2B2B)
end
end
--RUN
function BeginToPoint(x, y, z, radius, move_code, isSprint)
repeat
local posX, posY, posZ = GetCoordinates()
local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
setAngle(x, y, dist, 0.1)
MovePlayer(move_code, isSprint)
wait(0)
until not bot.active.v or dist < radius --вот оно
end
function GetCoordinates()
if isCharInAnyCar(playerPed) then
local car = storeCarCharIsInNoSave(playerPed)
return getCarCoordinates(car)
else
return getCharCoordinates(playerPed)
end
end
function setAngle(x, y, distance, speed)
local source_x = fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))
local source_z = fix(representIntAsFloat(readMemory(0xB6F258, 4, false))) + math.pi
local angle = GetAngleBeetweenTwoPoints(x,y) - source_z - math.pi
if distance > 1.8 then
if angle > -0.1 and angle < 0.03 then setCameraPositionUnfixed(-0.3, GetAngleBeetweenTwoPoints(x,y))
elseif angle < -5.7 and angle > -5.93 then setCameraPositionUnfixed(-0.3, GetAngleBeetweenTwoPoints(x,y))
elseif angle < -6.0 and angle > -6.4 then setCameraPositionUnfixed(-0.3, GetAngleBeetweenTwoPoints(x,y))
elseif angle > 0.04 then setCameraPositionUnfixed(-0.3, fix(representIntAsFloat(readMemory(0xB6F258, 4, false)))+speed)
elseif angle < -3.5 and angle > -5.67 then setCameraPositionUnfixed(-0.3, fix(representIntAsFloat(readMemory(0xB6F258, 4, false)))+speed)
else setCameraPositionUnfixed(-0.3, fix(representIntAsFloat(readMemory(0xB6F258, 4, false)))-speed)
end
else setCameraPositionUnfixed(source_x, GetAngleBeetweenTwoPoints(x,y)) end
end
function fix(angle)
while angle > math.pi do
angle = angle - (math.pi*2)
end
while angle < -math.pi do
angle = angle + (math.pi*2)
end
return angle
end
function GetAngleBeetweenTwoPoints(x2,y2)
local x1, y1, z1 = getCharCoordinates(playerPed)
local plus = 0.0
local mode = 1
if x1 < x2 and y1 > y2 then plus = math.pi/2; mode = 2; end
if x1 < x2 and y1 < y2 then plus = math.pi; end
if x1 > x2 and y1 < y2 then plus = math.pi*1.5; mode = 2; end
local lx = x2 - x1
local ly = y2 - y1
lx = math.abs(lx)
ly = math.abs(ly)
if mode == 1 then ly = ly/lx;
else ly = lx/ly; end
ly = math.atan(ly)
ly = ly + plus
return ly
end
function MovePlayer(move_code, isSprint, isJumping)
setGameKeyState(1, move_code)
--[[255 - пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ
-255 - пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
65535 - пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
-65535 - пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ]]
lua_thread.create(function()
if isJumping then
local rand = math.random(0, 9999999);
if rand >= 9909999 then
isSprint = false
setGameKeyState(14, 255);
wait(200)
isSprint = true
end
end
end)
if isSprint then setGameKeyState(16, 25) end
end
function bluetheme()
imgui.SwitchContext()
local colors = imgui.GetStyle().Colors;
local icol = imgui.Col
local ImVec4 = imgui.ImVec4
imgui.GetStyle().WindowPadding = imgui.ImVec2(8, 1)
imgui.GetStyle().WindowRounding = 16.0
imgui.GetStyle().FramePadding = imgui.ImVec2(1, 3)
imgui.GetStyle().ItemSpacing = imgui.ImVec2(1, 4)
imgui.GetStyle().ItemInnerSpacing = imgui.ImVec2(1, 1)
imgui.GetStyle().IndentSpacing = 9.0
imgui.GetStyle().ScrollbarSize = 1.0
imgui.GetStyle().ScrollbarRounding = 116.0
imgui.GetStyle().GrabMinSize = 7.0
imgui.GetStyle().GrabRounding = 6.0
imgui.GetStyle().ChildWindowRounding = 9.0
imgui.GetStyle().FrameRounding = 9.0
colors[icol.Text] = ImVec4(0.90, 0.90, 0.90, 1.00);
colors[icol.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00);
colors[icol.WindowBg] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.ChildWindowBg] = ImVec4(0.13, 0.13, 0.13, 1.00);
colors[icol.PopupBg] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.Border] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.BorderShadow] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.FrameBg] = ImVec4(0.04, 0.04, 0.04, 0.59);
colors[icol.FrameBgHovered] = ImVec4(0.04, 0.04, 0.04, 0.88);
colors[icol.FrameBgActive] = ImVec4(0.28, 0.5, 1.00, 1.00);
colors[icol.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.TitleBgActive] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.TitleBgCollapsed] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.MenuBarBg] = ImVec4(0.04, 0.04, 0.04, 0.75);
colors[icol.ScrollbarBg] = ImVec4(0.04, 0.0, 0.04, 1.00);
colors[icol.ScrollbarGrab] = ImVec4(0.04, 0.04, 0.04, 0.68);
colors[icol.ScrollbarGrabHovered] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.ScrollbarGrabActive] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.ComboBg] = ImVec4(0.04, 0.04, 0.04, 0.79);
colors[icol.CheckMark] = ImVec4(1.000, 0.000, 0.000, 1.000)
colors[icol.SliderGrab] = ImVec4(0.03, 0.04, 0.04, 1.000)
colors[icol.SliderGrabActive] = ImVec4(0.66, 0.66, 0.66, 1.00);
colors[icol.Button] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.ButtonHovered] = ImVec4(0.04, 0.04, 0.04, 0.59);
colors[icol.ButtonActive] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.Header] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.HeaderHovered] = ImVec4(0.04, 0.04, 0.04, 0.74);
colors[icol.HeaderActive] = ImVec4(0.04, 0.04, 0.04, 1.00);
colors[icol.Separator] = ImVec4(0.37, 0.37, 0.37, 1.00);
colors[icol.SeparatorHovered] = ImVec4(0.60, 0.60, 0.70, 1.00);
colors[icol.SeparatorActive] = ImVec4(0.70, 0.70, 0.90, 1.00);
colors[icol.ResizeGrip] = ImVec4(1.00, 1.00, 1.00, 0.30);
colors[icol.ResizeGripHovered] = ImVec4(1.00, 1.00, 1.00, 0.60);
colors[icol.ResizeGripActive] = ImVec4(1.00, 1.00, 1.00, 0.90);
colors[icol.CloseButton] = ImVec4(0.00, 0.00, 0.00, 0.00);
colors[icol.CloseButtonHovered] = ImVec4(0.00, 0.00, 0.00, 0.60);
colors[icol.CloseButtonActive] = ImVec4(0.35, 0.35, 0.35, 1.00);
colors[icol.PlotLines] = ImVec4(1.00, 1.00, 1.00, 1.00);
colors[icol.PlotLinesHovered] = ImVec4(0.90, 0.70, 0.00, 1.00);
colors[icol.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00);
colors[icol.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00);
colors[icol.TextSelectedBg] = ImVec4(0.00, 0.00, 1.00, 0.00);
colors[icol.ModalWindowDarkening] = ImVec4(0.20, 0.20, 0.20, 0.35);
end
bluetheme()