крашит скрипт

Oki_Bern

Участник
Автор темы
169
6
Версия MoonLoader
Другое
Скрипт крашит после того как воспроизводится вот эта функция:
Lua:
    if text:find('Вы приняли адреналин. Эффект продлится 15 минут') and ini.set.autoadr then
        wait(1000)
        kddf = false
        wait(897000)
        kddf = true
    end
Весь код:
Lua:
local perelom = false
local cough = false

local directIni = 'adrenalin.ini'

local inicfg = require 'inicfg'
local ini = inicfg.load({
    set = {
        autoadr = true,
    }}, directIni)
inicfg.save(ini, directIni)
local kddf = true
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('autoadr', function()
       ini.set.autoadr = not ini.set.autoadr
       sampAddChatMessage(ini.set.autoadr and "{FF0000}[AutoAdrenalin{FFFAFA} Активирован" or "{FF0000}[AutoAdrenalin]{FFFAFA} Деактивирован", -1)
       inicfg.save(ini, directIni)
    end)
    while true do wait(0)


        if perelom then
            sampSendChat("/adr")
            wait(30)
            sampSetSpecialAction(68)
            wait(50)
            sampSetSpecialAction(0)
            perelom = false
        end

        if cough then
            sampSetSpecialAction(68)
            wait(50)
            sampSetSpecialAction(0)
            cough = false
        end
    end
end



local samp = require('samp.events')

function samp.onServerMessage(color, text)
    if text:find('~~~~~~~~ У вас началась ломка ~~~~~~~~') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('У вас болит нога') and ini.set.autoadr and kddf or text:find('У вас болит рука') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('Вас ранили в правую руку') and ini.set.autoadr and kddf or text:find('Вас ранили в правую ногу') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('Вас ранили в левую руку') and ini.set.autoadr and kddf or text:find('Вас ранили в левую ногу') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('Вас перелом правой ноги') and ini.set.autoadr and kddf or text:find('Вас перелом левой ноги') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('Вас перелом правой руки') and ini.set.autoadr and kddf or text:find('Вас перелом левой руки') and ini.set.autoadr and kddf then
        perelom = true
    end

    if text:find('У вас приступ кашля') and ini.set.autoadr and kddf then
        cough = true
    end 

    if text:find('Вы приняли адреналин. Эффект продлится 15 минут') and ini.set.autoadr then
        wait(1000)
        kddf = false
        wait(897000)
        kddf = true
    end
end