луа не реагирует на клавиши

parkinson

Участник
Автор темы
33
1
Версия MoonLoader
.026-beta
скрипт запускается, но луа не реагирует на нажатия клавиш, что делать?
 

parkinson

Участник
Автор темы
33
1
Форматирование кода
Lua:
local encoding = require 'encoding'

encoding.default = 'CP1251'

u8 = encoding.UTF8



function main()

    while not isSampAvailable() do wait(100) end

    while true do wait(1)

    if sampIsLocalPlayerSpawned() then

        sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Скрипт сделал - {008000}Администратор {FFFFFF}Winslow {008000}James Parkinson", -1)

        sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Активация - {008000}X", -1)

        sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Версия скрипта - {008000}1.0", -1)

        sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: Удачного фарма репорта", -1)

            thisScript():unload()

end

    if isKeyDown(VK_X) and not sampIsCursorActive() then

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

      sampSendChat("/ot")

        end

    end

end
 
Последнее редактирование модератором:

CaJlaT

Овощ
Модератор
2,806
2,605
У тебя скрипт отгружается, поэтому ничего и не работает
p.s: Нахуя так много одинаковых строк, если ты всё равно используешь их в БЕСКОНЕЧНОМ ЦИКЛЕ? Также, нахуя тебе encoding, если ты его не используешь?
Lua:
require 'moonloader'
local spawned = false
function main()
    while not isSampAvailable() do wait(100) end
    while true do wait(1)
        if sampIsLocalPlayerSpawned() and not spawned then
            sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Скрипт сделал - {008000}Администратор {FFFFFF}Winslow {008000}James Parkinson", -1)
            sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Активация - {008000}X", -1)
            sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Версия скрипта - {008000}1.0", -1)
            sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Автообновление скрипта - {008000}Включёно", -1)
            sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: Удачного фарма репорта", -1)
            spawned = true
        end
        if isKeyDown(VK_X) and not sampIsCursorActive() and spawned then
            sampSendChat("/ot")
        end
    end
end
 
Последнее редактирование:

atomlin

Известный
579
380
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(100) end
while true do wait(1)
if sampIsLocalPlayerSpawned() then
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Скрипт сделал - {008000}Администратор {FFFFFF}Winslow {008000}James Parkinson", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Активация - {008000}X", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Версия скрипта - {008000}1.0", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: Удачного фарма репорта", -1)
thisScript():unload()
end
if isKeyDown(VK_X) and not sampIsCursorActive() then
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
sampSendChat("/ot")
end
end
end
Lua:
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(100) end
while true do wait(1)
if sampIsLocalPlayerSpawned() then
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Скрипт сделал - {008000}Администратор {FFFFFF}Winslow {008000}James Parkinson", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Активация - {008000}X", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Версия скрипта - {008000}1.0", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: Удачного фарма репорта", -1)
end
if isKeyDown(VK_X) and not sampIsCursorActive() then
for i = 1, 100 do
    sampSendChat('/ot')
end
end
end
end
 

leekyrave

Известный
419
223
скрипт работает, но на клавишу не реагирует чтоб флудить
начнем с того,Что у тебя vkeys не подключены.
Lua:
 local encoding = require 'encoding'
local vkeys = require 'vkeys'
encoding.default = 'CP1251'
u8 = encoding.UTF8

function main()
while not isSampAvailable() do wait(100) end
while true do wait(1)
if sampIsLocalPlayerSpawned() then
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Скрипт сделал - {008000}Администратор {FFFFFF}Winslow {008000}James Parkinson", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Активация - {008000}X", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: {FFFFFF}Версия скрипта - {008000}1.0", -1)
sampAddChatMessage("{008000}>> [AutoReport]{FFFFFF}: Удачного фарма репорта", -1)
end
if isKeyDown(vkeys.VK_X) and not sampIsCursorActive() then

    sampSendChat('/ot')
-- цикл тут не нужен искейдаун проверяет зажата ли клавиша
end
end
end
 
  • Ха-ха
Реакции: tinkoir

leekyrave

Известный
419
223
Для использования глобальных переменных клавиш, к примеру, VK_A. VK_X и т.п. необходимо подгружать модуль moonloader:
require("moonloader")


Не обязательно подключать, это делается только ряди того, чтобы индексировать клавиши через назначенную переменную vkeys
да похуй,ничего не поменялось,код рабочий
 
  • Вау
Реакции: MrBidloKoder