Диалог + скрин lua

coulside

Участник
Автор темы
40
1
Версия MoonLoader
.025-beta
В чем ошибка? Нужно найти текст в диалоге(46) и сделать скрин
Lua:
huy = -1

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do wait(0)
        if isKeyJustPressed(VK_F8) then makeScreenshot() end
        lua_thread.create(function() sampev.onShowDialog() end)
        end
    end  
end

function sampev.onShowDialog(id, style, title, button1, button1, dialogText)
    for n in dialogText:gmatch("[^\r\n]+") do
        if n:find('- Метеоролог: Отличная работа, вот твои деньги!') then
            huy = hu
        end
        hu = hu + 1
    end
end

function makeScreenshot(disable)
    if disable then displayHud(false) sampSetChatDisplayMode(0) end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then displayHud(true) sampSetChatDisplayMode(2) end
end
 

Вложения

  • 1.PNG
    1.PNG
    379.8 KB · Просмотры: 32

IlyaFontonov

Активный
172
37
Попробуй
Код:
local sampev = require('lib.samp.events')

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Мы немедленно подключим метеозонд') then
        sampAddChatMessage('Нашел dialog', -1)
        makeScreenshot(false)
    end
end

function makeScreenshot(disable) -- если передать true, интерфейс и чат будут скрыты
    if disable then displayHud(false) sampSetChatDisplayMode(0) end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then displayHud(true) sampSetChatDisplayMode(2) end
end
 

coulside

Участник
Автор темы
40
1
Попробуй
Код:
local sampev = require('lib.samp.events')

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Мы немедленно подключим метеозонд') then
        sampAddChatMessage('Нашел dialog', -1)
        makeScreenshot(false)
    end
end

function makeScreenshot(disable) -- если передать true, интерфейс и чат будут скрыты
    if disable then displayHud(false) sampSetChatDisplayMode(0) end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then displayHud(true) sampSetChatDisplayMode(2) end
end
Не работает
 

SigmaUnited

Участник
83
36
Попробуй

Lua:
local huy = -1
local hu = 0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
        if isKeyJustPressed(VK_F8) then makeScreenshot() end
    end 
end

function sampev.onShowDialog(id, style, title, button1, button2, dialogText)
    for line in dialogText:gmatch("[^\r\n]+") do
        if line:find('- Метеоролог: Отличная работа, вот твои деньги!') then
            huy = hu
            break
        end
        hu = hu + 1
    end
end

function makeScreenshot(disable)
    if disable then
        displayHud(false)
        sampSetChatDisplayMode(0)
    end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then
        displayHud(true)
        sampSetChatDisplayMode(2)
    end
end
 

IlyaFontonov

Активный
172
37
Попробуй

Lua:
local huy = -1
local hu = 0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
        if isKeyJustPressed(VK_F8) then makeScreenshot() end
    end
end

function sampev.onShowDialog(id, style, title, button1, button2, dialogText)
    for line in dialogText:gmatch("[^\r\n]+") do
        if line:find('- Метеоролог: Отличная работа, вот твои деньги!') then
            huy = hu
            break
        end
        hu = hu + 1
    end
end

function makeScreenshot(disable)
    if disable then
        displayHud(false)
        sampSetChatDisplayMode(0)
    end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then
        displayHud(true)
        sampSetChatDisplayMode(2)
    end
end
sampev нужно подключить еще
 

coulside

Участник
Автор темы
40
1
Попробуй

Lua:
local huy = -1
local hu = 0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
        if isKeyJustPressed(VK_F8) then makeScreenshot() end
    end
end

function sampev.onShowDialog(id, style, title, button1, button2, dialogText)
    for line in dialogText:gmatch("[^\r\n]+") do
        if line:find('- Метеоролог: Отличная работа, вот твои деньги!') then
            huy = hu
            break
        end
        hu = hu + 1
    end
end

function makeScreenshot(disable)
    if disable then
        displayHud(false)
        sampSetChatDisplayMode(0)
    end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then
        displayHud(true)
        sampSetChatDisplayMode(2)
    end
end
Не работает, в консоль не выводит ошибку

sampev нужно подключить еще
это подключил
 

IlyaFontonov

Активный
172
37
Попробуй
Код:
local sampev = require('lib.samp.events')

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
    end
end

function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Мы немедленно подключим метеозонд') then
        sampAddChatMessage('Нашел dialog', -1)
        makeScreenshot(false)
    end
end

function makeScreenshot(disable) -- если передать true, интерфейс и чат будут скрыты
    if disable then displayHud(false) sampSetChatDisplayMode(0) end
    require('memory').setuint8(sampGetBase() + 0x119CBC, 1)
    if disable then displayHud(true) sampSetChatDisplayMode(2) end
end
Попробуй мой код и скинь moonloader.log
 

coulside

Участник
Автор темы
40
1

Вложения

  • moonloader.log
    31.6 KB · Просмотры: 1

chromiusj

$TheWorldIsFvcked
Модератор
5,704
4,010
Как это реализовать то?
руками, как еще
выведи текст через принт
и потом через регулярки решай нужный тебе вопрос