Краш.

G W

Участник
Автор темы
141
5
Версия MoonLoader
.026-beta
Когда пытаюсь кому то заблокировать чат при помощи "CTRL" крашет сразу. Где тут ошибка ?

Lua:
require "moonloader"
local samp = require 'lib.samp.events'

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(2000) end
  
    while true do

        if isKeyJustPressed(VK_LCONTROL) and active then
            active = false
            sampAddChatMessage('/mute '..testid..' 15')
        end

    wait(0)
    end
end

function samp.onServerMessage(color, text)

    testid, msg = text:match('.+%[(%d+)]: (.+)')

    if color == -849584982 then
        sampAddChatMessage('Чтобы выдать мут нажмите клавишу CTRL', -1)
        active = true
    end
end