• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Convert for 1.2 please?

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
Code:
<talkaction words="illegalWords" separator=" " script="proibir.lua"/>

Code:
function getFixedText(cid, text, replace)
    local wrongWords = {"blogsyte.com", "www"}
   
        local lowerText = string.lower(text)
        local noSpaceText = string.gsub(string.gsub(string.gsub(lowerText, "%s", ""), "%p", ""),"-", "")
        for w = 1, #wrongWords do
                wordLen = string.len(wrongWords[w])
                for p = 1, string.len(text) do
                        if(string.sub(lowerText, p, p+wordLen-1) == wrongWords[w]) then
                                text = string.sub(text, 1, p-1) .. string.rep(replace, wordLen) .. string.sub(text, p+wordLen)
                        end
                end
        end
        if(string.lower(text) == lowerText) then
                for c = 1, #wrongWords do
                        if(string.find(noSpaceText, string.gsub(string.gsub(wrongWords[c], "%p", ""),"-", "")) ~= nil) then
                                return "I want to post forbidden links.."
                        end
                end
        end
    return text
end
--[[Channels which are not added to block:
1 - Party Channel
2 - Channel for Staff members
3 - Rule Violation Channel
4 - Channel for Counselors/Tutors
65536 - Private Chat Channel  <-- Private Chat cannot be blocked with this script
]]--
local blocked_channels = {9,4,7} --Advertising, Real Chat, Help Channel
local trade_channels = {5,6} --All trade channels <- Advertising e Advertising-Rookgaard
local replace = "°" --Symbols which are shown instead of forbidden links -> °
local delay = {16249,10} -- {empty_storage, lenght of muted}
function onSay(cid, words, param, channel)
        local fixedWords = getFixedText(cid, words, replace)
        if words ~= fixedWords and getPlayerAccess(cid) == 0 then
                if getPlayerStorageValue(cid,delay[1]) > os.time() then
                        return doPlayerSendCancel(cid,"Voce foi mutado por ".. getPlayerStorageValue(cid,delay[1])-os.time() .." segundos, aqui e proibido divulgar.")
                end
                setPlayerStorageValue(cid,delay[1],os.time()+delay[2])
                if channel == CHANNEL_DEFAULT then
                        doCreatureSay(cid, fixedWords, TALKTYPE_SAY)
                        doPlayerPopupFYI(cid, "Link: "..words.." e proibido, mal educado!.")
                        return true
                elseif isInArray(trade_channels, channel) then
                        doPlayerPopupFYI(cid, "Link: "..words.." e proibido neste canal.")
                        return true
                elseif isInArray(blocked_channels, channel) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Link: "..words.." e proibido, mal educado!.")
                        doPlayerSendChannelMessage(cid, getCreatureName(cid), fixedWords, TALKTYPE_CHANNEL_Y, channel)
                        return true
                end
        end
        return false
end
 
Back
Top