Код: Выделить всё
ProfAllow = { -- 1 - Разрешаем писать запрещенные слова 0 - запрещаем
[0] = 1, -- Мастер
[1] = 1, -- Оператор
[2] = 0, -- VIP
[3] = 0, -- Зарегистрированный пользователь
[-1] = 0, -- Незарегистрированный пользователь
}
adverTable = { -- Маска запрещенных сочетаний
"avangard-hub","ban",
}
function ToArrival(tUser,sData)
local s,e,msg = string.find(sData,"%b<>%s(.*)")
if not (ProfAllow[tUser.iProfile]==1) then
msg = StringLower(msg)
if checkForAdvertising(msg) then
return true
end
end
end
function checkForAdvertising(msg)
for i = 1,#adverTable do
if string.find( msg , adverTable[i] , 1 , true ) then
return 1
end
end
end
function StringLower(msg)
local res = ""
local Byte, Len = nil, string.len(msg)
msg = string.lower(msg)
for i = 1, Len do
Byte = string.byte(msg, i)
if (Byte >= 192) and (Byte < 224) then
Byte = Byte + 32
end
if (Byte == 168) or (Byte == 184) then Byte = 229 end
res = res..string.char(Byte)
end
return res
end