rkeys

ice_ice

Участник
Автор темы
61
14
Версия MoonLoader
Другое
Такой вопрос, у меня к примеру есть хоткей допустим на клавишу H выполняется функция можно ли как то сделать чтоб к примеру если зажат шифт и мой хоткей чтоб выполнялась другая функция?
что то подобное:
bind = rkeys.registerHotKey(ActiveBind.v, true, func1)

    if isKeyDown(0x10) and not sampIsChatInputActive() and not sampIsDialogActive() and "мой бинд или как то так" then
        func2()
    end
 
Последнее редактирование:
Решение
Так?
Lua:
--var
local tabl = {
      v = {72} -- 72 = H
}
--xz gde
local isHotKeyPressed = function(hotKeyTable)
    local tableLength = #hotKeyTable
    if tableLength == 0 then return false end

    for i = 1, tableLength do
        local func = (i == tableLength) and isKeyJustPressed or isKeyDown
        if not func(hotKeyTable[i]) then return false end
    end
    return true
end

--цикл

if isKeyDown(0x10) and not sampIsChatInputActive() and not sampIsDialogActive() and isHotKeyPressed(tabl.v--[[Массив с твоей клавишами]]) then
    --code
end

ice_ice

Участник
Автор темы
61
14
не совсем понял ну может так
Код:
require 'lib.vkeys'

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

    while true do
        wait(0)
        if isKeyDown(VK_H) and isKeyDown(VK_SHIFT) and not sampIsChatInputActive() then
            --code
        end
    end
end
не, это не то, мне нужно как то сделать сочитание клавиша + хоткей
 

qdIbp

Автор темы
Проверенный
1,387
1,144
Так?
Lua:
--var
local tabl = {
      v = {72} -- 72 = H
}
--xz gde
local isHotKeyPressed = function(hotKeyTable)
    local tableLength = #hotKeyTable
    if tableLength == 0 then return false end

    for i = 1, tableLength do
        local func = (i == tableLength) and isKeyJustPressed or isKeyDown
        if not func(hotKeyTable[i]) then return false end
    end
    return true
end

--цикл

if isKeyDown(0x10) and not sampIsChatInputActive() and not sampIsDialogActive() and isHotKeyPressed(tabl.v--[[Массив с твоей клавишами]]) then
    --code
end
 
  • Нравится
Реакции: ice_ice и Andrinall

ice_ice

Участник
Автор темы
61
14
Так?
Lua:
--var
local tabl = {
      v = {72} -- 72 = H
}
--xz gde
local isHotKeyPressed = function(hotKeyTable)
    local tableLength = #hotKeyTable
    if tableLength == 0 then return false end

    for i = 1, tableLength do
        local func = (i == tableLength) and isKeyJustPressed or isKeyDown
        if not func(hotKeyTable[i]) then return false end
    end
    return true
end

--цикл

if isKeyDown(0x10) and not sampIsChatInputActive() and not sampIsDialogActive() and isHotKeyPressed(tabl.v--[[Массив с твоей клавишами]]) then
    --code
end
Cпасибо, именно то что мне нужно!
 
  • Вау
Реакции: qdIbp