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

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

qdIbp

Автор темы
Проверенный
1,387
1,141
Lua:
require("lib.moonloader")
require("lib.sampfuncs")
local ffi = require("ffi")
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

local active = false

function EmulateKey(key, isDown)
    ffi.C.keybd_event(key, 0, isDown and 0 or 2, 0)
end

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 "Неактивирована"),-1)
        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
 
Последнее редактирование:
  • Нравится
Реакции: YarikVL

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

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

local active = false

function EmulateKey(key, isDown)
    ffi.C.keybd_event(key, 0, isDown and 0 or 2, 0)
end

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 "Неактивирована"),-1)
        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
Починил?

Lua:
require("lib.moonloader")
require("lib.sampfuncs")
local ffi = require("ffi")
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

local active = false

function EmulateKey(key, isDown)
    ffi.C.keybd_event(key, 0, isDown and 0 or 2, 0)
end

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 "Неактивирована"),-1)
        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
Починил?
 
  • Злость
Реакции: qdIbp

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

Новичок
Автор темы
12
0
та нахуй ты спамишь, если я код скинул, то не просто так явно
Инет злалагат 2 сообщения кинул сори

та нахуй ты спамишь, если я код скинул, то не просто так явно
[ML] (error) Flood.lua: ...\Arizona Games Launcher\bin\arizona\moonloader\Flood.lua:16: attempt to index global 'lua' (a nil value)
stack traceback:
...\Arizona Games Launcher\bin\arizona\moonloader\Flood.lua: in function <...\Arizona Games Launcher\bin\arizona\moonloader\Flood.lua:14>
[ML] (error) Flood.lua: Script died due to an error. (0D76EB84)
 
Последнее редактирование:
  • Грустно
Реакции: qdIbp

qdIbp

Автор темы
Проверенный
1,387
1,141
Lua:
require("lib.moonloader")
require("lib.sampfuncs")
local ffi = require("ffi")
ffi.cdef[[
     void keybd_event(int keycode, int scancode, int flags, int extra);
]]

local active = false

function EmulateKey(key, isDown)
    ffi.C.keybd_event(key, 0, isDown and 0 or 2, 0)
end

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 "Неактивирована"),-1)
        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
upd
 

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

Новичок
Автор темы
12
0
[ML] (error) FloodEnd.lua: ...izona Games Launcher\bin\arizona\moonloader\FloodEnd.lua:18: attempt to call global 'isKeyPressed' (a nil value)
stack traceback:
...izona Games Launcher\bin\arizona\moonloader\FloodEnd.lua: in function <...izona Games Launcher\bin\arizona\moonloader\FloodEnd.lua:14>
[ML] (error) FloodEnd.lua: Script died due to an error. (0D60E2D4)