Закрытие диалогов RakSamp

Статус
В этой теме нельзя размещать новые ответы.

Klimer

Участник
Автор темы
80
8
Как сделать так шо бы все диалоги закрывались в RakSamp? Вот скрипт луа


lua:
-- this bypass requires bypasshost for bypassing raknet internals
require('addon')
local sampev = require('samp.events')
local raknet = require('samp.raknet')
local bit = require('bit')
math.randomseed(os.time()*os.clock()*math.random())

function loadVariableFromFile(filename, variableName)
    local file = io.open(filename, "r") -- Открываем файл для чтения
    if not file then
        print("Не удалось открыть файл: " .. filename)
        return nil
    end

    local value = nil
    for line in file:lines() do
        if line:find(variableName .. "=") then
            value = line:match(variableName .. "=(.*)")
            break
        end
    end

    file:close()
    return value
end

local PASSWORD = loadVariableFromFile("aue.txt", "password")
local lvl = loadVariableFromFile("aue.txt", "maxlevel")

function SEND_ACTION(TYPE, MESSAGE)
    local bs = bitStream.new()
    bs:writeInt8(252)
    bs:writeInt16(TYPE)
    bs:writeInt32(#MESSAGE)
    bs:writeString(MESSAGE)
    bs:sendPacketEx(1, 7, 1)
    bs:reset()
end

local time = 40
local step = 2

function teleportRandomly()
    local randomX = math.random(-100, 2000)
    local randomY = math.random(-100, 2000)
    local randomZ = math.random(0, 50)

    coordStart(randomX, randomY, randomZ, time, step, true)
end

local priletel = false

function sampev.onServerMessage(color, text)
    if text:find("чтобы начать попрошайничать") then
        sendInput("/bg")
        print("Зарабатываем денюжки.")
    end
    if text:find("не имеет привязки") then
        if not isCoordActive() then
            newTask(function()
                wait(7000)
                teleportRandomly()
            end)
        end
    end
end

local clickdialog = false

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if title:find("Обучение по игре") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Попрошайничество") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Промокод") and not clickdialog then
        clickdialog = true
        sendDialogResponse(id, 1, 0, "")
    end
    if title:find("Промокод") and clickdialog then
        sendDialogResponse(id, 1, 0, "")
    end
end

function onCoordStop()
    if priletel == false then
        priletel = true
        newTask(sendInput, 3000, "/bg")
    end
end

function setRandomNick()
    reconnect(4000)
    local data = {names = {}, surnames = {}}
    local filenames = {"settings\\names.txt", "settings\\surnames.txt"}
    for i = 1, #filenames do
        local file = io.open(filenames[i], "r")
        if not file then
            return
        end
        for line in file:lines() do
            line = line:gsub("%s", "")
            table.insert(i == 1 and data.names or data.surnames, line)
        end
        file:close()
    end
    setBotNick(("%s_%s"):format(data.names[math.random(1, #data.names)], data.surnames[math.random(1, #data.surnames)]))
    last_message_id = nil
end

function spawnplayer()
    SEND_ACTION(50, "{\"t\":1}")
    print("Отправили пакет спавна.")
end

function authorization()
    SEND_ACTION(38, string.format("{\"t\":6,\"s\":\"%s\",\"r\":1}", PASSWORD))
    print("Отправили пакет авторизации.")
end

function registration()
    if #PASSWORD >= 6 and #PASSWORD <= 15 then
        newTask(function()
            local JSONs = { string.format("{\"t\":1,\"s\":\"\",\"p\":\"%s\"}", PASSWORD), "{\"t\":2,\"s\":\"\",\"r\":0}", "{\"t\":4,\"s\":\"\"}", "{\"t\":3,\"r\":0}", "{\"t\":5,\"r\":239}", "{\"c\":1}" }
            for i = 1, #JSONs do SEND_ACTION(38, JSONs[i]) wait(250) end
        end)
        print("Отправили пакет регистрации.")
    end
end

function sampev.onSetInterior(interior)
    if interior == 0 then
        newTask(function ()
            for i = 1, 2, 1 do
                wait(5000)
                registration()
                authorization()
            end
        end)
    end
end

function sampev.onSendPlayerSync(data)
    if priletel == true then
        print("меняю позицию")
        local x, y, z = getBotPosition()
        setBotPosition(x, y+0.01, z)
    end
end

function sampev.onConnectionRequestAccepted(ip, port, playerid, challenge)
    local bs = bitStream.new()

    bs:writeInt32(bit.bxor(challenge, 0xFDA))
    bs:writeUInt8(1)
    bs:writeInt32(0x36B) -- client version
    bs:writeUInt8(1)

    local nickname = getBotNick()
    bs:writeUInt8(#nickname)
    bs:writeString(nickname)

    bs:sendRPCEx(54, 1, 9, 0, false)

    print("ауе")
end

function onReceivePacket(id, bs)
    if id == 252 then
        local TYPE = bs:readInt16()
        local TEXT = ""
        local LEN = bs:readInt32()
        if LEN > 0 then
            TEXT = string.gsub(bs:readString(LEN), "\n", "\\n")
            print(TEXT)
            if TYPE == 38 then
                if TEXT:find("%{ \"o\": 1, \"r\": 1, \"p\": %d+, \"f\": %d+, \"lk\" : .+ %}") then
                    authorization()
                end
                if TEXT == "{ \"o\": 1, \"r\": 0 }" then
                    registration()
                end
                if TEXT == "{ \"t\": 0 }" then
                    SEND_ACTION(38, "{\"c\":1}")
                end
            end
            if TYPE == 50 and TEXT:find("%{ \"o\": 1, \"m\" : %[.+%] %}") then
                spawnplayer()
            end
        end
    end
end

function onReceiveRpc(rpcid, bs)
    if rpcid == raknet.RPC.WORLDPLAYERADD then
        local bs = bitStream.new()
        bs:resetReadPointer()
        local playerid = bs:readInt16()
        local skin = bs:readInt32()
        local x = bs:readFloat()
        local y = bs:readFloat()
        local z = bs:readFloat()
        local heading = bs:readFloat()
        local color = bs:readInt32()
        local fs = bs:readUInt8()

        bs:reset()
        bs:writeInt16(playerid)
        bs:writeUInt8(255)
        bs:writeInt32(skin)
        bs:writeFloat(x)
        bs:writeFloat(y)
        bs:writeFloat(z)
        bs:writeFloat(heading)
        bs:writeInt32(color)
        bs:writeUInt8(fs)

        return true, rpcid, bs
    end
end

function sampev.onSendClientJoin(version, mod, nickname, challengeResponse, authkey, ver, challengeResponse2)
    return false
end

function restart()
    newTask(function()
        local host = "127.0.0.1"
        os.execute("reload_window.py "..host.." "..getBotNick())
        exit()       
    end)
end

function send_request(arg_1_0)
    local req = "http://" .. arg_1_0 .. ':80'
    local _, i, _, _ = http.request(req)
    return i
end

function onLoad()
    print("Обход на Black Russia - успешно загрузился.")
    print("Пароль ботов: "..PASSWORD)
    print("Требуемый уровень: "..lvl)
    if getBotNick() == "nick" then setRandomNick() end
end

function writeTxt(filename, text)
    local file, error = io.open(filename, "a+")
    if file then
        file:write(text.. "\n")
    end
    file:close()
end
newTask(function ()
    while true do
        if getBotScore() >= tonumber(lvl) then
            print("сохраняю аккаунт ептель")
            writeTxt("accounts.txt", ("%s | %s | %s | %s | %s "):format(getServerName(), getBotNick(), PASSWORD, getBotScore(), getBotMoney()))
            wait(500)
            reconnect(5000)
            setRandomNick()
        end
        wait(1000)
    end
end)
 
Решение
Как сделать так шо бы все диалоги закрывались в RakSamp? Вот скрипт луа


lua:
-- this bypass requires bypasshost for bypassing raknet internals
require('addon')
local sampev = require('samp.events')
local raknet = require('samp.raknet')
local bit = require('bit')
math.randomseed(os.time()*os.clock()*math.random())

function loadVariableFromFile(filename, variableName)
    local file = io.open(filename, "r") -- Открываем файл для чтения
    if not file then
        print("Не удалось открыть файл: " .. filename)
        return nil
    end

    local value = nil
    for line in file:lines() do
        if line:find(variableName .. "=") then
            value = line:match(variableName .. "=(.*)")
            break
        end
    end...

Nichoo

Участник
32
2
Как сделать так шо бы все диалоги закрывались в RakSamp? Вот скрипт луа


lua:
-- this bypass requires bypasshost for bypassing raknet internals
require('addon')
local sampev = require('samp.events')
local raknet = require('samp.raknet')
local bit = require('bit')
math.randomseed(os.time()*os.clock()*math.random())

function loadVariableFromFile(filename, variableName)
    local file = io.open(filename, "r") -- Открываем файл для чтения
    if not file then
        print("Не удалось открыть файл: " .. filename)
        return nil
    end

    local value = nil
    for line in file:lines() do
        if line:find(variableName .. "=") then
            value = line:match(variableName .. "=(.*)")
            break
        end
    end

    file:close()
    return value
end

local PASSWORD = loadVariableFromFile("aue.txt", "password")
local lvl = loadVariableFromFile("aue.txt", "maxlevel")

function SEND_ACTION(TYPE, MESSAGE)
    local bs = bitStream.new()
    bs:writeInt8(252)
    bs:writeInt16(TYPE)
    bs:writeInt32(#MESSAGE)
    bs:writeString(MESSAGE)
    bs:sendPacketEx(1, 7, 1)
    bs:reset()
end

local time = 40
local step = 2

function teleportRandomly()
    local randomX = math.random(-100, 2000)
    local randomY = math.random(-100, 2000)
    local randomZ = math.random(0, 50)

    coordStart(randomX, randomY, randomZ, time, step, true)
end

local priletel = false

function sampev.onServerMessage(color, text)
    if text:find("чтобы начать попрошайничать") then
        sendInput("/bg")
        print("Зарабатываем денюжки.")
    end
    if text:find("не имеет привязки") then
        if not isCoordActive() then
            newTask(function()
                wait(7000)
                teleportRandomly()
            end)
        end
    end
end

local clickdialog = false

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if title:find("Обучение по игре") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Попрошайничество") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Промокод") and not clickdialog then
        clickdialog = true
        sendDialogResponse(id, 1, 0, "")
    end
    if title:find("Промокод") and clickdialog then
        sendDialogResponse(id, 1, 0, "")
    end
end

function onCoordStop()
    if priletel == false then
        priletel = true
        newTask(sendInput, 3000, "/bg")
    end
end

function setRandomNick()
    reconnect(4000)
    local data = {names = {}, surnames = {}}
    local filenames = {"settings\\names.txt", "settings\\surnames.txt"}
    for i = 1, #filenames do
        local file = io.open(filenames[i], "r")
        if not file then
            return
        end
        for line in file:lines() do
            line = line:gsub("%s", "")
            table.insert(i == 1 and data.names or data.surnames, line)
        end
        file:close()
    end
    setBotNick(("%s_%s"):format(data.names[math.random(1, #data.names)], data.surnames[math.random(1, #data.surnames)]))
    last_message_id = nil
end

function spawnplayer()
    SEND_ACTION(50, "{\"t\":1}")
    print("Отправили пакет спавна.")
end

function authorization()
    SEND_ACTION(38, string.format("{\"t\":6,\"s\":\"%s\",\"r\":1}", PASSWORD))
    print("Отправили пакет авторизации.")
end

function registration()
    if #PASSWORD >= 6 and #PASSWORD <= 15 then
        newTask(function()
            local JSONs = { string.format("{\"t\":1,\"s\":\"\",\"p\":\"%s\"}", PASSWORD), "{\"t\":2,\"s\":\"\",\"r\":0}", "{\"t\":4,\"s\":\"\"}", "{\"t\":3,\"r\":0}", "{\"t\":5,\"r\":239}", "{\"c\":1}" }
            for i = 1, #JSONs do SEND_ACTION(38, JSONs[i]) wait(250) end
        end)
        print("Отправили пакет регистрации.")
    end
end

function sampev.onSetInterior(interior)
    if interior == 0 then
        newTask(function ()
            for i = 1, 2, 1 do
                wait(5000)
                registration()
                authorization()
            end
        end)
    end
end

function sampev.onSendPlayerSync(data)
    if priletel == true then
        print("меняю позицию")
        local x, y, z = getBotPosition()
        setBotPosition(x, y+0.01, z)
    end
end

function sampev.onConnectionRequestAccepted(ip, port, playerid, challenge)
    local bs = bitStream.new()

    bs:writeInt32(bit.bxor(challenge, 0xFDA))
    bs:writeUInt8(1)
    bs:writeInt32(0x36B) -- client version
    bs:writeUInt8(1)

    local nickname = getBotNick()
    bs:writeUInt8(#nickname)
    bs:writeString(nickname)

    bs:sendRPCEx(54, 1, 9, 0, false)

    print("ауе")
end

function onReceivePacket(id, bs)
    if id == 252 then
        local TYPE = bs:readInt16()
        local TEXT = ""
        local LEN = bs:readInt32()
        if LEN > 0 then
            TEXT = string.gsub(bs:readString(LEN), "\n", "\\n")
            print(TEXT)
            if TYPE == 38 then
                if TEXT:find("%{ \"o\": 1, \"r\": 1, \"p\": %d+, \"f\": %d+, \"lk\" : .+ %}") then
                    authorization()
                end
                if TEXT == "{ \"o\": 1, \"r\": 0 }" then
                    registration()
                end
                if TEXT == "{ \"t\": 0 }" then
                    SEND_ACTION(38, "{\"c\":1}")
                end
            end
            if TYPE == 50 and TEXT:find("%{ \"o\": 1, \"m\" : %[.+%] %}") then
                spawnplayer()
            end
        end
    end
end

function onReceiveRpc(rpcid, bs)
    if rpcid == raknet.RPC.WORLDPLAYERADD then
        local bs = bitStream.new()
        bs:resetReadPointer()
        local playerid = bs:readInt16()
        local skin = bs:readInt32()
        local x = bs:readFloat()
        local y = bs:readFloat()
        local z = bs:readFloat()
        local heading = bs:readFloat()
        local color = bs:readInt32()
        local fs = bs:readUInt8()

        bs:reset()
        bs:writeInt16(playerid)
        bs:writeUInt8(255)
        bs:writeInt32(skin)
        bs:writeFloat(x)
        bs:writeFloat(y)
        bs:writeFloat(z)
        bs:writeFloat(heading)
        bs:writeInt32(color)
        bs:writeUInt8(fs)

        return true, rpcid, bs
    end
end

function sampev.onSendClientJoin(version, mod, nickname, challengeResponse, authkey, ver, challengeResponse2)
    return false
end

function restart()
    newTask(function()
        local host = "127.0.0.1"
        os.execute("reload_window.py "..host.." "..getBotNick())
        exit()      
    end)
end

function send_request(arg_1_0)
    local req = "http://" .. arg_1_0 .. ':80'
    local _, i, _, _ = http.request(req)
    return i
end

function onLoad()
    print("Обход на Black Russia - успешно загрузился.")
    print("Пароль ботов: "..PASSWORD)
    print("Требуемый уровень: "..lvl)
    if getBotNick() == "nick" then setRandomNick() end
end

function writeTxt(filename, text)
    local file, error = io.open(filename, "a+")
    if file then
        file:write(text.. "\n")
    end
    file:close()
end
newTask(function ()
    while true do
        if getBotScore() >= tonumber(lvl) then
            print("сохраняю аккаунт ептель")
            writeTxt("accounts.txt", ("%s | %s | %s | %s | %s "):format(getServerName(), getBotNick(), PASSWORD, getBotScore(), getBotMoney()))
            wait(500)
            reconnect(5000)
            setRandomNick()
        end
        wait(1000)
    end
end)
Никак,для каждого отдельно прописывать
 

Grable

Потрачен
7
1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Как сделать так шо бы все диалоги закрывались в RakSamp? Вот скрипт луа


lua:
-- this bypass requires bypasshost for bypassing raknet internals
require('addon')
local sampev = require('samp.events')
local raknet = require('samp.raknet')
local bit = require('bit')
math.randomseed(os.time()*os.clock()*math.random())

function loadVariableFromFile(filename, variableName)
    local file = io.open(filename, "r") -- Открываем файл для чтения
    if not file then
        print("Не удалось открыть файл: " .. filename)
        return nil
    end

    local value = nil
    for line in file:lines() do
        if line:find(variableName .. "=") then
            value = line:match(variableName .. "=(.*)")
            break
        end
    end

    file:close()
    return value
end

local PASSWORD = loadVariableFromFile("aue.txt", "password")
local lvl = loadVariableFromFile("aue.txt", "maxlevel")

function SEND_ACTION(TYPE, MESSAGE)
    local bs = bitStream.new()
    bs:writeInt8(252)
    bs:writeInt16(TYPE)
    bs:writeInt32(#MESSAGE)
    bs:writeString(MESSAGE)
    bs:sendPacketEx(1, 7, 1)
    bs:reset()
end

local time = 40
local step = 2

function teleportRandomly()
    local randomX = math.random(-100, 2000)
    local randomY = math.random(-100, 2000)
    local randomZ = math.random(0, 50)

    coordStart(randomX, randomY, randomZ, time, step, true)
end

local priletel = false

function sampev.onServerMessage(color, text)
    if text:find("чтобы начать попрошайничать") then
        sendInput("/bg")
        print("Зарабатываем денюжки.")
    end
    if text:find("не имеет привязки") then
        if not isCoordActive() then
            newTask(function()
                wait(7000)
                teleportRandomly()
            end)
        end
    end
end

local clickdialog = false

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if title:find("Обучение по игре") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Попрошайничество") then
        sendDialogResponse(id, 0, 0, "")
    end
    if title:find("Промокод") and not clickdialog then
        clickdialog = true
        sendDialogResponse(id, 1, 0, "")
    end
    if title:find("Промокод") and clickdialog then
        sendDialogResponse(id, 1, 0, "")
    end
end

function onCoordStop()
    if priletel == false then
        priletel = true
        newTask(sendInput, 3000, "/bg")
    end
end

function setRandomNick()
    reconnect(4000)
    local data = {names = {}, surnames = {}}
    local filenames = {"settings\\names.txt", "settings\\surnames.txt"}
    for i = 1, #filenames do
        local file = io.open(filenames[i], "r")
        if not file then
            return
        end
        for line in file:lines() do
            line = line:gsub("%s", "")
            table.insert(i == 1 and data.names or data.surnames, line)
        end
        file:close()
    end
    setBotNick(("%s_%s"):format(data.names[math.random(1, #data.names)], data.surnames[math.random(1, #data.surnames)]))
    last_message_id = nil
end

function spawnplayer()
    SEND_ACTION(50, "{\"t\":1}")
    print("Отправили пакет спавна.")
end

function authorization()
    SEND_ACTION(38, string.format("{\"t\":6,\"s\":\"%s\",\"r\":1}", PASSWORD))
    print("Отправили пакет авторизации.")
end

function registration()
    if #PASSWORD >= 6 and #PASSWORD <= 15 then
        newTask(function()
            local JSONs = { string.format("{\"t\":1,\"s\":\"\",\"p\":\"%s\"}", PASSWORD), "{\"t\":2,\"s\":\"\",\"r\":0}", "{\"t\":4,\"s\":\"\"}", "{\"t\":3,\"r\":0}", "{\"t\":5,\"r\":239}", "{\"c\":1}" }
            for i = 1, #JSONs do SEND_ACTION(38, JSONs[i]) wait(250) end
        end)
        print("Отправили пакет регистрации.")
    end
end

function sampev.onSetInterior(interior)
    if interior == 0 then
        newTask(function ()
            for i = 1, 2, 1 do
                wait(5000)
                registration()
                authorization()
            end
        end)
    end
end

function sampev.onSendPlayerSync(data)
    if priletel == true then
        print("меняю позицию")
        local x, y, z = getBotPosition()
        setBotPosition(x, y+0.01, z)
    end
end

function sampev.onConnectionRequestAccepted(ip, port, playerid, challenge)
    local bs = bitStream.new()

    bs:writeInt32(bit.bxor(challenge, 0xFDA))
    bs:writeUInt8(1)
    bs:writeInt32(0x36B) -- client version
    bs:writeUInt8(1)

    local nickname = getBotNick()
    bs:writeUInt8(#nickname)
    bs:writeString(nickname)

    bs:sendRPCEx(54, 1, 9, 0, false)

    print("ауе")
end

function onReceivePacket(id, bs)
    if id == 252 then
        local TYPE = bs:readInt16()
        local TEXT = ""
        local LEN = bs:readInt32()
        if LEN > 0 then
            TEXT = string.gsub(bs:readString(LEN), "\n", "\\n")
            print(TEXT)
            if TYPE == 38 then
                if TEXT:find("%{ \"o\": 1, \"r\": 1, \"p\": %d+, \"f\": %d+, \"lk\" : .+ %}") then
                    authorization()
                end
                if TEXT == "{ \"o\": 1, \"r\": 0 }" then
                    registration()
                end
                if TEXT == "{ \"t\": 0 }" then
                    SEND_ACTION(38, "{\"c\":1}")
                end
            end
            if TYPE == 50 and TEXT:find("%{ \"o\": 1, \"m\" : %[.+%] %}") then
                spawnplayer()
            end
        end
    end
end

function onReceiveRpc(rpcid, bs)
    if rpcid == raknet.RPC.WORLDPLAYERADD then
        local bs = bitStream.new()
        bs:resetReadPointer()
        local playerid = bs:readInt16()
        local skin = bs:readInt32()
        local x = bs:readFloat()
        local y = bs:readFloat()
        local z = bs:readFloat()
        local heading = bs:readFloat()
        local color = bs:readInt32()
        local fs = bs:readUInt8()

        bs:reset()
        bs:writeInt16(playerid)
        bs:writeUInt8(255)
        bs:writeInt32(skin)
        bs:writeFloat(x)
        bs:writeFloat(y)
        bs:writeFloat(z)
        bs:writeFloat(heading)
        bs:writeInt32(color)
        bs:writeUInt8(fs)

        return true, rpcid, bs
    end
end

function sampev.onSendClientJoin(version, mod, nickname, challengeResponse, authkey, ver, challengeResponse2)
    return false
end

function restart()
    newTask(function()
        local host = "127.0.0.1"
        os.execute("reload_window.py "..host.." "..getBotNick())
        exit()     
    end)
end

function send_request(arg_1_0)
    local req = "http://" .. arg_1_0 .. ':80'
    local _, i, _, _ = http.request(req)
    return i
end

function onLoad()
    print("Обход на Black Russia - успешно загрузился.")
    print("Пароль ботов: "..PASSWORD)
    print("Требуемый уровень: "..lvl)
    if getBotNick() == "nick" then setRandomNick() end
end

function writeTxt(filename, text)
    local file, error = io.open(filename, "a+")
    if file then
        file:write(text.. "\n")
    end
    file:close()
end
newTask(function ()
    while true do
        if getBotScore() >= tonumber(lvl) then
            print("сохраняю аккаунт ептель")
            writeTxt("accounts.txt", ("%s | %s | %s | %s | %s "):format(getServerName(), getBotNick(), PASSWORD, getBotScore(), getBotMoney()))
            wait(500)
            reconnect(5000)
            setRandomNick()
        end
        wait(1000)
    end
end)
в хук диалогов кинь
Lua:
sendDialogResponse(id, 0, 0, "")
 
Статус
В этой теме нельзя размещать новые ответы.