Баг со скриптом

Мади Зияда / Shon Dope

Потрачен
Автор темы
121
54
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
У меня есть скрипт keyspoof на команду /time, есть баг, когда нажимаешь кнопку чтобы включить/выключить скрипт, скрипт обратно уже не включится, только через CTRL + R а это не совсем удобно, можете пожалуйста по фиксить как то? добавить функцию в код отдельную которая будет выключать скрипт. Скрипт ниже.
up
 

Вложения

  • time (2).lua
    1.4 KB · Просмотры: 70
Последнее редактирование:
Решение
возможно из-за того что у тебя две переменных с одинаковым названием выполняют разные функции
этот код работает:
Lua:
local act = false
act_key = "]"

function main()
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("{FFFF00}[KeySpoof]{FFFFFF} (/time) {FFFFFF}был загружен. Активация: "..act_key, -1)
    while true do wait(0)
        if testCheat(act_key) then
           
            if not act then
                act = true
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Включен.', -1)
            else
                act = false
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Выключен.', -1)
            end
        end
        if act then
            if sampIsChatInputActive() then
                text =...

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,228
возможно из-за того что у тебя две переменных с одинаковым названием выполняют разные функции
этот код работает:
Lua:
local act = false
act_key = "]"

function main()
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("{FFFF00}[KeySpoof]{FFFFFF} (/time) {FFFFFF}был загружен. Активация: "..act_key, -1)
    while true do wait(0)
        if testCheat(act_key) then
           
            if not act then
                act = true
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Включен.', -1)
            else
                act = false
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Выключен.', -1)
            end
        end
        if act then
            if sampIsChatInputActive() then
                text = sampGetChatInputText()
                textLength = string.len(text)
                print(textLength)
                if textLength == 1 and text ~= "/" then
                    sampSetChatInputText("/")
                elseif textLength == 2 and text ~= "/t" then
                    sampSetChatInputText("/t")
                elseif textLength == 3 and text ~= "/ti" then
                    sampSetChatInputText("/ti")
                elseif textLength == 4 and text ~= "/tim" then
                    sampSetChatInputText("/tim")
                elseif textLength == 5 and text ~= "/time" then
                    lua_thread.create(function()
                        sampSetChatInputText("/time")
                        wait(100)
                        sampProcessChatInput("/time")
                    end)
                elseif textLength > 5 and text ~= "/time" then
                    sampSetChatInputText("/time")
                end
            end
        end
    end
end
 

loooooooooooooooool

Новичок
9
12
возможно из-за того что у тебя две переменных с одинаковым названием выполняют разные функции
этот код работает:
Lua:
local act = false
act_key = "]"

function main()
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("{FFFF00}[KeySpoof]{FFFFFF} (/time) {FFFFFF}был загружен. Активация: "..act_key, -1)
    while true do wait(0)
        if testCheat(act_key) then
          
            if not act then
                act = true
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Включен.', -1)
            else
                act = false
                sampAddChatMessage('{FFFF00}[KeySpoof]{FFFFFF} Выключен.', -1)
            end
        end
        if act then
            if sampIsChatInputActive() then
                text = sampGetChatInputText()
                textLength = string.len(text)
                print(textLength)
                if textLength == 1 and text ~= "/" then
                    sampSetChatInputText("/")
                elseif textLength == 2 and text ~= "/t" then
                    sampSetChatInputText("/t")
                elseif textLength == 3 and text ~= "/ti" then
                    sampSetChatInputText("/ti")
                elseif textLength == 4 and text ~= "/tim" then
                    sampSetChatInputText("/tim")
                elseif textLength == 5 and text ~= "/time" then
                    lua_thread.create(function()
                        sampSetChatInputText("/time")
                        wait(100)
                        sampProcessChatInput("/time")
                    end)
                elseif textLength > 5 and text ~= "/time" then
                    sampSetChatInputText("/time")
                end
            end
        end
    end
end
не знаешь какую строку вырезать чтобы убрать авто ентер?
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,776
11,228
не знаешь какую строку вырезать чтобы убрать авто ентер?
1612467174390.png