Как остановить отыгровку

Статус
В этой теме нельзя размещать новые ответы.

_ex$tanOr_

Участник
Автор темы
125
19
Версия MoonLoader
.026-beta
Как написать функцию, чтобы например человек в бинде выбрал отыгровку, она начала играть и он, например, нажимает клавишу END и отыгровка прекращается и в чат пишется, что отыгровка остановлена?
 
Решение
Lua:
require "lib.moonloader"
function main()
    while true do
        wait(0)
        if isKeyJustPressed(VK_Y) and not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() then
            thread = lua_thread.create(function()
                sampSendChat('Один')
                wait(1000)
                sampSendChat('Два')
                wait(1000)
                sampSendChat('Три')
                wait(1000)
                sampSendChat('Четыре')
                wait(1000)
                sampSendChat('Пять')
            end)
        end
        if isKeyJustPressed(VK_END) and not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and thread then...

CaJlaT

Овощ
Модератор
2,807
2,609
Lua:
require "lib.moonloader"
function main()
    while true do
        wait(0)
        if isKeyJustPressed(VK_Y) and not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() then
            thread = lua_thread.create(function()
                sampSendChat('Один')
                wait(1000)
                sampSendChat('Два')
                wait(1000)
                sampSendChat('Три')
                wait(1000)
                sampSendChat('Четыре')
                wait(1000)
                sampSendChat('Пять')
            end)
        end
        if isKeyJustPressed(VK_END) and not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive() and thread then
            thread:terminate()
            thread = nil
            sampAddChatMessage('Отыгровка остановлена', -1)
        end
    end
end
 

Вложения

  • zdarova.lua
    896 байт · Просмотры: 4
  • Нравится
Реакции: _ex$tanOr_
Статус
В этой теме нельзя размещать новые ответы.