Автовыбор диалога

legacy.

Новичок
Автор темы
3
1
привествую
как сделать автовыбор дома по кмд в диалоге 7238 ( flashminer ),у нас есть список до 15 домов я хочю ввожу кмд /geth скрипт нажимал на 1 дом , снова ввожу 2 и т.д
 

- |2347| -

Известный
371
129
Можешь попробовать это

код:
script_authors("TG @Qwestonsz")
script_url("https://www.blast.hk/members/464512/")
local sampev = require("samp.events")
local active = false
local houseIndex = 0
local houseCount = 0

function main()
    repeat wait(0) until isSampAvailable()
    sampAddChatMessage('Скрипт [{FF00FF}'..thisScript().filename..'{FFFFFF}] загружен Автор [{FF00FF}'..unpack(thisScript().authors)..'{FFFFFF}] Активация {FF00FF}/geth', -1)
    sampRegisterChatCommand('geth', function()
        active = true
        houseIndex = 0
        sampSendChat("/flashminer")
    end)
    wait(-1)
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Выбор дома') and active then
        local lines = {}
        for line in text:gmatch("[^\r\n]+") do
            table.insert(lines, line)
        end
        houseCount = #lines - 1
        if houseCount > 0 then
            sampSendDialogResponse(dialogId, 1, houseIndex, "")
            houseIndex = houseIndex + 1
            if houseIndex >= houseCount then
                houseIndex = 0
                active = false
                sampAddChatMessage('Все дома выбраны (' .. houseCount .. '), начинаем сначала.', -1)
            end
        else
            sampAddChatMessage('Ошибка: дома не найдены в диалоге.', -1)
            active = false
        end
        return false
    end
    return true
end
 
  • Нравится
Реакции: legacy.