не работает скрипт когда игра свернута

gostrunner

Новичок
Автор темы
15
5
Не работает скрипт когда игра в свернутом режиме,использую Anti AFK by AIR
script:
require 'moonloader'
local sampev = require 'samp.events'

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

    math.randomseed(os.time())

    wait(-1)
end

function goKeyPressed(key)
    setVirtualKeyDown(key, true)
    wait(math.random(150, 200))
    setVirtualKeyDown(key, false)
end

function sampev.onServerMessage(color, text)
    if text:find("Депозит в банке") then
        lua_thread.create(function()
            goKeyPressed(VK_MENU) -- Alt
            for i = 1, 3 do
                goKeyPressed(VK_RETURN) -- Enter
            end
        end)
    end
end
кто шарит как пофиксить?
 

Kirkjubaijaarklaustur

Известный
382
125
Не работает скрипт когда игра в свернутом режиме,использую Anti AFK by AIR
script:
require 'moonloader'
local sampev = require 'samp.events'

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

    math.randomseed(os.time())

    wait(-1)
end

function goKeyPressed(key)
    setVirtualKeyDown(key, true)
    wait(math.random(150, 200))
    setVirtualKeyDown(key, false)
end

function sampev.onServerMessage(color, text)
    if text:find("Депозит в банке") then
        lua_thread.create(function()
            goKeyPressed(VK_MENU) -- Alt
            for i = 1, 3 do
                goKeyPressed(VK_RETURN) -- Enter
            end
        end)
    end
end
кто шарит как пофиксить?
Если играешь с лаунчера, попробуй поставить запуск в окне, может поможет. У меня все скрипты работают с этим антиафк на лаунчере
 

YarikVL

Известный
Проверенный
4,796
1,813
использую Anti AFK by AIR
Проблема не в антиафк, а в способе нажатие клавиши твоим скриптом
script:
require 'moonloader'
local sampev = require 'samp.events'

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

    math.randomseed(os.time())

    wait(-1)
end

function goKeyPressed(key)
    setVirtualKeyDown(key, true)
    wait(math.random(150, 200))
    setVirtualKeyDown(key, false)
end

function sampev.onServerMessage(color, text)
    if text:find("Депозит в банке") then
        lua_thread.create(function()
            goKeyPressed(VK_MENU) -- Alt
            for i = 1, 3 do
                goKeyPressed(VK_RETURN) -- Enter
            end
        end)
    end
end
кто шарит как пофиксить?
Надо юзать setGameKeyState, подробно про эту функу: https://wiki.blast.hk/moonloader/lua/setgamekeystate

А для отправки ответа в диалог надо не Enter юзать, а специальную функу для диалогов: https://wiki.blast.hk/ru/moonloader/lua/sampSendDialogResponse
Ну и задержки добавить надо.


Если ты ничего не понял то можешь посмотреть уроки по Lua
Либо если тебе лень: https://www.blast.hk/forums/16/
 
  • Нравится
Реакции: gostrunner и jetrorq