Неактуально почему не тыкает по текстдраву?

.KOHTOP.

Активный
Автор темы
219
35
Версия MoonLoader
.027.0-preview
Lua:
require('lib.moonloader')
local sampev = require('lib.samp.events')
local bot = 0

function main()
    while not isSampAvailable() do wait(0) end

    sampRegisterChatCommand('bot', cmd_bot)

    while true do
        wait(500)
        if bot == 1 then
            function sampev.onShowTextDraw(id, data)
                if id == 2073 then
                    lua_thread.create(function ()
                        wait(1500)
                        sampSendClickTextdraw(id)
                    end)
                end
            end
            setVirtualKeyDown(18, true) -- зажатие 13 клавиши (Enter)
            wait(500) -- задержка на секунду
            setVirtualKeyDown(18, false) -- отпускание 13 клавиши (Enter)
            wait(500)
            setVirtualKeyDown(13, true) -- зажатие 13 клавиши (Enter)
            wait(500) -- задержка на секунду
            setVirtualKeyDown(13, false) -- отпускание 13 клавиши (Enter)
        end
    end
end

function cmd_bot(arg)
    if arg == '1' then
        bot = 1
    elseif arg == '0' then
        bot = 0
    end
end
 
  • Ха-ха
Реакции: YarikVL и Vespan

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
Lua:
require('lib.moonloader')
local sampev = require('lib.samp.events')
local bot = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('bot', function()
        bot = not bot
        -- sampAddChatMessage("Bot "..(bot and "activated" or "deactivated"), -1)
    end)
    while true do wait(0)
        if bot then
            setVirtualKeyDown(18, true) -- зажатие 13 клавиши (Enter)
            wait(500) -- задержка на секунду
            setVirtualKeyDown(18, false) -- отпускание 13 клавиши (Enter)
            wait(500)
            setVirtualKeyDown(13, true) -- зажатие 13 клавиши (Enter)
            wait(500) -- задержка на секунду
            setVirtualKeyDown(13, false) -- отпускание 13 клавиши (Enter)
        end
    end
end

function sampev.onShowTextDraw(id, data)
    if bot then
        if id == 2073 then
            lua_thread.create(function() wait(300)
                sampSendClickTextdraw(2073)
            end)
        end
    end
end