Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/56791/
- script_version("1.0.4")
- require "lib.sampfuncs"
- require "lib.moonloader"
- script_properties("work-in-pause")
- local sampev = require 'lib.samp.events'
- local encoding = require 'encoding'
- local inicfg = require 'inicfg'
- encoding.default = 'CP1251'
- u8 = encoding.UTF8
- local imgui = require 'imgui'
- local vkeys = require 'vkeys'
- local memory = require "memory"
- local ip = 'ws://45.140.167.12:27801'
- local websocket = ''
- local client =''
- websocket = require 'websocket'
- client = websocket.client.copas({timeout = 2})
- local ffi = require("ffi")
- ffi.cdef[[
- int __stdcall GetVolumeInformationA(
- const char* lpRootPathName,
- char* lpVolumeNameBuffer,
- uint32_t nVolumeNameSize,
- uint32_t* lpVolumeSerialNumber,
- uint32_t* lpMaximumComponentLength,
- uint32_t* lpFileSystemFlags,
- char* lpFileSystemNameBuffer,
- uint32_t nFileSystemNameSize
- );
- ]]
- local serial = ffi.new("unsigned long[1]", 0)
- ffi.C.GetVolumeInformationA(nil, nil, 0, serial, nil, nil, nil, 0)
- serial = serial[0]
- local fa = require 'fAwesome5'
- imgui.ToggleButton = require('imgui_addons').ToggleButton
- local fa_font = nil
- local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
- local cord = {}
- local random_place = {}
- local movestatus = false
- local gopress = false
- local status = false
- local txd_time = false
- local txd_close_id = -1
- local txd_applecount = 0
- local current_tree = -1
- local last_apple = {}
- local home_cord = {}
- local treecord = {}
- local post_reise = 0
- local pause = false
- local fruit_model = {}
- local txd_status = false
- local mouse_state = false
- local iScreenWidth, iScreenHeight = getScreenResolution()
- ------------------IMGUI--------------------
- local imgui_window_hud = imgui.ImBool(false)
- local imgui_window_menu = imgui.ImBool(false)
- local select_button = 1
- ------------------IMGUI--------------------
- -----------------CONFIG--------------------
- local inicfg = require 'inicfg'
- if not doesFileExist('moonloader\\config\\FruitBot\\FruitBot.ini') then
- if not doesDirectoryExist('moonloader\\config\\FruitBot') then
- createDirectory('moonloader\\config\\FruitBot')
- end
- local ini =
- {
- config =
- {
- aafk = false,
- sun_trees = false,
- remove_trees = false,
- manual_mode = false,
- vk_send_admin = true,
- vk_send_report = true,
- cfg_hud = true,
- mode = 'Apple'
- }
- }
- inicfg.save(ini, 'FruitBot\\FruitBot')
- end
- local directIni = 'moonloader\\config\\FruitBot\\FruitBot.ini'
- local mainIni = inicfg.load(nil, directIni)
- local cfg_remove_trees = imgui.ImBool((mainIni.config.cfg_remove_trees==true))
- local cfg_aafk = imgui.ImBool((mainIni.config.cfg_aafk==true))
- local cfg_sun_trees = imgui.ImBool((mainIni.config.cfg_sun_trees==true))
- local cfg_int_maxreise = imgui.ImInt((mainIni.config.cfg_int_maxreise and mainIni.config.cfg_int_maxreise or 10))
- local cfg_manual_mode = imgui.ImBool((mainIni.config.cfg_manual_mode == true))
- local cfg_vk_send_report = imgui.ImBool((mainIni.config.cfg_vk_send_report == true))
- local cfg_vk_send_admin = imgui.ImBool((mainIni.config.cfg_vk_send_admin == true))
- local cfg_hud = imgui.ImBool((mainIni.config.cfg_hud == true))
- local vk_send_cd = imgui.ImBool((mainIni.config.vk_send_cd == true))
- local vk_int_send_cd = imgui.ImInt((mainIni.config.vk_int_send_cd and mainIni.config.vk_int_send_cd or 5))
- local cfg_eat_msg = imgui.ImBool((mainIni.config.cfg_eat_msg == true))
- local mode = mainIni.config.mode
- -----------------CONFIG--------------------
- local bool_random = {true,false}
- ------------------STATS--------------------
- local stats = {
- money = 0,
- reise = 0,
- apple = 0,
- status = 'Ожидание...'
- }
- --------- 46---------STATS--------------------
- function main()
- repeat wait(0) until isSampAvailable()
- autoupdate("No links", '['..string.upper(thisScript().name)..']: ', "No links")
- aafk(cfg_aafk.v)
- _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- user = sampGetPlayerNickname(my_id)
- local connected, err = client:connect(ip, '')
- if err then print(err) end
- if connected then
- if not connected then
- sampAddChatMessage('{B40431}[F-BOOM]{ffffff} - Ошибка соединения с сервером.',-1)
- else
- sampAddChatMessage('{5858FA}[F-BOOM]{ffffff} - Вы успешно подключились к серверу скрипта, ожидание авторизации...',-1)
- local server,port = sampGetCurrentServerAddress()
- _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- user = sampGetPlayerNickname(my_id)
- client:send(encodeJson({
- soft='fbot',
- action = 'auth',
- serial = tostring(serial),
- user = user,
- server = tostring(server)
- }))
- end
- end
- sampRegisterChatCommand('zfb', function() imgui_window_menu.v = not imgui_window_menu.v end)
- sampRegisterChatCommand('apl', function() lua_thread.create(function() getfruit() end) end)
- sampRegisterChatCommand('copymycode', function() setClipboardText(serial);sampAddChatMessage('Ваш персональный код скопирован в буфер обмена', -1) end)
- sampRegisterChatCommand('cop',function()
- local x,y,z = getCharCoordinates(playerPed)
- setClipboardText("['x'=>"..x..",'y'=>"..y..",'z'=>"..z..'],')
- end)
- lua_thread.create(function()
- while true do wait(0)
- local message, opcode = client:receive()
- if message then
- local result = decodeJson(message)
- if result['action'] == 'auth' then
- cord = result['cord']
- random_place = result['random_cord']
- home_cord = result['home_cord']
- fruit_model = result ['fruit_model']
- sampAddChatMessage('{E9967A}[F-BOT]{ffffff} - Успешная авторизация, данные о лицензии подтверждены!', -1)
- sampAddChatMessage('{E9967A}[F-BOT]{ffffff} - Осталось {E9967A}'..result['days']..'{ffffff} дней лицензии',-1)
- sampAddChatMessage('{E9967A}[F-BOT]{ffffff} - Меню бота: {E9967A}/zfb',-1)
- elseif result['action'] == 'error' then
- sampAddChatMessage('{E9967A}[F-BOT] - {ffffff}'..u8:decode(result['text']), -1)
- elseif result['action']=='ping' then
- client:send(encodeJson({action='pong'}))
- end
- end
- end
- end)
- while true do wait(0) imgui.Process = true
- if wasKeyReleased(VK_RBUTTON) and status then mouse_state = not mouse_state end
- end
- end
- function sampev.onDisplayGameText(style, time, text)
- if text:find('%d+~g~%/~w~10') and (status or cfg_manual_mode.v) then
- lua_thread.create(function()
- stats['apple'] = tonumber(text:match('(%d+)~g~%/~w~10'))
- if stats['apple']<10 then
- if txd_applecount == 1 then
- txd_applecount = 0
- if not cfg_manual_mode.v then start_bot() end
- else
- txd_applecount = 0
- pressf()
- end
- elseif stats['apple']==10 then
- stats['status']='Сдаю ящик'
- if not cfg_manual_mode.v then
- if mode == 'Apple' then BeginToPoint(1915,174,37, 1.5, -255,bool_random[math.random(#bool_random)]) end
- BeginToPoint(home_cord[mode]['x'],home_cord[mode]['y'],home_cord[mode]['z'], 0.5, -255, bool_random[math.random(#bool_random)])
- end
- end
- end)
- return false
- end
- end
- function start_bot()
- stats['status']='Поиск фрукта...'
- local object = 0
- while object==0 and status do wait(0)
- local marsh = math.random(#random_place[mode])
- for i=1 ,#random_place[mode] do
- object,x,y,z = getfruit()
- if object ~= 0 then -- Если нашли
- last_apple = object
- -- print(result)
- stats['status']='Поиск дерева...'
- runToTreefromOrange(x,y,z)
- pressf()
- while not txd_status and status do wait(1000) if txd_status == false then txd_status = false else pressf() end end
- break
- elseif status then
- local place = random_place[mode][marsh][i][math.random(#random_place[mode][marsh][i])]
- BeginToPoint(place['x'],place['y'],place['z'], 1.5, -255,bool_random[math.random(#bool_random)])
- end
- end
- wait(5000)
- end
- end
- function sampev.onShowTextDraw(id,data)
- if (data.text == 'Apple' and (status or cfg_manual_mode.v) ) then
- txd_lock = 0
- txd_applecount = txd_applecount+1
- if data.position.y > 200 then
- txd_lock = 1
- txd_close_id = -1
- sampSendClickTextdraw(id)
- stats['status']='Собираю'
- end
- -- return false
- elseif (data.text=='Close') and (status or cfg_manual_mode.v) then
- txd_status = true
- gopress = true
- txd_close_id = id
- lua_thread.create(function()
- wait(500)
- if txd_applecount == 0 then
- sampSendClickTextdraw(txd_close_id)
- if not cfg_manual_mode.v then start_bot() end
- elseif txd_applecount > 0 and txd_close_id>0 then
- sampSendClickTextdraw(txd_close_id)
- txd_applecount = 0
- txd_close_id = 0
- wait(300)
- pressf()
- end
- end)
- -- return false
- elseif ((data.text=='New Textdraw' or data.text:find('KG') or data.text=='Orange' or data.text=='_') and status ) then
- -- return false
- end
- end
- function sampev.onCreateObject(id,data)
- if data.modelId==1437 and status then
- return false
- end
- end
- function sampev.onServerMessage(color,text)
- if text:find('%{33AA33%}Вы получили %{FFFFFF%}%d+') then
- stats['money'] = tonumber(text:match('%{33AA33%}Вы получили %{FFFFFF%}(%d+)'))+stats['money']
- stats['reise'] = stats['reise']+1
- stats['apple'] = 0
- if stats['reise'] < cfg_int_maxreise.v then
- if not cfg_manual_mode.v and status then
- if vk_send_cd.v then
- post_reise = post_reise+1
- if post_reise == vk_int_send_cd.v then
- sendvkmessage('👌 [F-BOT] | '..sampGetPlayerNickname(my_id)..'<br>Состояние: '..stats['reise']..'/'..cfg_int_maxreise.v..'<br>Заработано: '..stats['money']..'$')
- post_reise=0
- end
- end
- lua_thread.create(function()
- if mode == 'Apple' then BeginToPoint(1919,184,36, 1.5, -255, bool_random[math.random(#bool_random)]) else BeginToPoint(1789.6571044922,168,31, 1.5, -255, bool_random[math.random(#bool_random)]) end
- start_bot()
- end)
- end
- else
- sampAddChatMessage('Задача выполнена', -1)
- if cfg_vk_send_report.v then
- local _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- sendvkmessage('💰 [F-BOT] | '..sampGetPlayerNickname(my_id)..'<br>Завершил задание: '..stats['reise']..'/'..cfg_int_maxreise.v..'<br>Заработано: '..stats['money']..'$')
- end
- end
- elseif text == '• {FFC800}[Подсказка] {ffffff}Вы проголодались, посетите закусочную или бар' and cfg_eat_msg.v then
- local _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- sendvkmessage('🍕 [F-BOT] | '..sampGetPlayerNickname(my_id)..'<br>Осталось мало еды, холопа кормить пора!')
- elseif text:find('%{FFC800%}%[Подсказка%] %{ffffff%}Нажмите на %{FF3300%}Enter%{FFFFFF%}') and status and getDistanceBetweenCoords3d(treecord['x'],treecord['y'], treecord['z'],getCharCoordinates(playerPed))<2 then
- movestatus = false
- pressf()
- elseif text:find('Администратор [A-Za-z_%d+]+%[%d+%]:') and cfg_vk_send_admin.v then
- local _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- sendvkmessage('[F-BOT] | '..sampGetPlayerNickname(my_id)..'<br>Пишет администратор: '..text)
- end
- end
- function runToTreefromOrange(x,y,z)
- treecord = {}
- local min_dist = 1000
- for k, v in pairs(cord[mode]) do
- local dis = getDistanceBetweenCoords3d(x,y,z,v['x'],v['y'],v['z'])
- if dis < min_dist then
- treecord = {x=v['x'],y=v['y'],z=v['z']}
- min_dist = dis
- current_tree = k
- end
- end
- if (getDistanceBetweenCoords3d(x,y,z,getCharCoordinates(playerPed))>1.3) then
- stats['status']='Двигаюсь к дереву'
- createPickup(19605, 8, treecord['x'],treecord['y'], treecord['z'])
- BeginToPoint(treecord['x'],treecord['y'], treecord['z'], 0.3, -255, false)
- wait(300)
- pressf()
- end
- end
- function imgui.BeforeDrawFrame()
- if fa_font == nil then
- local font_config = imgui.ImFontConfig() -- to use 'imgui.ImFontConfig.new()' on error
- font_config.MergeMode = true
- fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fa-solid-900.ttf', 33.0, font_config, fa_glyph_ranges)
- end
- end
- function imgui.OnDrawFrame()
- if imgui_window_menu.v or mouse_state then imgui.ShowCursor = true else imgui.ShowCursor = false end
- if status then
- imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth-30, iScreenHeight/2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(100, 100), imgui.Cond.FirstUseEver)
- imgui.PushStyleColor(imgui.Col.WindowBg, imgui.ImVec4(0.0, 0.0, 0.0, 0.01))
- imgui.Begin(u8'Pause',-1, imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize+imgui.WindowFlags.NoMove+imgui.WindowFlags.NoTitleBar)
- if imgui.Button('\n'..(pause and fa.ICON_FA_PLAY_CIRCLE or fa.ICON_FA_PAUSE),imgui.ImVec2(60, 55)) then pause = not pause end
- imgui.End()
- imgui.PopStyleColor()
- end
- if imgui_window_menu.v then
- imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth/2, iScreenHeight/2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(530, 190), imgui.Cond.FirstUseEver)
- imgui.Begin(u8'FB',-1, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize+imgui.WindowFlags.NoTitleBar)
- imgui.Columns(2,nil,false)
- if imgui.Button('\n'..fa.ICON_FA_USER_COG,imgui.ImVec2(60, 55)) then select_button = 1
- elseif imgui.Button('\n'..fa.ICON_FA_BELL,imgui.ImVec2(60, 55)) then select_button = 2
- elseif imgui.Button('\n'..fa.ICON_FA_POWER_OFF,imgui.ImVec2(60, 55)) then imgui_window_menu.v = false end
- imgui.SetColumnWidth(-1, 75)
- imgui.NextColumn()
- if select_button==2 then
- imgui.CenterColumnText(u8'Сообщения ВКонтакте')
- if imgui.ToggleButton("vk_admin", cfg_vk_send_admin) then mainIni.config.cfg_vk_send_admin = cfg_vk_send_admin.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Если админ пишет")
- if imgui.ToggleButton("vk_report", cfg_vk_send_report) then mainIni.config.cfg_vk_send_report = cfg_vk_send_report.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Отчёт по завершению задания")
- if imgui.ToggleButton("vk_report_cd", vk_send_cd) then mainIni.config.vk_send_cd = vk_send_cd.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Сообщать состояние каждые")
- imgui.SameLine()
- imgui.PushItemWidth(100)
- if imgui.InputInt(u8'рейсов',vk_int_send_cd) then mainIni.config.vk_int_send_cd = vk_int_send_cd.v ; inicfg.save(mainIni, directIni) end
- if imgui.ToggleButton("eat_msg", cfg_eat_msg) then mainIni.config.cfg_eat_msg = cfg_eat_msg.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Если пора жрать")
- elseif select_button==1 then
- if imgui.InputInt(u8'Необходимо кругов',cfg_int_maxreise) then mainIni.config.cfg_int_maxreise = cfg_int_maxreise.v ; inicfg.save(mainIni, directIni) end
- imgui.NewLine()
- if not cfg_manual_mode.v then
- if imgui.ToggleButton("Trees", cfg_remove_trees) then mainIni.config.cfg_remove_trees = cfg_remove_trees.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Удалять деревья и лестницы")
- if imgui.ToggleButton("sun", cfg_sun_trees) then mainIni.config.cfg_sun_trees = cfg_sun_trees.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Подсветка ближ. дерева")
- if imgui.ToggleButton("aafk", cfg_aafk) then aafk(cfg_aafk.v); mainIni.config.cfg_aafk = cfg_aafk.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Анти-АФК")
- end
- if imgui.ToggleButton("hud", cfg_hud) then mainIni.config.cfg_hud = cfg_hud.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Инфо-худ")
- if imgui.ToggleButton("mmode", cfg_manual_mode) then mainIni.config.cfg_manual_mode = cfg_manual_mode.v ; inicfg.save(mainIni, directIni) end
- imgui.SameLine()
- imgui.Text(u8"Ручной режим")
- imgui.SetCursorPos(imgui.ImVec2(280, 125))
- if mode == 'Apple' then
- imgui.Button('\n'..fa.ICON_FA_APPLE_ALT..'\nApple',imgui.ImVec2(60, 55))
- else
- imgui.PushStyleColor(imgui.Col.Button, imgui.ImColor(0.14, 0.12, 0.16, 0):GetVec4())
- if imgui.Button('\n'..fa.ICON_FA_APPLE_ALT..u8'\nApple' ,imgui.ImVec2(60, 55)) then
- mode = 'Apple'
- mainIni.config.mode = mode ; inicfg.save(mainIni, directIni)
- end
- imgui.PopStyleColor()
- end
- imgui.SameLine()
- if mode == 'Orange' then
- imgui.Button('\n'..fa.ICON_FA_CIRCLE..u8'\nOrange',imgui.ImVec2(60, 55))
- else
- imgui.PushStyleColor(imgui.Col.Button, imgui.ImColor(0.14, 0.12, 0.16, 0):GetVec4())
- if imgui.Button('\n'..fa.ICON_FA_CIRCLE..u8'\nOrange' ,imgui.ImVec2(60, 55)) then
- mode = 'Orange'
- mainIni.config.mode = mode ; inicfg.save(mainIni, directIni)
- end
- imgui.PopStyleColor()
- end
- imgui.SetCursorPos(imgui.ImVec2(460, 125))
- if imgui.Button('\n'..(status and fa.ICON_FA_PAUSE or fa.ICON_FA_PLAY_CIRCLE),imgui.ImVec2(60, 55)) then
- lua_thread.create(function()
- start_status()
- end)
- end
- end
- imgui.End()
- end
- if cfg_hud.v then
- imgui.SetNextWindowPos(imgui.ImVec2(iScreenWidth-130, iScreenHeight-60), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
- imgui.SetNextWindowSize(imgui.ImVec2(230, 105), imgui.Cond.FirstUseEver)
- imgui.Begin(u8'FRUIT BOOM ['..thisScript().version..']',-1, imgui.WindowFlags.ShowBorders+imgui.WindowFlags.NoCollapse+imgui.WindowFlags.NoResize)
- imgui.SetCursorPos(imgui.ImVec2(0, 25))
- imgui.Columns(2)
- imgui.SetColumnWidth(-1, 180)
- imgui.Text(u8'Круги:')
- imgui.Text(u8'Фрукты:')
- imgui.Text(u8'Деньги:')
- imgui.NextColumn()
- imgui.Text(tostring(stats['reise'])..'/'.. cfg_int_maxreise.v )
- imgui.Text(stats['apple']..'/10')
- imgui.Text(tostring(stats['money'])..'$')
- imgui.Columns(1)
- imgui.Separator()
- imgui.CenterText(u8:encode(stats['status']))
- imgui.End()
- end
- end
- function imgui.CenterText(text)
- imgui.SetCursorPosX((imgui.GetWindowSize().x/2) - (imgui.CalcTextSize(text).x / 2))
- imgui.Text(text)
- end
- function BeginToPoint(x, y, z, radius, move_code, isSprint)
- movestatus = true
- repeat
- local posX, posY, posZ = GetCoordinates()
- set_camera_pos_unfix(x, y,0)
- MovePlayer(move_code, isSprint)
- local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
- while pause do wait(1) end
- wait(0)
- until (dist < radius) or not movestatus
- gopress = false
- if move_code == -255 then
- setVirtualKeyDown(VK_SPACE, false)
- end
- end
- function MovePlayer(move_code, isSprint)
- setGameKeyState(1, move_code)
- if isSprint then setGameKeyState(16, 255) end
- end
- function GetCoordinates()
- if isCharInAnyCar(playerPed) then
- local car = storeCarCharIsInNoSave(playerPed)
- return getCarCoordinates(car)
- else
- return getCharCoordinates(playerPed)
- end
- end
- function SetAngle(x, y, z)
- local posX, posY, posZ = GetCoordinates()
- local pX = x - posX
- local pY = y - posY
- local zAngle = getHeadingFromVector2d(pX, pY)
- if isCharInAnyCar(playerPed) then
- local car = storeCarCharIsInNoSave(playerPed)
- setCarHeading(car, zAngle)
- else
- setCharHeading(playerPed,zAngle)
- end
- restoreCameraJumpcut()
- end
- function set_camera_pos_unfix(posX, posY)
- local cPosX, cPosY, cPosZ = getActiveCameraCoordinates()
- setCameraPositionUnfixed(0.0, (getHeadingFromVector2d(posX - cPosX, posY - cPosY) - 91.0) / 57.2957795)
- end
- function aafk(aafkstat)
- if aafkstat then
- writeMemory(7634870, 1, 1, 1)
- writeMemory(7635034, 1, 1, 1)
- memory.fill(7623723, 144, 8)
- memory.fill(5499528, 144, 6)
- else
- writeMemory(7634870, 1, 0, 0)
- writeMemory(7635034, 1, 0, 0)
- memory.hex2bin('5051FF1500838500', 7623723, 8)
- memory.hex2bin('0F847B010000', 5499528, 6)
- 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 = 4.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.48, 0.16, 0.16, 0.54)
- colors[clr.FrameBgHovered] = ImVec4(0.98, 0.26, 0.26, 0.40)
- colors[clr.FrameBgActive] = ImVec4(0.98, 0.26, 0.26, 0.67)
- colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
- colors[clr.TitleBgActive] = ImVec4(0.48, 0.16, 0.16, 1.00)
- colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
- colors[clr.CheckMark] = ImVec4(0.98, 0.26, 0.26, 1.00)
- colors[clr.SliderGrab] = ImVec4(0.88, 0.26, 0.24, 1.00)
- colors[clr.SliderGrabActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
- colors[clr.Button] = ImVec4(0.98, 0.26, 0.26, 0.40)
- colors[clr.ButtonHovered] = ImVec4(0.98, 0.26, 0.26, 1.00)
- colors[clr.ButtonActive] = ImVec4(0.98, 0.06, 0.06, 1.00)
- colors[clr.Header] = ImVec4(0.98, 0.26, 0.26, 0.31)
- colors[clr.HeaderHovered] = ImVec4(0.98, 0.26, 0.26, 0.80)
- colors[clr.HeaderActive] = ImVec4(0.98, 0.26, 0.26, 1.00)
- colors[clr.Separator] = colors[clr.Border]
- colors[clr.SeparatorHovered] = ImVec4(0.75, 0.10, 0.10, 0.78)
- colors[clr.SeparatorActive] = ImVec4(0.75, 0.10, 0.10, 1.00)
- colors[clr.ResizeGrip] = ImVec4(0.98, 0.26, 0.26, 0.25)
- colors[clr.ResizeGripHovered] = ImVec4(0.98, 0.26, 0.26, 0.67)
- colors[clr.ResizeGripActive] = ImVec4(0.98, 0.26, 0.26, 0.95)
- colors[clr.TextSelectedBg] = ImVec4(0.98, 0.26, 0.26, 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
- apply_custom_style()
- function imgui.CenterColumnText(text)
- imgui.SetCursorPosX((imgui.GetColumnOffset() + (imgui.GetColumnWidth() / 2)) - imgui.CalcTextSize(text).x / 2)
- imgui.Text(text)
- end
- function start_status()
- status = not status
- if status then
- if (cfg_remove_trees.v) then
- for k, v in pairs(getAllObjects()) do
- if getObjectModel(v) == 673 then
- deleteObject(v)
- end
- end
- end
- start_bot()
- else
- movestatus = false
- end
- end
- function pressf()
- local data = samp_create_sync_data('player')
- data.keysData = data.keysData + 16
- data.send()
- end
- function samp_create_sync_data(sync_type, copy_from_player)
- local ffi = require 'ffi'
- local sampfuncs = require 'sampfuncs'
- local raknet = require 'samp.raknet'
- require 'samp.synchronization'
- copy_from_player = copy_from_player or true
- local sync_traits = {
- player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
- vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
- passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
- aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
- trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
- unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
- bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
- spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
- }
- local sync_info = sync_traits[sync_type]
- local data_type = 'struct ' .. sync_info[1]
- local data = ffi.new(data_type, {})
- local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
- -- copy player's sync data to the allocated memory
- if copy_from_player then
- local copy_func = sync_info[3]
- if copy_func then
- local _, player_id
- if copy_from_player == true then
- _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- else
- player_id = tonumber(copy_from_player)
- end
- copy_func(player_id, raw_data_ptr)
- end
- end
- -- function to send packet
- local func_send = function()
- local bs = raknetNewBitStream()
- raknetBitStreamWriteInt8(bs, sync_info[2])
- raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
- raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
- raknetDeleteBitStream(bs)
- end
- -- metatable to access sync data and 'send' function
- local mt = {
- __index = function(t, index)
- return data[index]
- end,
- __newindex = function(t, index, value)
- data[index] = value
- end
- }
- return setmetatable({send = func_send}, mt)
- end
- function sendvkmessage(text)
- _, my_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
- user = sampGetPlayerNickname(my_id)
- local result,code,err_msg = client:send(encodeJson({soft='fbot',
- action='vk',
- serial = tostring(serial),
- user=tostring(user),
- text=u8:encode(tostring(text))}))
- if not result then
- print('ERROR VK MESS: '..err_msg)
- end
- end
- function autoupdate(json_url, prefix, url)
- local dlstatus = require('moonloader').download_status
- local json = getWorkingDirectory() .. '\\'..thisScript().name..'-version.json'
- if doesFileExist(json) then os.remove(json) end
- downloadUrlToFile(json_url, json,
- function(id, status, p1, p2)
- if status == dlstatus.STATUSEX_ENDDOWNLOAD then
- if doesFileExist(json) then
- local f = io.open(json, 'r')
- if f then
- local info = decodeJson(f:read('*a'))
- updatelink = info.updateurl
- updateversion = info.latest
- f:close()
- os.remove(json)
- if updateversion ~= thisScript().version then
- lua_thread.create(function(prefix)
- local dlstatus = require('moonloader').download_status
- local color = -1
- wait(250)
- downloadUrlToFile(updatelink, thisScript().path,
- function(id3, status1, p13, p23)
- if status1 == dlstatus.STATUS_DOWNLOADINGDATA then
- print(string.format('Загружено %d из %d.', p13, p23))
- elseif status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
- print('Загрузка обновления завершена.')
- goupdatestatus = true
- lua_thread.create(function() wait(500) thisScript():reload() end)
- end
- if status1 == dlstatus.STATUSEX_ENDDOWNLOAD then
- if goupdatestatus == nil then
- update = false
- end
- end
- end
- )
- end, prefix
- )
- else
- update = false
- end
- end
- else
- print('v'..thisScript().version..': Не могу проверить обновление. Смиритесь или проверьте самостоятельно на '..url)
- update = false
- end
- end
- end
- )
- while update ~= false do wait(100) end
- end
- function getfruit()
- local object = 0
- local min_dis = 1000
- local min_cord = {}
- local result,x,y,z = false,nil,nil,nil
- for k, v in ipairs(getAllObjects()) do
- if (getObjectModel(v) == fruit_model[mode]) and last_apple ~= v then
- result,x,y,z = getObjectCoordinates(v)
- local dis = getDistanceBetweenCoords3d(x,y,z,getCharCoordinates(playerPed))
- if dis<min_dis then
- min_dis = dis
- object = v
- min_cord = {x=x,y=y,z=z}
- end
- end -- ищем яблоко
- end
- return object,min_cord['x'],min_cord['y'],min_cord['z']
- end
Advertisement
Add Comment
Please, Sign In to add comment