SlonPvpru

[DRP] FishBot HellsCoder v2.0

Jun 4th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.59 KB | None | 0 0
  1. -- https://www.blast.hk/threads/22020/
  2.  
  3. script_name("FisherBot")
  4. script_description("FisherBot for DRP")
  5. script_version("2.0")
  6.  
  7.  
  8. local hook = require("lib.samp.events")
  9. local keys = require("lib.game.keys")
  10. local http = require("lib.requests")
  11.  
  12. local encoding = require('lib.encoding')
  13. u8 = encoding.UTF8
  14. cp1251 = encoding.CP1251
  15.  
  16. local lanes = require("lib.lanes").configure()
  17.  
  18. local error_leaver = 0
  19.  
  20. local last_thread_chat = ""
  21. local last_thread_two = ""
  22.  
  23. local buffer_reading = 0
  24. local buffer_width = 0
  25.  
  26. local bot_key = "kajdju9s87991hs7a8910"
  27. local url_feed = "Ссылка на сайт"
  28.  
  29. local quest = {
  30.     {
  31.         quest = "вы тут",
  32.         data = {
  33.             "да, а что?",
  34.             "да, здесь",
  35.             "ну да",
  36.             "тута",
  37.             "тут я, тут"
  38.         },
  39.         last_params = {
  40.             "да тут я, тут, че пристали то",
  41.             "хаха, на бота чтоль проверяете?",
  42.             "ну вы даете, тут я)"
  43.         }
  44.     },
  45.     {
  46.         quest = "ты тут",
  47.         data = {
  48.             "да, а что?",
  49.             "да, здесь",
  50.             "ну да",
  51.             "тута",
  52.             "тут я, тут"
  53.         },
  54.         last_params = {
  55.             "да тут я, тут, че пристали то",
  56.             "хаха, на бота чтоль проверяете?",
  57.             "ну вы даете, тут я)"
  58.         }
  59.     },
  60.     {
  61.         quest = "го сети",
  62.         data = {
  63.             "нее, спасибо",
  64.             "да не( мало там",
  65.             "лучше так ловить, там мало платят"
  66.         },
  67.         last_params = {
  68.             "нее, чувак, не)",
  69.             "спасибо, нееее)"
  70.         }
  71.     },
  72.     {
  73.         quest = "линберг",
  74.         data = {
  75.             "что такое?",
  76.             "ааа",
  77.             "ммм"
  78.         },
  79.         last_params = {
  80.             "да че",
  81.             "???"
  82.         }      
  83.     },
  84.     {
  85.         quest = "покажите лицензии",
  86.         data = {
  87.             "/fishbot",
  88.             "/fishbot",
  89.             "/fishbot"
  90.         },
  91.         last_params = {
  92.             "опа",
  93.             "/q"
  94.         }      
  95.     },  
  96.     {
  97.         quest = "энкор",
  98.         data = {
  99.             "что такое?",
  100.             "ааа",
  101.             "ммм"
  102.         },
  103.         last_params = {
  104.             "да че",
  105.             "???"
  106.         }      
  107.     }  
  108. }
  109.  
  110. local captha = {
  111.     {
  112.         quest = "Кто делает мяу мяу",
  113.         response = 4
  114.     },
  115.     {
  116.         quest = "называется наш проект",
  117.         response = 1
  118.     },
  119.     {
  120.         quest = "на какой планете",
  121.         response = 2
  122.     },
  123.     {
  124.         quest = "какое слово состоит из",
  125.         response = 3
  126.     },
  127.     {
  128.         quest = "что делают в больнице",
  129.         response = 1
  130.     },
  131.     {
  132.         quest = "на каком проекте вы играете",
  133.         response = 1
  134.     },
  135.     {
  136.         quest = "в этом списке лишний",
  137.         response = 4
  138.     },
  139.     {
  140.         quest = "фигуры нет углов",
  141.         response = 3
  142.     },
  143.     {
  144.         quest = "что делают собаки",
  145.         response = 4
  146.     },
  147.     {
  148.         quest = "цвета трава",
  149.         response = 3
  150.     }
  151. }
  152.  
  153. --DONT TOUCH
  154.  
  155. enabled = false
  156.  
  157.  
  158. color = 0xFFFFFF --byte of color code
  159.  
  160. math.randomseed(os.time())
  161.  
  162. --hook
  163.  
  164. function hook.onDisplayGameText(style, time, text)
  165.     if enabled then
  166.         lua_thread.create(
  167.             function()
  168.                 if text == "~w~Press ~r~~k~~PED_FIREWEAPON~" then
  169.                     wait(20)
  170.                     setGameKeyState(keys.player.FIREWEAPON, 255)
  171.                 elseif text == "~w~Press ~g~~k~~PED_LOCK_TARGET~" then
  172.                     wait(20)
  173.                     setGameKeyState(keys.player.LOCKTARGET, 255)
  174.                 end          
  175.             end
  176.         )
  177.     end
  178. end
  179.  
  180. function hook.onShowDialog(dialogId, style)
  181.     doCapchaResponse()
  182. end
  183.  
  184. function hook.onServerMessage(clr, text)
  185.     if enabled then
  186.         threading_chat(text)
  187.         feedback_chat(text)
  188.         if string.find(text, "Вы поймали", 0, true) ~= nil then
  189.             feedback()
  190.             text = string.gsub (text, "{00CC00}", "")
  191.             text = string.gsub(text, "{1fc41f}", "")
  192.             text = string.gsub(text, "{00cdcd}", "")
  193.             a = string.match(text, "[%+%-%d]%d*%.?%d*[eE]?[%+%-]?%d*")
  194.             sampSendChat("/fish")
  195.             buffer_width = buffer_width+a
  196.         end
  197.         if string.find(text, "Рыба сорвалась", 0, true) ~= nil then
  198.             sampSendChat("/fish")
  199.             buffer_reading = buffer_reading + 1
  200.             if buffer_reading == 3 then
  201.                 buffer_reading = 0
  202.                 sampSendChat("Да че за херня, бля")
  203.                 lua_thread.create(
  204.                     function()
  205.                         BeginToPoint(2634.0268554688, -2470.7121582031, 3.2132530212402, false);
  206.                         BeginToPoint(2633.6850585938, -2474.7092285156, 3.2164554595947, false);
  207.                         sampSendChat("/fish")              
  208.                     end
  209.                 )
  210.             end
  211.         end      
  212.     end
  213. end
  214.  
  215. --FEEDBACK
  216.  
  217. function feedback()
  218.     moneys = getPlayerMoney()
  219.     async_http_request('GET', url_feed.."/api/api.php?response=feedback&secret="..bot_key.."&money="..moneys.."&weight="..buffer_width, nil, function(response)
  220.     end, function(err)
  221.     end)  
  222. end
  223.  
  224. function feedback_chat(line)
  225.     if line ~= nil then
  226.         en_line = urlencode(u8:encode(line, 'CP1251'))
  227.         async_http_request('GET', url_feed.."/chat.php?secret="..bot_key.."&line="..en_line, nil,
  228.         function(response) end, function(err) end)  
  229.     end
  230. end
  231.  
  232. function chat_get()
  233.     async_http_request('GET', url_feed.."/api/api.php?response=chat_feedback&secret="..bot_key, nil,
  234.     function(response)
  235.         if response.text ~= nil and response.text ~= 'none' then
  236.             en_line = cp1251:encode(response.text, 'UTF8')
  237.             sampSendChat(en_line)
  238.         end
  239.     end, function(err) end)
  240. end
  241.  
  242. --text_draw_thread
  243.  
  244. function td_thread()
  245.     font = renderCreateFont('Verdana', 8, 13)
  246.     lua_thread.create(
  247.         function()
  248.             while enabled do
  249.                 wait(1)
  250.                 renderFontDrawText(font, "{2b42f0}Поймано: {00ff00}"..buffer_width, 65, 570, 0xFF00FF00)
  251.             end
  252.         end
  253.     )
  254. end
  255.  
  256. --captcha threading
  257.  
  258. function doCapchaResponse()
  259.     text = sampGetDialogText()
  260.     if string.find(text, "Вопрос", 0, true) ~= nil then --false
  261.         sampAddChatMessage("[Debug] капча передана контроллеру", color)
  262.         for k,v in pairs(captha) do
  263.             sampAddChatMessage(v.quest)
  264.             if string.find(text, v.quest, 0, true) ~= nil then --false
  265.                 sampSetCurrentDialogEditboxText(captha[k].response)
  266.                 sampCloseCurrentDialogWithButton(0)
  267.                 sampSendChat("/fish")
  268.             end
  269.         end
  270.     end
  271. end
  272.  
  273. --chat hyper threading
  274.  
  275. function threading_chat(text)
  276.     for k,v in pairs(quest) do
  277.         if string.find(text, v.quest, 0, true) then
  278.             if string.find(last_thread_chat, v.quest, 0, true) then
  279.                 lua_thread.create(
  280.                     function()
  281.                         if string.find(last_thread_two, v.quest, 0, true) == nil then
  282.                             enabled = false
  283.                             wait(1500)
  284.                             sampSendChat(quest[k].last_params[r_array(#quest[k].last_params)])
  285.                             last_thread_two = v.quest
  286.                             wait(1500)
  287.                             enabled = true
  288.                         end
  289.                     end
  290.                 )
  291.             else
  292.                 last_thread_chat = v.quest
  293.                 lua_thread.create(
  294.                     function()
  295.                         enabled = false
  296.                         wait(1500)
  297.                         sampSendChat(quest[k].data[r_array(#quest[k].data)])
  298.                         wait(3000)
  299.                         enabled = true
  300.                     end
  301.                 )              
  302.             end
  303.         end
  304.     end
  305. end
  306.  
  307. --main
  308.  
  309. function main()
  310.     while not isSampAvailable() do
  311.         wait(1000)
  312.     end
  313.     sampRegisterChatCommand("fishbot", fish)
  314.     sampRegisterChatCommand("test", feedback)
  315.     sampAddChatMessage("{2b42f0} [FishBot] {2bf038} Запускаем бот...", color)
  316.     lua_thread.create(
  317.         function()
  318.             while true do
  319.                 wait(1500)
  320.                 if enabled then
  321.                     chat_get()
  322.                 end
  323.             end
  324.         end
  325.     )
  326.     while true do
  327.         wait(0)
  328.         if enabled then
  329.             wait(200)
  330.             line = sampGetChatString(99)
  331.             line_two = line..sampGetChatString(98)
  332.             text = line_two..sampGetChatString(97)  
  333.             if string.find(text, "Вы должны быть", 0, true) ~= nil then
  334.                 BeginToPoint(2634.0268554688, -2470.7121582031, 3.2132530212402, false);
  335.                 BeginToPoint(2633.6850585938, -2474.7092285156, 3.2164554595947, false);
  336.                 sampSendChat("/fish")
  337.             end
  338.             if string.find(text, "У вас нет наживы", 0, true) ~= nil then
  339.                 BeginToPoint(2642.9084472656, -2470.2104492188, 3.2132530212402, true)
  340.                 BeginToPoint(2594.3828125, -2469.1955566406, 3.2132530212402, true)
  341.                 BeginToPoint(2593.3256835938, -2461.4375, 3.2132530212402, true)
  342.                 BeginToPoint(2620.5817871094, -2461.7172851563, 13.332517623901, true)
  343.                 BeginToPoint(2598.015625, -2435.9733886719, 13.640625, false)
  344.                 BeginToPoint(2602.4375, -2431.759765625, 13.640625, false)
  345.                 BeginToPoint(2607.3427734375, -2437.0505371094, 13.64662361145, false)
  346.                 while not sampIsDialogActive() do wait(0) end
  347.                 id = sampGetCurrentDialogId()
  348.                 sampSendDialogResponse(id, 1, 2, '')
  349.                 wait(500)
  350.                 id = sampGetCurrentDialogId()
  351.                 sampSendDialogResponse(id, 1, 1, '')
  352.                 BeginToPoint(2605.9396972656, -2435.4440917969, 13.64662361145, false)
  353.                 sampCloseCurrentDialogWithButton(0)
  354.                 BeginToPoint(2602.5026855469, -2431.9438476563, 13.640625, false)
  355.                 BeginToPoint(2597.7016601563, -2436.4470214844, 13.640625, false)
  356.                 BeginToPoint(2614.9191894531, -2461.3842773438, 12.365324020386, false)
  357.                 BeginToPoint(2592.7683105469, -2463.7416992188, 3.2132530212402, false)
  358.                 BeginToPoint(2592.0263671875, -2468.6586914063, 3.2132530212402, false)
  359.                 BeginToPoint(2641.9421386719, -2469.3994140625, 3.2132530212402, true)
  360.                 BeginToPoint(2642.109375, -2474.1716308594, 3.2164554595947, false)
  361.                 sampSendChat("/fish")
  362.             end
  363.         end
  364.     end
  365. end
  366.  
  367. --commands
  368.  
  369. function fish()
  370.     if enabled then
  371.         sampAddChatMessage("{2b42f0} [FishBot] {f02b2b} Выключен", color)
  372.         enabled = false
  373.         width_all = 0
  374.         buffer_width = 0
  375.     else
  376.         sampAddChatMessage("{2b42f0} [FishBot] {2bf038} Включен", color)
  377.         enabled = true
  378.         td_thread()
  379.     end
  380. end
  381.  
  382. --begin funcs
  383.  
  384. function BeginToPoint(x, y, z, hoop)
  385.     repeat
  386.         local posX, posY, posZ = GetCoordinates()
  387.         SetAngle(x, y, z)
  388.         local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
  389.         MovePlayer(-255, true, hoop, dist)
  390.         wait(0)
  391.     until not enabled or dist < 1.00000
  392. end
  393.  
  394. function MovePlayer(move_code, isSprint, hoop, dist)
  395.     setGameKeyState(1, move_code)
  396.     if isSprint then
  397.         if hoop then --ПОДПРЫГИВАНИЯ
  398.             if BoolRand() and dist > 10.00000 then
  399.                 setGameKeyState(14, -128)
  400.             else  
  401.                 setGameKeyState(16, 255)
  402.             end  
  403.         else
  404.             setGameKeyState(16, 255)
  405.         end
  406.     end
  407. end
  408.  
  409. function SetAngle(x, y, z)
  410.     local posX, posY, posZ = GetCoordinates()
  411.     local pX = x - posX
  412.     local pY = y - posY
  413.     local vector = getHeadingFromVector2d(pX, pY)
  414.    
  415.     zAngle = vector
  416.    
  417.     if isCharInAnyCar(playerPed) then
  418.         local car = storeCarCharIsInNoSave(playerPed)
  419.         setCarHeading(car, zAngle)
  420.     else
  421.         setCharHeading(playerPed, zAngle)
  422.     end
  423.  
  424.     restoreCameraJumpcut()
  425. end
  426.  
  427. function GetCoordinates()
  428.     if isCharInAnyCar(playerPed) then
  429.         local car = storeCarCharIsInNoSave(playerPed)
  430.         return getCarCoordinates(car)
  431.     else
  432.         return getCharCoordinates(playerPed)
  433.     end
  434. end
  435.  
  436. function BoolRand()
  437.     local rand = math.random(0, 50)
  438.     if rand == 4 then
  439.         return true
  440.     else
  441.         return false
  442.     end
  443. end
  444.  
  445. function r_array(leng)
  446.   return math.random(1, leng)
  447. end
  448.  
  449.  
  450. --LANES REQUIRE PARRALLEL THREADS
  451.  
  452. function async_http_request(method, url, args, resolve, reject)
  453.     local request_lane = lanes.gen('*', {package = {path = package.path, cpath = package.cpath}}, function()
  454.         local requests = require 'lib.requests'
  455.         local ok, result = pcall(requests.request, method, url, args)
  456.         if ok then
  457.             result.json, result.xml = nil, nil -- cannot be passed through a lane
  458.             return true, result
  459.         else
  460.             return false, result -- return error
  461.         end
  462.     end)
  463.     if not reject then reject = function() end end
  464.     lua_thread.create(function()
  465.         local lh = request_lane()
  466.         while true do
  467.             local status = lh.status
  468.             if status == 'done' then
  469.                 local ok, result = lh[1], lh[2]
  470.                 if ok then resolve(result) else reject(result) end
  471.                 return
  472.             elseif status == 'error' then
  473.                 return reject(lh[1])
  474.             elseif status == 'killed' or status == 'cancelled' then
  475.                 return reject(status)
  476.             end
  477.             wait(0)
  478.         end
  479.     end)
  480. end
  481.  
  482. function urlencode(str)
  483.    if (str) then
  484.       str = string.gsub (str, "\n", "\r\n")
  485.       str = string.gsub (str, "([^%w ])",
  486.          function (c) return string.format ("%%%02X", string.byte(c)) end)
  487.       str = string.gsub (str, " ", "+")
  488.    end
  489.    return str
  490. end
Add Comment
Please, Sign In to add comment