• 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!

TalkAction Block IPs/links on Default/Trade/Help/Private [TFS 0.4 and OTX only]

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,966
Solutions
99
Reaction score
3,383
Location
Poland
GitHub
gesior
For TFS 0.3.5 I made script: http://otland.net/threads/lua-and-c-block-ips-links-on-default-trade-help.50954/
For TFS 0.3.6 it's almost the same (check link to updated version by Summ).

but for TFS 0.4 and OTX you can use other script! :)

This script DOES NOT REQUIRE C++ (source) changes!

This script uses other 'detection algorithm' which is much better and block all 'tricks' like...
block 'better-ot.hopto.org' blocks also:
better-ot hopto org
better-ot ANGRY!! hopto org
better-ot h o p t o o rg
WTF?! Cant I say better!!!-!!!ot!!hopto!!org??
In talkactions.xml add (awesome 'default' option only in TFS 0.4 and OTX):
PHP:
<talkaction words="illegalWords" default="1" script="blocklinks.lua"/>
script:
PHP:
local blockedLinks = {'wp.pl', 'better-ot.hopto.org'}

local muteStorage = 16246
local muteTime = 2 -- in seconds
-- END OF CONFIG --

local blockedLinksData = {}
local separator = '[ !\t%$%^%+%-%.%%_,<>]*'
for _, linkText in pairs(blockedLinks) do
    local data = {}
    data.link = linkText

    data.preg = '.*'
    for c in string.gmatch(linkText, '.') do
        if(c == '.') then
            data.preg = data.preg .. '.*'
        else
            data.preg = data.preg .. c .. separator
        end
    end
    data.preg = data.preg .. '.*'

    table.insert(blockedLinksData, data)
end

function isLegalMessage(words)
    for _, blockedLink in pairs(blockedLinksData) do
        if(string.match(words, blockedLink.preg) ~= nil) then
            return false, blockedLink.link
        end
    end
    return true, ''
end

function onSay(cid, words, param, channel)
    words = words .. ' ' .. param
    local legalMessage, forbiddenLink = isLegalMessage(
string.lower(words))

    if(not legalMessage) then
        local muteStorageValue = getPlayerStorageValue(cid, muteStorage)
        if(muteStorageValue > os.time()) then
            doPlayerSendCancel(cid, 'You are still muted for ' .. muteStorageValue-os.time() .. ' seconds.')
            return true
        end
        setPlayerStorageValue(cid, muteStorage, os.time()+muteTime)

        if(channel == CHANNEL_DEFAULT) then
            doCreatureSay(cid, '...', TALKTYPE_SAY)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Link: ' .. forbiddenLink .. ' is forbidden.')
        return true
    end
    return false
end
 
Last edited:
Nice :D

One small error:
for example with "wp.pl"
I can beat it by saying: Wp.pl
I would have to add it in with all possible combinations: wp.pl, Wp.pl, wP.pl, wp.Pl, wp.pL, WP.pl, wP.Pl, etc etc

Is there away to get around that?
 
Good script!! but there is a issue, if u put a forbidden link in a F1-F12, in some point the forbidden link appears.

Tested on OTx.

1.png
2.png
 
Nice :D

One small error:
for example with "wp.pl"
I can beat it by saying: Wp.pl
I would have to add it in with all possible combinations: wp.pl, Wp.pl, wP.pl, wp.Pl, wp.pL, WP.pl, wP.Pl, etc etc

Is there away to get around that?
Added 'string.lower', this problem is fixed, about hotkey, idk. I will check in sources.
 
Hi gesiorI need When Any One Buy From Shop Offer Castle Doll And Use It Give HIm The Castle Automatic When He Use it
 
Good script!! but there is a issue, if u put a forbidden link in a F1-F12, in some point the forbidden link appears.

Tested on OTx.

1.png
2.png
Tested with GOD char on OTX (8.60, based on TFS 0.3.7) and it does not work. No matter if I use F1 or say it in game. Script blocks both.

Hi gesiorI need When Any One Buy From Shop Offer Castle Doll And Use It Give HIm The Castle Automatic When He Use it
I don't have any castle script. Sorry.
 
In OTx the players have an anti-spam in talkactions, so thats why in a GOD doesn't happen. Try with a player.
 
I tried with normal player and it does not work. Hmm.. (I mean that it shows '...' - system block message).
 
It's a shame i can't use it :( can you make it for c++? I really want to use it :D
 
Send me your sources in .zip (.cpp and .h), so I can check what can be wrong.
When you say it by 'type and click enter' it blocks illegal words, but when you set hotkey with text and 'auto send' and press 'F1' it does not? Is it client 8.6?
 
Tested with GOD char on OTX (8.60, based on TFS 0.3.7) and it does not work. No matter if I use F1 or say it in game. Script blocks both.


I don't have any castle script. Sorry.

yeah its true when u type for example otland.net 1x it will be blocked, but if u type it and spam it in the row for example 10x times in 1 min, it will blocks like 8 time and 2 time not blocked
 
Send me your sources in .zip (.cpp and .h), so I can check what can be wrong.
When you say it by 'type and click enter' it blocks illegal words, but when you set hotkey with text and 'auto send' and press 'F1' it does not? Is it client 8.6?

Thank for wanna help me, I solved it editing talkaction.cpp :p
 
@StreamSide Sure

Find:
Code:
bool TalkActions::onPlayerSay

Search and remove:
Code:
if(!player->canDoExAction())
return false;

Search and remove:
Code:
if(!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges))
player->setNextExAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::CUSTOM_ACTIONS_DELAY_INTERVAL) - 10);

The time for ExAction can be edited in config.lua but there is more of that in sources, so i recommend just remove it from talkactions.cpp
 
@StreamSide Sure

Find:
Code:
bool TalkActions::onPlayerSay

Search and remove:
Code:
if(!player->canDoExAction())
return false;

Search and remove:
Code:
if(!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges))
player->setNextExAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::CUSTOM_ACTIONS_DELAY_INTERVAL) - 10);

The time for ExAction can be edited in config.lua but there is more of that in sources, so i recommend just remove it from talkactions.cpp

thanks for that, helpful for me and for other members :rolleyes:
 
This script only blocks " better-ot.hopto.org "
How do can i make it blocks ".net.com.org.pl.se.eu" ?
I tried with that and it doesn't work.
{'Wp.pl', '.org, .net, ,.com, .se, .eu, .pl, .eg'}.
 
Back
Top