Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://www.blast.hk/threads/22020/
- script_name("FisherBot")
- script_description("FisherBot for DRP")
- script_version("2.0")
- local hook = require("lib.samp.events")
- local keys = require("lib.game.keys")
- local http = require("lib.requests")
- local encoding = require('lib.encoding')
- u8 = encoding.UTF8
- cp1251 = encoding.CP1251
- local lanes = require("lib.lanes").configure()
- local error_leaver = 0
- local last_thread_chat = ""
- local last_thread_two = ""
- local buffer_reading = 0
- local buffer_width = 0
- local bot_key = "kajdju9s87991hs7a8910"
- local url_feed = "Ссылка на сайт"
- local quest = {
- {
- quest = "вы тут",
- data = {
- "да, а что?",
- "да, здесь",
- "ну да",
- "тута",
- "тут я, тут"
- },
- last_params = {
- "да тут я, тут, че пристали то",
- "хаха, на бота чтоль проверяете?",
- "ну вы даете, тут я)"
- }
- },
- {
- quest = "ты тут",
- data = {
- "да, а что?",
- "да, здесь",
- "ну да",
- "тута",
- "тут я, тут"
- },
- last_params = {
- "да тут я, тут, че пристали то",
- "хаха, на бота чтоль проверяете?",
- "ну вы даете, тут я)"
- }
- },
- {
- quest = "го сети",
- data = {
- "нее, спасибо",
- "да не( мало там",
- "лучше так ловить, там мало платят"
- },
- last_params = {
- "нее, чувак, не)",
- "спасибо, нееее)"
- }
- },
- {
- quest = "линберг",
- data = {
- "что такое?",
- "ааа",
- "ммм"
- },
- last_params = {
- "да че",
- "???"
- }
- },
- {
- quest = "покажите лицензии",
- data = {
- "/fishbot",
- "/fishbot",
- "/fishbot"
- },
- last_params = {
- "опа",
- "/q"
- }
- },
- {
- quest = "энкор",
- data = {
- "что такое?",
- "ааа",
- "ммм"
- },
- last_params = {
- "да че",
- "???"
- }
- }
- }
- local captha = {
- {
- quest = "Кто делает мяу мяу",
- response = 4
- },
- {
- quest = "называется наш проект",
- response = 1
- },
- {
- quest = "на какой планете",
- response = 2
- },
- {
- quest = "какое слово состоит из",
- response = 3
- },
- {
- quest = "что делают в больнице",
- response = 1
- },
- {
- quest = "на каком проекте вы играете",
- response = 1
- },
- {
- quest = "в этом списке лишний",
- response = 4
- },
- {
- quest = "фигуры нет углов",
- response = 3
- },
- {
- quest = "что делают собаки",
- response = 4
- },
- {
- quest = "цвета трава",
- response = 3
- }
- }
- --DONT TOUCH
- enabled = false
- color = 0xFFFFFF --byte of color code
- math.randomseed(os.time())
- --hook
- function hook.onDisplayGameText(style, time, text)
- if enabled then
- lua_thread.create(
- function()
- if text == "~w~Press ~r~~k~~PED_FIREWEAPON~" then
- wait(20)
- setGameKeyState(keys.player.FIREWEAPON, 255)
- elseif text == "~w~Press ~g~~k~~PED_LOCK_TARGET~" then
- wait(20)
- setGameKeyState(keys.player.LOCKTARGET, 255)
- end
- end
- )
- end
- end
- function hook.onShowDialog(dialogId, style)
- doCapchaResponse()
- end
- function hook.onServerMessage(clr, text)
- if enabled then
- threading_chat(text)
- feedback_chat(text)
- if string.find(text, "Вы поймали", 0, true) ~= nil then
- feedback()
- text = string.gsub (text, "{00CC00}", "")
- text = string.gsub(text, "{1fc41f}", "")
- text = string.gsub(text, "{00cdcd}", "")
- a = string.match(text, "[%+%-%d]%d*%.?%d*[eE]?[%+%-]?%d*")
- sampSendChat("/fish")
- buffer_width = buffer_width+a
- end
- if string.find(text, "Рыба сорвалась", 0, true) ~= nil then
- sampSendChat("/fish")
- buffer_reading = buffer_reading + 1
- if buffer_reading == 3 then
- buffer_reading = 0
- sampSendChat("Да че за херня, бля")
- lua_thread.create(
- function()
- BeginToPoint(2634.0268554688, -2470.7121582031, 3.2132530212402, false);
- BeginToPoint(2633.6850585938, -2474.7092285156, 3.2164554595947, false);
- sampSendChat("/fish")
- end
- )
- end
- end
- end
- end
- --FEEDBACK
- function feedback()
- moneys = getPlayerMoney()
- async_http_request('GET', url_feed.."/api/api.php?response=feedback&secret="..bot_key.."&money="..moneys.."&weight="..buffer_width, nil, function(response)
- end, function(err)
- end)
- end
- function feedback_chat(line)
- if line ~= nil then
- en_line = urlencode(u8:encode(line, 'CP1251'))
- async_http_request('GET', url_feed.."/chat.php?secret="..bot_key.."&line="..en_line, nil,
- function(response) end, function(err) end)
- end
- end
- function chat_get()
- async_http_request('GET', url_feed.."/api/api.php?response=chat_feedback&secret="..bot_key, nil,
- function(response)
- if response.text ~= nil and response.text ~= 'none' then
- en_line = cp1251:encode(response.text, 'UTF8')
- sampSendChat(en_line)
- end
- end, function(err) end)
- end
- --text_draw_thread
- function td_thread()
- font = renderCreateFont('Verdana', 8, 13)
- lua_thread.create(
- function()
- while enabled do
- wait(1)
- renderFontDrawText(font, "{2b42f0}Поймано: {00ff00}"..buffer_width, 65, 570, 0xFF00FF00)
- end
- end
- )
- end
- --captcha threading
- function doCapchaResponse()
- text = sampGetDialogText()
- if string.find(text, "Вопрос", 0, true) ~= nil then --false
- sampAddChatMessage("[Debug] капча передана контроллеру", color)
- for k,v in pairs(captha) do
- sampAddChatMessage(v.quest)
- if string.find(text, v.quest, 0, true) ~= nil then --false
- sampSetCurrentDialogEditboxText(captha[k].response)
- sampCloseCurrentDialogWithButton(0)
- sampSendChat("/fish")
- end
- end
- end
- end
- --chat hyper threading
- function threading_chat(text)
- for k,v in pairs(quest) do
- if string.find(text, v.quest, 0, true) then
- if string.find(last_thread_chat, v.quest, 0, true) then
- lua_thread.create(
- function()
- if string.find(last_thread_two, v.quest, 0, true) == nil then
- enabled = false
- wait(1500)
- sampSendChat(quest[k].last_params[r_array(#quest[k].last_params)])
- last_thread_two = v.quest
- wait(1500)
- enabled = true
- end
- end
- )
- else
- last_thread_chat = v.quest
- lua_thread.create(
- function()
- enabled = false
- wait(1500)
- sampSendChat(quest[k].data[r_array(#quest[k].data)])
- wait(3000)
- enabled = true
- end
- )
- end
- end
- end
- end
- --main
- function main()
- while not isSampAvailable() do
- wait(1000)
- end
- sampRegisterChatCommand("fishbot", fish)
- sampRegisterChatCommand("test", feedback)
- sampAddChatMessage("{2b42f0} [FishBot] {2bf038} Запускаем бот...", color)
- lua_thread.create(
- function()
- while true do
- wait(1500)
- if enabled then
- chat_get()
- end
- end
- end
- )
- while true do
- wait(0)
- if enabled then
- wait(200)
- line = sampGetChatString(99)
- line_two = line..sampGetChatString(98)
- text = line_two..sampGetChatString(97)
- if string.find(text, "Вы должны быть", 0, true) ~= nil then
- BeginToPoint(2634.0268554688, -2470.7121582031, 3.2132530212402, false);
- BeginToPoint(2633.6850585938, -2474.7092285156, 3.2164554595947, false);
- sampSendChat("/fish")
- end
- if string.find(text, "У вас нет наживы", 0, true) ~= nil then
- BeginToPoint(2642.9084472656, -2470.2104492188, 3.2132530212402, true)
- BeginToPoint(2594.3828125, -2469.1955566406, 3.2132530212402, true)
- BeginToPoint(2593.3256835938, -2461.4375, 3.2132530212402, true)
- BeginToPoint(2620.5817871094, -2461.7172851563, 13.332517623901, true)
- BeginToPoint(2598.015625, -2435.9733886719, 13.640625, false)
- BeginToPoint(2602.4375, -2431.759765625, 13.640625, false)
- BeginToPoint(2607.3427734375, -2437.0505371094, 13.64662361145, false)
- while not sampIsDialogActive() do wait(0) end
- id = sampGetCurrentDialogId()
- sampSendDialogResponse(id, 1, 2, '')
- wait(500)
- id = sampGetCurrentDialogId()
- sampSendDialogResponse(id, 1, 1, '')
- BeginToPoint(2605.9396972656, -2435.4440917969, 13.64662361145, false)
- sampCloseCurrentDialogWithButton(0)
- BeginToPoint(2602.5026855469, -2431.9438476563, 13.640625, false)
- BeginToPoint(2597.7016601563, -2436.4470214844, 13.640625, false)
- BeginToPoint(2614.9191894531, -2461.3842773438, 12.365324020386, false)
- BeginToPoint(2592.7683105469, -2463.7416992188, 3.2132530212402, false)
- BeginToPoint(2592.0263671875, -2468.6586914063, 3.2132530212402, false)
- BeginToPoint(2641.9421386719, -2469.3994140625, 3.2132530212402, true)
- BeginToPoint(2642.109375, -2474.1716308594, 3.2164554595947, false)
- sampSendChat("/fish")
- end
- end
- end
- end
- --commands
- function fish()
- if enabled then
- sampAddChatMessage("{2b42f0} [FishBot] {f02b2b} Выключен", color)
- enabled = false
- width_all = 0
- buffer_width = 0
- else
- sampAddChatMessage("{2b42f0} [FishBot] {2bf038} Включен", color)
- enabled = true
- td_thread()
- end
- end
- --begin funcs
- function BeginToPoint(x, y, z, hoop)
- repeat
- local posX, posY, posZ = GetCoordinates()
- SetAngle(x, y, z)
- local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
- MovePlayer(-255, true, hoop, dist)
- wait(0)
- until not enabled or dist < 1.00000
- end
- function MovePlayer(move_code, isSprint, hoop, dist)
- setGameKeyState(1, move_code)
- if isSprint then
- if hoop then --ПОДПРЫГИВАНИЯ
- if BoolRand() and dist > 10.00000 then
- setGameKeyState(14, -128)
- else
- setGameKeyState(16, 255)
- end
- else
- setGameKeyState(16, 255)
- end
- end
- end
- function SetAngle(x, y, z)
- local posX, posY, posZ = GetCoordinates()
- local pX = x - posX
- local pY = y - posY
- local vector = getHeadingFromVector2d(pX, pY)
- zAngle = vector
- if isCharInAnyCar(playerPed) then
- local car = storeCarCharIsInNoSave(playerPed)
- setCarHeading(car, zAngle)
- else
- setCharHeading(playerPed, zAngle)
- end
- restoreCameraJumpcut()
- end
- function GetCoordinates()
- if isCharInAnyCar(playerPed) then
- local car = storeCarCharIsInNoSave(playerPed)
- return getCarCoordinates(car)
- else
- return getCharCoordinates(playerPed)
- end
- end
- function BoolRand()
- local rand = math.random(0, 50)
- if rand == 4 then
- return true
- else
- return false
- end
- end
- function r_array(leng)
- return math.random(1, leng)
- end
- --LANES REQUIRE PARRALLEL THREADS
- function async_http_request(method, url, args, resolve, reject)
- local request_lane = lanes.gen('*', {package = {path = package.path, cpath = package.cpath}}, function()
- local requests = require 'lib.requests'
- local ok, result = pcall(requests.request, method, url, args)
- if ok then
- result.json, result.xml = nil, nil -- cannot be passed through a lane
- return true, result
- else
- return false, result -- return error
- end
- end)
- if not reject then reject = function() end end
- lua_thread.create(function()
- local lh = request_lane()
- while true do
- local status = lh.status
- if status == 'done' then
- local ok, result = lh[1], lh[2]
- if ok then resolve(result) else reject(result) end
- return
- elseif status == 'error' then
- return reject(lh[1])
- elseif status == 'killed' or status == 'cancelled' then
- return reject(status)
- end
- wait(0)
- end
- end)
- end
- function urlencode(str)
- if (str) then
- str = string.gsub (str, "\n", "\r\n")
- str = string.gsub (str, "([^%w ])",
- function (c) return string.format ("%%%02X", string.byte(c)) end)
- str = string.gsub (str, " ", "+")
- end
- return str
- end
Add Comment
Please, Sign In to add comment