Помогите сделать скрипт по активации клавиши

Eлисей Сорокин

Новичок
Автор темы
12
0
Версия MoonLoader
.027.0-preview
Нужно этот скрипт сделать на активацию дизактивацию на клавишу f10
lua:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end

function main()
    while not isSampAvailable() do wait(0) end
 
    while true do wait(1000)
        EmulateKey(VK_RETURN, true)
        wait(20)
        EmulateKey(VK_RETURN, false)
    end
end

По типу этого скрипта

lua:
local key = 35

local active = false

function main()
    while not isSampAvailable() do wait(100) end
    while true do
        wait(100)
        if active then
            sampSendChat('/mm')
        end
        if wasKeyPressed(key) then
            if active then
                active = false
                sampAddChatMessage('Флудер в /mm выключен', -1)
            else
                active = true
                sampAddChatMessage('Флудер в /mm включен', -1)
            end
        end
    end
end
Плз помогите если сделайте скиньте номер своей карты скину 200₽
 
Последнее редактирование:
  • Эм
Реакции: qdIbp

Eлисей Сорокин

Новичок
Автор темы
12
0

Eлисей Сорокин

Новичок
Автор темы
12
0
Этот скрипт 1 включается сам при входе в игру а мне нужно когда нажимаю клавишу f10 и что бы дищактивировался тоже

Понял, сейчас сделаем
Так то это обычный флудер кнопкой

Понял, сейчас сделаем
Сможешь такое сделать?

Понял, сейчас сделаем
?
 
Последнее редактирование:

BostKing102

Новичок
24
15
Код:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end
local active = false

function main()
    while not isSampAvailable() do wait(0) end
 
    lua.thread_create(floodst)
    while true do wait(0)
        if isKeyPressed(123) then
            active = not active
            sampAddChatMessage("Твоя штука: "..(active and "Активирована" or "Неактивирована"))
        end
    end
end

function(floodst)
    while true do wait(1000)
    if active then
            EmulateKey(VK_RETURN, true)
            wait(20)
            EmulateKey(VK_RETURN, false)
        end
    end
end
Попробуй

Сорян, табуляция херня, с телефона код писал
 

Eлисей Сорокин

Новичок
Автор темы
12
0
Код:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end
local active = false

function main()
    while not isSampAvailable() do wait(0) end
 
    lua.thread_create(floodst)
    while true do wait(0)
        if isKeyPressed(123) then
            active = not active
            sampAddChatMessage("Твоя штука: "..(active and "Активирована" or "Неактивирована"))
        end
    end
end

function(floodst)
    while true do wait(1000)
    if active then
            EmulateKey(VK_RETURN, true)
            wait(20)
            EmulateKey(VK_RETURN, false)
        end
    end
end
Попробуй

Сорян, табуляция херня, с телефона код писал
Активация клавиши f10?
 

BostKing102

Новичок
24
15
Код:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end
local active = false

function main()
    while not isSampAvailable() do wait(0) end
 
    lua.thread_create(floodst)
    while true do wait(0)
        if isKeyPressed(121) then
            active = not active
            sampAddChatMessage("Твоя штука: "..(active and "Активирована" or "Неактивирована"))
        end
    end
end

function(floodst)
    while true do wait(1000)
    if active then
            EmulateKey(VK_RETURN, true)
            wait(20)
            EmulateKey(VK_RETURN, false)
        end
    end
end

Вот на f10
 

BostKing102

Новичок
24
15
if isKeyPressed(123) then
F12 что ли
Да, сначала прочитал что на F12
Код:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end
local active = false

function main()
    while not isSampAvailable() do wait(0) end
 
    lua.thread_create(floodst)
    while true do wait(0)
        if isKeyPressed(121) then
            active = not active
            sampAddChatMessage("Твоя штука: "..(active and "Активирована" or "Неактивирована"))
        end
    end
end

function(floodst)
    while true do wait(1000)
    if active then
            EmulateKey(VK_RETURN, true)
            wait(20)
            EmulateKey(VK_RETURN, false)
        end
    end
end

Вот на f10
На F10 вот
 

Eлисей Сорокин

Новичок
Автор темы
12
0
Код:
require "lib.moonloader"
require "lib.sampfuncs"
local ffi = require "ffi"
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

function EmulateKey(key, isDown)
    if not isDown then
        ffi.C.keybd_event(key, 0, 2, 0)
    else
        ffi.C.keybd_event(key, 0, 0, 0)
    end
end
local active = false

function main()
    while not isSampAvailable() do wait(0) end
 
    lua.thread_create(floodst)
    while true do wait(0)
        if isKeyPressed(121) then
            active = not active
            sampAddChatMessage("Твоя штука: "..(active and "Активирована" or "Неактивирована"))
        end
    end
end

function(floodst)
    while true do wait(1000)
    if active then
            EmulateKey(VK_RETURN, true)
            wait(20)
            EmulateKey(VK_RETURN, false)
        end
    end
end

Вот на f10
Окей дамой приду проверю если работает, скину тебе спасибо в виде 200₽, сразу скинь свою карту, если не работает отпишу тебе