sBot = SetMan.GetString(21) BanTime = 60 -- время бана в минутах sReason = "Поиск детского порно" -- Причина бана -- Кого нужно проверять (1 - да, 0 - нет) -- CanDo = { [-1] = 1, -- Незарегестрированный [0] = 0, -- Мастер [1] = 0, -- ОП [2] = 1, -- Вип [3] = 1, -- Зарегестрированный } --------------------------------------------------------------------------------------------- -- если в таблицу вносятся фразы, то вместо пробела нужно ставить знак $ --------------------------------------------------------------------------------------------- -- Запрещаем adverTable = { "pedo$","детское","teen$","pthc$","малолет","педо", } -- Исключения safeTable = { "torpedo","торпедо","детское$питание", } function SearchArrival(tUser,sData) if CanDo[tUser.iProfile] == 0 then return false end local s,e,msg = string.find(sData,"$Search %S+%s%S+?%S+?%S+?%S+?(.*)|") msg = StringLower(msg) if checkForAdvertising(msg) then if checkForSafe(msg) then return nil end Core.SendToOps("<"..sBot.."> *** Запрещенный поиск! Юзер: <"..tUser.sNick.."> с ip "..tUser.sIP.." искал: "..msg) Core.SendToUser(tUser,"<"..sBot.."> *** Вы были забанены за поиск детской порнографии!") BanMan.TempBan(tUser,BanTime,sReason,sBot,true) end end function checkForAdvertising(msg) for _,v in ipairs(adverTable) do if string.find(msg, v) then return true end end return false end function checkForSafe(msg) for _,v in ipairs(safeTable) do if string.find(msg, v) then return true end end return false 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