Greetings everyone. If the open-tibia team would ever implement a type of talkaction that work for all words at the same time, this script would be very useful and yes, I got the idea from Runescape.
Right now nether open-tibia or any OT distribution support this. Anyway, here is the script:
In data/talkactions/scripts/illegalwords.lua:
The sentence:
Will turn into:
News:
Gesior made a way to make this work.
Credits To Gesior for this code.
Here is the C++ code:
C++ code (TFS 0.3.5 !) execute talkaction 'Allwords' always when anything say something (not spell/talkaction). LUA script must check is it player, channel ...
In source in talkaction.cpp find:
and replace with:
(compile )
in talkactions.xml add:
Right now nether open-tibia or any OT distribution support this. Anyway, here is the script:
In data/talkactions/scripts/illegalwords.lua:
Lua:
local BlockedChannels = {
{channel = CHANNEL_DEFAULT},
{channel = CHANNEL_HELP, type = TALKTYPE_CHANNEL_Y},
{channel = CHANNEL_GUILD, type = TALKTYPE_CHANNEL_Y}
}
local InvalidWords = {
"whore",
"slut",
"fuck",
"mother~fucker"
}
function onSay(cid, words, param, channel)
local TheWords = words .. param
for i, select in ipairs(BlockedChannels) do
if select.channel == channel then
talkType = select.type
break
elseif select.channel ~= channel and i == #BlockedChannels then
return false
end
end
for i = 1, #InvalidWords do
TheWords = TheWords:gsub("(%a*".. nocase(InvalidWords[i]) .."%a*)", doFixString(InvalidWords[i]))
end
if channel == CHANNEL_DEFAULT then
doCreatureSay(cid, TheWords, TALKTYPE_SAY)
else
doPlayerSendChannelMessage(cid, getCreatureName(cid), TheWords, talkType, channel)
end
return true
end
function doFixString(w)
return ("*"):rep(w:len())
end
function nocase(s)
-- From: [url]http://www.lua.org/pil/20.4.html[/url]
return s:gsub("%a", function(c) return ("[%s%s]"):format(c:lower(), c:upper()) end)
end
The sentence:
Code:
Hey you fucktard, get your fucking ass here, bitch!
Will turn into:
Code:
Hey you ********, get your ******* ass here, *****!
News:
Gesior made a way to make this work.
Credits To Gesior for this code.
Here is the C++ code:
C++ code (TFS 0.3.5 !) execute talkaction 'Allwords' always when anything say something (not spell/talkaction). LUA script must check is it player, channel ...
In source in talkaction.cpp find:
PHP:
if(!talkAction || (talkAction->getChannel() != -1 && talkAction->getChannel() != channelId))
return false;
PHP:
if(!talkAction)
{
for(TalkActionsMap::iterator it = talksMap.begin(); it != talksMap.end(); ++it)
{
if(it->first == "Allwords")
{
talkAction = it->second;
break;
}
}
if(talkAction && talkAction->isScripted() && talkAction->executeSay(creature, words, "", channelId))
return true;
return false;
}
else if(talkAction->getChannel() != -1 && talkAction->getChannel() != channelId)
return false;
in talkactions.xml add:
Code:
<talkaction words="Allwords" event="script" value="illegalwords.lua"/>
Last edited: