хелп с sampRegisterChatCommand

Ricardo_Miloss

Участник
Автор темы
40
3
Версия MoonLoader
Другое
Lua:
        sampRegisterChatCommand('pr', function()
                if checkboxes.prmanager.v then
                    pronoroff = not pronoroff;
                    msg(pronoroff and 'Реклама включена.' or 'Реклама выключена.')
                end
                lua_thread.create(function()
                    if pronoroff and checkboxes.prmanager.v then

                            piarvr()
                            local delayvr = cfg.settings.delayvr * 1000
                            wait(delayvr)


                            piarfam()
                            local delayfam = cfg.settings.delayfam * 1000
                            wait(delayfam)

                            piaral()
                            local delayal = cfg.settings.delayal * 1000
                            wait(delayal)
                    return true
                end
            end)
        end)
Есть 3 функции пиара, надо сделать чтобы когда вводишь команду /pr они запускались, сначало vr (потом ждет задержку), сразу fam (ждет задержку свою), и за ним сразу al(так ждет задержку) и оно все повторялось пока не выключим снова командой. Не могу разобраться как их запустить друг за другом и в цикл сделать
 
  • Ха-ха
Реакции: Dmitry Code

Ricardo_Miloss

Участник
Автор темы
40
3
Lua:
--- function main()
      sampRegisterChatCommand('pr', function()
                if checkboxes.prmanager.v then
                    pronoroff = not pronoroff;
                    msg(pronoroff and 'Реклама включена.' or 'Реклама выключена.')
                end
                lua_thread.create(youfunction)
        end)
    end
       
function youfunction()
      while true do
            wait(0)
    local delayvr = cfg.settings.delayvr * 1000
    local delayfam = cfg.settings.delayfam * 1000
    local delayal = cfg.settings.delayal * 1000
     if pronoroff and checkboxes.prmanager.v then
          wait(delayvr)
          piarvr()
          wait(delayfam)
          piarfam()
          wait(delayal)
          piaral()
         pronoroff = not pronoroff;
          end
    end
end
не работает(
 

Ricardo_Miloss

Участник
Автор темы
40
3
Код:
function main()
sampRegisterChatCommand('pr', function()
                if checkboxes.prmanager.v then
                    pronoroff = not pronoroff;
                    msg(pronoroff and 'Реклама включена.' or 'Реклама выключена.')
                end
                lua_thread.create(function()
                    if pronoroff and checkboxes.prmanager.v then

                            piarvr()
                            local delayvr = cfg.settings.delayvr * 1000
                            wait(delayvr)

                            piarfam()
                            local delayfam = cfg.settings.delayfam * 1000
                            wait(delayfam)

                            piaral()
                            local delayal = cfg.settings.delayal * 1000
                            wait(delayal)
                    return true
                end
            end)
        end)
end

function piarvr()
    lua_thread.create(function()
        if pronoroff and checkboxes.vr1.v or checkboxes.vr2.v then
            if pronoroff and checkboxes.vr1.v or checkboxes.vr2.v then
                if pronoroff and checkboxes.vr1.v then
                    send('/vr '..u8:decode(buffers.vrmsg1.v))
                end
                if pronoroff and checkboxes.vr2.v then
                    send('/vr '..u8:decode(buffers.vrmsg2.v))
                end
                if pronoroff and checkboxes.vr1.v and checkboxes.vr2.v then
                    send('/vr '..u8:decode(buffers.vrmsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.vrmsg2.v))
                end
            end
        end
    end)
end

function piarfam()
    lua_thread.create(function()
        if pronoroff and checkboxes.fam1.v or checkboxes.fam2.v then
            if pronoroff and checkboxes.fam1.v or checkboxes.fam2.v then
                if pronoroff and checkboxes.fam1.v then
                    send('/vr '..u8:decode(buffers.fammsg1.v))
                end
                if pronoroff and checkboxes.fam2.v then
                    send('/vr '..u8:decode(buffers.fammsg2.v))
                end
                if pronoroff and checkboxes.fam1.v and checkboxes.fam2.v then
                    send('/vr '..u8:decode(buffers.fammsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.fammsg2.v))
                end
            end
        end
    end)
end

function piaral()
    lua_thread.create(function()
        if pronoroff and checkboxes.al1.v or checkboxes.al2.v then
            if pronoroff and checkboxes.al1.v or checkboxes.al2.v then
                if pronoroff and checkboxes.al1.v then
                    send('/vr '..u8:decode(buffers.almsg1.v))
                end
                if pronoroff and checkboxes.al2.v then
                    send('/vr '..u8:decode(buffers.almsg2.v))
                end
                if pronoroff and checkboxes.al1.v and checkboxes.al2.v then
                    send('/vr '..u8:decode(buffers.almsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.almsg2.v))
                end
            end
        end
    end)
end
 

iann1

Новичок
12
2
Код:
function main()
sampRegisterChatCommand('pr', function()
                if checkboxes.prmanager.v then
                    pronoroff = not pronoroff;
                    msg(pronoroff and 'Реклама включена.' or 'Реклама выключена.')
                end
                lua_thread.create(function()
                    if pronoroff and checkboxes.prmanager.v then

                            piarvr()
                            local delayvr = cfg.settings.delayvr * 1000
                            wait(delayvr)

                            piarfam()
                            local delayfam = cfg.settings.delayfam * 1000
                            wait(delayfam)

                            piaral()
                            local delayal = cfg.settings.delayal * 1000
                            wait(delayal)
                    return true
                end
            end)
        end)
end

function piarvr()
    lua_thread.create(function()
        if pronoroff and checkboxes.vr1.v or checkboxes.vr2.v then
            if pronoroff and checkboxes.vr1.v or checkboxes.vr2.v then
                if pronoroff and checkboxes.vr1.v then
                    send('/vr '..u8:decode(buffers.vrmsg1.v))
                end
                if pronoroff and checkboxes.vr2.v then
                    send('/vr '..u8:decode(buffers.vrmsg2.v))
                end
                if pronoroff and checkboxes.vr1.v and checkboxes.vr2.v then
                    send('/vr '..u8:decode(buffers.vrmsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.vrmsg2.v))
                end
            end
        end
    end)
end

function piarfam()
    lua_thread.create(function()
        if pronoroff and checkboxes.fam1.v or checkboxes.fam2.v then
            if pronoroff and checkboxes.fam1.v or checkboxes.fam2.v then
                if pronoroff and checkboxes.fam1.v then
                    send('/vr '..u8:decode(buffers.fammsg1.v))
                end
                if pronoroff and checkboxes.fam2.v then
                    send('/vr '..u8:decode(buffers.fammsg2.v))
                end
                if pronoroff and checkboxes.fam1.v and checkboxes.fam2.v then
                    send('/vr '..u8:decode(buffers.fammsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.fammsg2.v))
                end
            end
        end
    end)
end

function piaral()
    lua_thread.create(function()
        if pronoroff and checkboxes.al1.v or checkboxes.al2.v then
            if pronoroff and checkboxes.al1.v or checkboxes.al2.v then
                if pronoroff and checkboxes.al1.v then
                    send('/vr '..u8:decode(buffers.almsg1.v))
                end
                if pronoroff and checkboxes.al2.v then
                    send('/vr '..u8:decode(buffers.almsg2.v))
                end
                if pronoroff and checkboxes.al1.v and checkboxes.al2.v then
                    send('/vr '..u8:decode(buffers.almsg1.v))
                    wait(7000)
                    send('/vr '..u8:decode(buffers.almsg2.v))
                end
            end
        end
    end)
end
вот:
function main()
    sampRegisterChatCommand('pr', function()
        if checkboxes.prmanager.v then
            pronoroff = not pronoroff
            msg(pronoroff and 'Реклама включена.' or 'Реклама выключена.')
            if pronoroff then
                lua_thread.create(prLoop)
            end
        end
    end)
end

function prLoop()
    while pronoroff do
        if checkboxes.prmanager.v then
            piarvr()
            local delayvr = cfg.settings.delayvr * 1000
            wait(delayvr)

            piarfam()
            local delayfam = cfg.settings.delayfam * 1000
            wait(delayfam)

            piaral()
            local delayal = cfg.settings.delayal * 1000
            wait(delayal)
        end
    end
end

function piarvr()
    if pronoroff and (checkboxes.vr1.v or checkboxes.vr2.v) then
        if checkboxes.vr1.v then
            send('/msg '..u8:decode(buffers.vrmsg1.v))
        end
        if checkboxes.vr2.v then
            send('/msg '..u8:decode(buffers.vrmsg2.v))
        end
        if checkboxes.vr1.v and checkboxes.vr2.v then
            wait(7000)
            send('/msg '..u8:decode(buffers.vrmsg2.v))
        end
    end
end

function piarfam()
    if pronoroff and (checkboxes.fam1.v or checkboxes.fam2.v) then
        if checkboxes.fam1.v then
            send('/msg '..u8:decode(buffers.fammsg1.v))
        end
        if checkboxes.fam2.v then
            send('/msg '..u8:decode(buffers.fammsg2.v))
        end
        if checkboxes.fam1.v and checkboxes.fam2.v then
            wait(7000)
            send('/msg '..u8:decode(buffers.fammsg2.v))
        end
    end
end

function piaral()
    if pronoroff and (checkboxes.al1.v or checkboxes.al2.v) then
        if checkboxes.al1.v then
            send('/msg '..u8:decode(buffers.almsg1.v))
        end
        if checkboxes.al2.v then
            send('/msg '..u8:decode(buffers.almsg2.v))
        end
        if checkboxes.al1.v and checkboxes.al2.v then
            wait(7000)
            send('/msg '..u8:decode(buffers.almsg2.v))
        end
    end
end
 

Похожие темы

  1. Ответы
    1
    Просмотры
    790
  2. Ответы
    2
    Просмотры
    1K
  3. Ответы
    4
    Просмотры
    1K