- 1
- 0
Скрипт запускается и нормально работает, но при условии, что я его через команду выключу и обратно включу. В чём может быть дело? И почему, если я удаляю строчки 12, 26-33, то метод sampAddChatMessage() перестаёт работать? (полагаю, что весь код перестаёт работать, а не только метод)
code:
sampev = require "lib.samp.events"
require "lib.moonloader"
local toggle = false
local messageStart = 'сообщение от Дзайбацу'
local messagStop = 'начал задание по доставке груза. Принял:'
local startFlood = false
function main( ... )
if not isSampLoaded() or not isSampfuncsLoaded() then return end
sampRegisterChatCommand("st", struck)
sampAddChatMessage("Struck спамер включён!!", 0xA5FF00)
while true do
wait(0)
while startFlood do
wait(0)
sampSendChat("/struck")
wait(500)
end
end
end
function struck()
if toggle == true then
toggle = false
sampAddChatMessage("Struck спамер выключен!", 0xFF2600)
else
toggle = true
sampAddChatMessage("Struck спамер включён!", 0xA5FF00)
end
function sampev.onServerMessage(color, text)
if toggle == true then
if string.find (text, messageStart , 1, true) then
startFlood = true
end
if string.find (text, messagStop , 1, true) then
startFlood = false
end
end
end
end