Не работает часть скрипта Lua

Diego_Sativa

Известный
Автор темы
578
59
Версия SA-MP
  1. 0.3.7-R2
Почему не работает эта часть? Как исправить?
Lua:
while true do wait(600)-- задержка 2000 мс
        if cooke then
            sampSendChat("/fish cook") -- сообщение для отправки
        end -- закрываем проверку
    end --закрываем цикл

Весть скрипт.
Lua:
script_author('checkdasound')

local events = require ('samp.events')
require ('moonloader')
require('memory').fill(0x00531155, 0x90, 5, true)

local act = false
local cooke = false
local state = false -- по умолчанию отключаем статус переменной для команды при запуске гта

function main() --открываем главную функцию
    while not isSampAvailable() do wait(100) end -- проверка на то, загружен ли самп
	sampRegisterChatCommand('rblk', rblk)
    sampRegisterChatCommand('worm', worm)	--регистрация команды
	sampRegisterChatCommand('cook', cook)
    while true do wait(2000)-- задержка 2000 мс
        if state then
            sampSendChat("/fish findworm") -- сообщение для отправки
        end -- закрываем проверку
    end --закрываем цикл
	
	while true do wait(600)-- задержка 2000 мс
        if cooke then
            sampSendChat("/fish cook") -- сообщение для отправки
        end -- закрываем проверку
    end --закрываем цикл
end --закрываем главную функцию

function cook()--создаем функцию, к которой обращается команда
    cooke = not cooke
    if cooke then -- проверяем статус переменной
        sampAddChatMessage('Приготовление начато.', -1) --информируем в чат пользователя
    else
        sampAddChatMessage('Приготовление окончено.', -1)
    end --закрываем проверку
end --закрываем функцию

function worm()--создаем функцию, к которой обращается команда
    state = not state
    if state then -- проверяем статус переменной
        sampAddChatMessage('Поиск червей включён.', -1) --информируем в чат пользователя
    else
        sampAddChatMessage('Поиск червей отключен.', -1)
    end --закрываем проверку
end --закрываем функцию

function rblk()
	act = not act
	if act then
		sampAddChatMessage('Бот рыбалки включен.', -1)
	else
		sampAddChatMessage('Бот рыбалки выключен.', -1)
	end
end

function events.onDisplayGameText(style, time, text)
	-- print('Style: '..style..' Time: '..time..' Text: '..text)
	if act then
		if style == 6 and text == '~n~~n~~y~!' or style == 6 and text == '~n~~n~~n~~r~!' then
			lua_thread.create(function()
				lockPlayerControl(true)
				setVirtualKeyDown(VK_LMENU, true)
				wait(50)
				setVirtualKeyDown(VK_LMENU, false)
				lockPlayerControl(false)
			end)
		end
	end
end

function events.onServerMessage(color, text)
	-- print('Color: '..color..' Text: '..text)
	if act then
		if color == -1342193921 then
			if text:find('Вы оснастили') or text:find('Вы наживили') or text:find('Вы поймали') then
				lua_thread.create(function()
					wait(3500)
					lockPlayerControl(true)
					setVirtualKeyDown(VK_LMENU, true)
					wait(50)
					setVirtualKeyDown(VK_LMENU, false)
					lockPlayerControl(false)
				end)
			elseif text:find('Рыба сорвалась') then
			
				test = math.random(1, 20)
				print(test)
				lua_thread.create(function()
					if test == 12 or test == 20 then
						wait(1000)
						setVirtualKeyDown(VK_D, true)
						wait(50)
						setVirtualKeyDown(VK_D, false)
						wait(2450)
						lockPlayerControl(true)
						setVirtualKeyDown(VK_LMENU, true)
						wait(50)
						setVirtualKeyDown(VK_LMENU, false)
						lockPlayerControl(false)
					else
						wait(3500)
						lockPlayerControl(true)
						setVirtualKeyDown(VK_LMENU, true)
						wait(50)
						setVirtualKeyDown(VK_LMENU, false)
						lockPlayerControl(false)
					end
				end)
			end
		end
	end
end
и еще скажите что это
Lua:
require('memory').fill(0x00531155, 0x90, 5, true)