В чём моя ошибка?

я не клоун

Активный
Автор темы
134
25
Версия MoonLoader
Другое
Добрый день, я новичёк в луа, буквально 1 день, мне бы было интересно в чём моя ошибка здесь?

Lua:
function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(9000) end
  sampAddChatMessage('{0000CD} Aктивация: /sliv ')
  sampAddChatMessage('{7CFC00} Aвтором чуда является: help_me ')
 
 while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("sliv", function()
      sampSendChat("/apanel")
      end)
         while true do
       wait(0)
        if state then
            if os.clock() - time >= 1 then -- 1 sek
                sampSendChat('/apanel')
                time = os.clock()
end)
wait(-1)

end
 

Rice.

Известный
Модератор
1,753
1,660
🙀🙀🙀
Эмать, ну как так можно
Тогда уж лучше так

Lua:
local st, timer = false, 0

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
        sampAddChatMessage('{0000CD} Aктивация: /sliv ')
        sampAddChatMessage('{7CFC00} Aвтором чуда является: help_me ')
        sampRegisterChatCommand("sliv", function() st = not st print(st and 'true' or 'false') end)
    while true do wait(0)
        if st and os.time() > timer then -- если st равен true и время больше таймера то
            local xz = math.random(0, sampGetMaxPlayerId()) -- переменная с рандомным числом от 0 до макс кол-во чел на сервере
            if sampIsPlayerConnected(xz) then -- проверка подк ли игрок
                sampSendChat('/ban '..xz..' 30 Читы') -- отправляет смс в час
                timer = os.clock() + 1 -- 1 сек
            end
        end
    end
end
Lua:
math.randomseed(os.clock())
local xz = math.random(0, sampGetMaxPlayerId())
 

SomaGnoma

Известный
429
148
Lua:
local penis = false -- булевая переменная отвечающая за работу "перебора"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("govno", function() -- регаешь кмд /govno с функцией
    penis = not penis -- меняет значение переменной на противоположное
    end)
    while true do wait(0) -- бесконечный цикл
        if penis then -- если переменная равна true то
        math.randomseed(os.clock()) -- задаешь последовательность генератору чисел
        sampSendChat(("/ban %s 30 mq"):format(math.random(0, sampGetMaxPlayerId()))) -- шлешь в чат /ban (рандом) 30 mq
        end
    end
end
В целом код будет примерно вот такой, учи основы(
 
  • Bug
Реакции: Rice.