- Версия MoonLoader
- Другое
Что не так в коде, если в консольке от сампфункса вылазит ошибка
консоль сампфункса:
[ML] (error) Admin Tools by Bruskin: C:\Games\GTA San Andreas\moonloader\Bruskinatools.lua:131: bad argument #1 to 'find' (string expected, got nil)
stack traceback:
[C]: in function 'find'
C:\Games\GTA San Andreas\moonloader\Bruskinatools.lua:131: in function 'callback'
...ames\GTA San Andreas\moonloader\lib\samp\events\core.lua:77: in function 'process_event'
...ames\GTA San Andreas\moonloader\lib\samp\events\core.lua:100: in function 'process_packet'
...ames\GTA San Andreas\moonloader\lib\samp\events\core.lua:119: in function <...ames\GTA San Andreas\moonloader\lib\samp\events\core.lua:118>
[ML] (error) Admin Tools by Bruskin: Script died due to an error. (0EFC7C94)
131 строка:
if command:find(data.pattern) then
Lua:
local sampev = require("samp.events")
local patterns = {
{orig = "mute", pattern = "неадек (%d+)", time = "10", reason = "Оск. игроков"},
{orig = "ban", pattern = "оскадм (%d+)", time = "2", reason = "Оск. Администрации"},
{orig = "jail", pattern = "дм (%d+)", time = "15", reason = "Death Match (DM)"},
{orig = "jail", pattern = "гкоп (%d+)", time = "10", reason = "Cop in ghetto"},
{orig = "warn", pattern = "нрпкоп (%d+)", time = "НРП", reason = "коп"},
{orig = "mute", pattern = "мг (%d+)", time = "10", reason = "Meta Gaming (MG)"},
{orig = "jail", pattern = "чит (%d+)", time = "60", reason = "Cheating"},
{orig = "mute", pattern = "флуд (%d+)", time = "10", reason = "Flood"},
{orig = "mute", pattern = "капс (%d+)", time = "10", reason = "Caps Lock"},
{orig = "mute", pattern = "упомрод (%d+)", time = "60", reason = "Упом. родни"},
{orig = "ban", pattern = "оскрод (%d+)", time = "1", reason = "Оск. родни"},
{orig = "jail", pattern = "тк (%d+)", time = "15", reason = "Team Kill (TK)"},
{orig = "jail", pattern = "ск (%d+)", time = "30", reason = "Spawn Kill (SK)"},
{orig = "jail", pattern = "дб (%d+)", time = "15", reason = "Drive By (DB)"},
{orig = "jail", pattern = "пг (%d+)", time = "10", reason = "Power Gaming (PG)"},
{orig = "ban", pattern = "вред (%d+)", time = "30", reason = "Вред. читы"},
{orig = "warn", pattern = "читыфрака (%d+)", time = "Читы", reason = "(фракция)"},
{orig = "veh", pattern = "nrg (%d+)", time = "522", reason = "0"},
{orig = "mute", patterm = "бред (%d+)", time = "10", reason = "Бред в РП чаты"},
{orig = "mute", pattern = "мат (%d+)", time = "10", reason = "мат OOC"},
{orig = "mute", pattern = "массфлуд (%d+)", time = "60", reason = "Масс флуд"},
{orig = "jail", pattern = "сбив (%d+)", time = "15", reason = "сбив анимации"},
{orig = "jail", pattern = "срыврп (%d+)", time = "60", reason = "Срыв РП"},
{orig = "ban", pattern = "оскник (%d+)", time = "7", reason = "оск NickName"},
{orig = "ban", pattern = "оскпр (%d+)", time = "7", reason = "Оскорбление проекта"}
}
function sampev.onSendCommand(command)
for _, data in ipairs(patterns) do
if command:find(data.pattern) then
command = ("/%s %s %s %s"):format(data.orig, command:match(data.pattern), data.time, data.reason)
return {command}
end
end
end