Задержка нажатия Y/N/H

Antigos

Новичок
Автор темы
6
0
Помогите выставить в скрипте задержку перед нажатием Y/N/H. Буду очень признателен.
 

Вложения

  • ClickerTextDraw.lua
    1.1 KB · Просмотры: 4

Bасилий

Участник
13
30
задержку менять на 9 строке, значение в мс (1000мс = 1 сек)
Lua:
script_name("Universal Taper")
script_authors("Unknown")
script_moonloader(0.25)

require "lib.moonloader"
local hook = require 'lib.samp.events'

grogger = false
local delay = 100 -- ms

function main()
    repeat wait(1000) until isSampAvailable()
    sampAddChatMessage("Universal Taper загрузился успешно. Введите /click", 0xc0c24e)
    sampRegisterChatCommand("click",
    function()
        grogger = not grogger
        if grogger then sampAddChatMessage("Universal Taper активирован", 0xc0c24e)
        else sampAddChatMessage("Universal Taper деактивирован", 0xc0c24e) end
    end)
    wait(-1)
end


function hook.onShowTextDraw(textdrawId, data)
    if grogger then
        lua_thread.create(function()
            if data.text:find("Y") then
                wait(delay)
                sendKey(64)
            elseif data.text:find("N") then
                wait(delay)
                sendKey(128)
            elseif data.text:find("H") then
                wait(delay)
                sendKey(192)
            end
        end)
    end
end



function sendKey(key)
    local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
    local data = allocateMemory(68)
    sampStorePlayerOnfootData(myId, data)
    setStructElement(data, 36, 1, key, false)
    sampSendOnfootData(data)
    freeMemory(data)
end