Не работает авто принятие админ форм

weq_dev

Новичок
Автор темы
8
0
Версия MoonLoader
.026-beta
Вообщем суть в чём нашёл я исходник одного админ тулса с открытым кодом и решил его сделать для своего сервера но вот с одним не могу разобрать как мне настроить авто принятие форм под вот такой админ чат.если нужно вот код самой системы авто принятия
Lua:
    if elements.checkbox.formsEnabled.v then
        for k,v in ipairs(allForms) do
            if color == -1191240961 then
                if text:match("%[.*%] "..getMyNick().."%["..getMyId().."%]%: /"..v.."%s") then
                    return true
                else
                    if text:match("%[.*%] (%w+_?%w+)%[(%d+)%]%: /"..v.."%s") then
                        admin_nick, admin_id, admin_other = text:match("%[.*%] (%w+_?%w+)%[(%d+)%]%: /"..v.."%s(.*)")
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Пришла форма, чтобы принять ее нажмите >> K <<', stColor)
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Чтобы отклонить ее нажмите >> P <<', stColor)
                        active_forma = true
                        lua_thread.create(function()
                            lasttime = os.time()
                            lasttimes = 0
                            time_out = elements.int.timeOutForma.v
                            while lasttimes < time_out do
                                lasttimes = os.time() - lasttime
                                wait(0)
                                printStyledString("ADMIN FORM " .. time_out - lasttimes .. " WAIT", 1000, 4)
                                if stop_forma then
                                    printStyledString('Form already accepted', 1000, 4)
                                    stop_forma = false
                                    break
                                end
                                if lasttimes == time_out then
                                    printStyledString("Forma skipped", 1000, 4)
                                end
                                if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString("Admin form accepted", 1000, 4)
                                    sampSendChat("/"..v.." "..admin_other.." || "..admin_nick)
                                    wait(1000)
                                    sampSendChat('/a [Forma] +')
                                    LsessionForma = LsessionForma + 1
                                    HLcfg.config.dayForms = HLcfg.config.dayForms + 1
                                    save()
                                    active_forma = false
                                    break
                                elseif isKeyJustPressed(VK_P) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString('You missed the form', 1000, 4)
                                    active_forma = false
                                    break
                                end
                            end
                        end)
                    end
                end
            end
        end
    end
    if active_forma then
        if text:find('%[.*%] (%w+_?%w+)%[(%d+)%]%: %[Forma%] +') then
            active_forma = false
            stop_forma = true
        end
    end
end


1665161906052.png
 

weq_dev

Новичок
Автор темы
8
0
ну так ты сравни текст который ищешь и который у тебя в чат логе)
На сервере ид в (1) а в скрипте [1]
Я пытался менять ничего не изменилось, если правильно понял то в 3 местах же нужно менять
 
Последнее редактирование:

Sadow

Известный
1,454
602
Lua:
    if elements.checkbox.formsEnabled.v then
        for k,v in ipairs(allForms) do
                if text:match(".+ "..getMyNick().."%("..getMyId().."%): .+") then
                    return true
                else
                    if text:match("%[(.+)%] (.+)%((%d+)%):  /"..v.."%s") then
                        admin_lvl, admin_nick, admin_id, admin_other = text:match("%[(.+)%] (.+)%((%d+)%): ")
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Пришла форма, чтобы принять ее нажмите >> K <<', stColor)
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Чтобы отклонить ее нажмите >> P <<', stColor)
                        active_forma = true
                        lua_thread.create(function()
                            lasttime = os.time()
                            lasttimes = 0
                            time_out = elements.int.timeOutForma.v
                            while lasttimes < time_out do
                                lasttimes = os.time() - lasttime
                                wait(0)
                                printStyledString("ADMIN FORM " .. time_out - lasttimes .. " WAIT", 1000, 4)
                                if stop_forma then
                                    printStyledString('Form already accepted', 1000, 4)
                                    stop_forma = false
                                    break
                                end
                                if lasttimes == time_out then
                                    printStyledString("Forma skipped", 1000, 4)
                                end
                                if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString("Admin form accepted", 1000, 4)
                                    sampSendChat("/"..v.." "..admin_other.." || "..admin_nick)
                                    wait(1000)
                                    sampSendChat('/a [Forma] +')
                                    LsessionForma = LsessionForma + 1
                                    HLcfg.config.dayForms = HLcfg.config.dayForms + 1
                                    save()
                                    active_forma = false
                                    break
                                elseif isKeyJustPressed(VK_P) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString('You missed the form', 1000, 4)
                                    active_forma = false
                                    break
                                end
                            end
                        end)
                end
            end
        end
    end
    if active_forma then
        if text:find('%[.*%] (%w+_?%w+)%[(%d+)%]%: %[Forma%] +') then
            active_forma = false
            stop_forma = true
        end
    end
end
Проверь
 
  • Нравится
Реакции: weq_dev

weq_dev

Новичок
Автор темы
8
0
Lua:
    if elements.checkbox.formsEnabled.v then
        for k,v in ipairs(allForms) do
                if text:match(".+ "..getMyNick().."%("..getMyId().."%): .+") then
                    return true
                else
                    if text:match("%[(.+)%] (.+)%((%d+)%):  /"..v.."%s") then
                        admin_lvl, admin_nick, admin_id, admin_other = text:match("%[(.+)%] (.+)%((%d+)%): ")
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Пришла форма, чтобы принять ее нажмите >> K <<', stColor)
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Чтобы отклонить ее нажмите >> P <<', stColor)
                        active_forma = true
                        lua_thread.create(function()
                            lasttime = os.time()
                            lasttimes = 0
                            time_out = elements.int.timeOutForma.v
                            while lasttimes < time_out do
                                lasttimes = os.time() - lasttime
                                wait(0)
                                printStyledString("ADMIN FORM " .. time_out - lasttimes .. " WAIT", 1000, 4)
                                if stop_forma then
                                    printStyledString('Form already accepted', 1000, 4)
                                    stop_forma = false
                                    break
                                end
                                if lasttimes == time_out then
                                    printStyledString("Forma skipped", 1000, 4)
                                end
                                if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString("Admin form accepted", 1000, 4)
                                    sampSendChat("/"..v.." "..admin_other.." || "..admin_nick)
                                    wait(1000)
                                    sampSendChat('/a [Forma] +')
                                    LsessionForma = LsessionForma + 1
                                    HLcfg.config.dayForms = HLcfg.config.dayForms + 1
                                    save()
                                    active_forma = false
                                    break
                                elseif isKeyJustPressed(VK_P) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString('You missed the form', 1000, 4)
                                    active_forma = false
                                    break
                                end
                            end
                        end)
                end
            end
        end
    end
    if active_forma then
        if text:find('%[.*%] (%w+_?%w+)%[(%d+)%]%: %[Forma%] +') then
            active_forma = false
            stop_forma = true
        end
    end
end
Проверь
Никакой реакции
 

Sadow

Известный
1,454
602
А щас?
Lua:
    if elements.checkbox.formsEnabled.v then
        for k,v in ipairs(allForms) do
                if text:match("%[(.+)%] "..getMyNick().."%("..getMyId().."%)%: /"..v.."%s") then
                    return true
                else
                    if text:match("%[(.+)%] (%w+_?%w+)%[(%d+)%]%: /"..v.."%s") then
                        admin_nick, admin_id, admin_other = text:match("%[(.+)%] (%w+_?%w+)%((%d+)%)%: /"..v.."%s(.*)")
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Пришла форма, чтобы принять ее нажмите >> K <<', stColor)
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Чтобы отклонить ее нажмите >> P <<', stColor)
                        active_forma = true
                        lua_thread.create(function()
                            lasttime = os.time()
                            lasttimes = 0
                            time_out = elements.int.timeOutForma.v
                            while lasttimes < time_out do
                                lasttimes = os.time() - lasttime
                                wait(0)
                                printStyledString("ADMIN FORM " .. time_out - lasttimes .. " WAIT", 1000, 4)
                                if stop_forma then
                                    printStyledString('Form already accepted', 1000, 4)
                                    stop_forma = false
                                    break
                                end
                                if lasttimes == time_out then
                                    printStyledString("Forma skipped", 1000, 4)
                                end
                                if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString("Admin form accepted", 1000, 4)
                                    sampSendChat("/"..v.." "..admin_other.." || "..admin_nick)
                                    wait(1000)
                                    sampSendChat('/a [Forma] +')
                                    LsessionForma = LsessionForma + 1
                                    HLcfg.config.dayForms = HLcfg.config.dayForms + 1
                                    save()
                                    active_forma = false
                                    break
                                elseif isKeyJustPressed(VK_P) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString('You missed the form', 1000, 4)
                                    active_forma = false
                                    break
                                end
                            end
                        end)
                end
            end
        end
    end
    if active_forma then
        if text:find('%[(.+)%] (%w+_?%w+)%((%d+)%)%: %[Forma%] +') then
            active_forma = false
            stop_forma = true
        end
    end
end
 
Последнее редактирование:
  • Нравится
Реакции: weq_dev

weq_dev

Новичок
Автор темы
8
0
А щас?
Lua:
    if elements.checkbox.formsEnabled.v then
        for k,v in ipairs(allForms) do
                if text:match("%[(.+)%] "..getMyNick().."%("..getMyId().."%)%: /"..v.."%s") then
                    return true
                else
                    if text:match("%[(.+)%] (%w+_?%w+)%[(%d+)%]%: /"..v.."%s") then
                        admin_nick, admin_id, admin_other = text:match("%[(.+)%] (%w+_?%w+)%((%d+)%)%: /"..v.."%s(.*)")
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Пришла форма, чтобы принять ее нажмите >> K <<', stColor)
                        sampAddChatMessage('{FF0000}[AdminTools] {FF8C00}Чтобы отклонить ее нажмите >> P <<', stColor)
                        active_forma = true
                        lua_thread.create(function()
                            lasttime = os.time()
                            lasttimes = 0
                            time_out = elements.int.timeOutForma.v
                            while lasttimes < time_out do
                                lasttimes = os.time() - lasttime
                                wait(0)
                                printStyledString("ADMIN FORM " .. time_out - lasttimes .. " WAIT", 1000, 4)
                                if stop_forma then
                                    printStyledString('Form already accepted', 1000, 4)
                                    stop_forma = false
                                    break
                                end
                                if lasttimes == time_out then
                                    printStyledString("Forma skipped", 1000, 4)
                                end
                                if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString("Admin form accepted", 1000, 4)
                                    sampSendChat("/"..v.." "..admin_other.." || "..admin_nick)
                                    wait(1000)
                                    sampSendChat('/a [Forma] +')
                                    LsessionForma = LsessionForma + 1
                                    HLcfg.config.dayForms = HLcfg.config.dayForms + 1
                                    save()
                                    active_forma = false
                                    break
                                elseif isKeyJustPressed(VK_P) and not sampIsChatInputActive() and not sampIsDialogActive() then
                                    printStyledString('You missed the form', 1000, 4)
                                    active_forma = false
                                    break
                                end
                            end
                        end)
                end
            end
        end
    end
    if active_forma then
        if text:find('%[(.+)%] (%w+_?%w+)%((%d+)%)%: %[Forma%] +') then
            active_forma = false
            stop_forma = true
        end
    end
end
тоже ничего