Помогите с луа кодом пожалуйсто

Radfgh177

Участник
Автор темы
62
1
Версия MoonLoader
.026-beta
У меня такой вопрос, я написал типо биндера на мут в фам чата и к примеру когда я нажимаю кнопку мне в чат пишется заготовка (/fammute Капс) но чтобы чтобы ввести ид и время мута мне нужно курсор переместить от суда (/fammenu Капс|) суда (/fammute | Капс) нужно тыкнуть на стрелочку влево 5 раз, а можно это как-то сделать автоматически? (Не смог найти ид стрелочки влево)
 

IlyaHL2

Активный
210
53
Вот на выбор:

1:
function main()
require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    repeat wait(0) until isSampAvailable()
while not isSampAvailable() do wait(100) end
    while true do
        wait(0)
        if isKeyJustPressed(VK_O) then -- Если нажаты клавиши Англиская O то
            sampSetChatInputEnabled(true)
            sampSetChatInputText("/fammenu  Капс")
            setVirtualKeyDown(37, true)
            wait(5000)
            setVirtualKeyDown(37, false)
        end
    end    
end
Либо (Как по мне хороший вариант)

2:
local vkeys = require 'vkeys'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then
        return
    end
    while not isSampAvailable() do wait(100) end

    while true do
        wait(0)
        if wasKeyPressed(vkeys.VK_R) then
            sampSetChatInputText("/fammenu  Капс")
            sampSetChatInputCursor(9)
            sampSetChatInputEnabled(true)
        end
    end
end

function sampSetChatInputCursor(start, finish)
    local finish = finish or start
    local start, finish = tonumber(start), tonumber(finish)
    local mem = require 'memory'
    local chatInfoPtr = sampGetInputInfoPtr()
    local chatBoxInfo = getStructElement(chatInfoPtr, 0x8, 4)
    mem.setint8(chatBoxInfo + 0x11E, start)
    mem.setint8(chatBoxInfo + 0x119, finish)
    return true
end
 

IlyaHL2

Активный
210
53

Radfgh177

Участник
Автор темы
62
1
На будущие
Спасибо! Я на том сайте не мог найти стрелочку на лево, 37 ид кнопки он нажимает на нумпаде он не влево мотает а цифру 4 пишет. Спасибо за второй вариант еще раз)