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

[FIXED] Remove text from casted spells TFS 0.3.6pl1

cbrm

Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,599
Solutions
3
Reaction score
972
Location
Caribbean Sea
I once requested that for a 0.2 distro. But it didn't work.
http://otland.net/f133/0-2-need2add-anti-spam-emotespells-51168/

How can I modify sources @ TFS 0.3.6pl1, so players don't spam when they use spells like:

exura"Rox0r! -> should only return 'exura' above player
utani hur"fAst fAst fAst should only return 'utani hur' above player

I was told to parse the text.:confused:
 
Last edited:
isnt there an option in config.lua called "emoteSpells = true" or "emoteSpells = "yes""?

yes you can change that in config.lua
I'm not talking about orange spells
When you emote spells you can add text too

exura "Bla bla bla
Light Healing:bla bla bla

Code:
ReturnValue Spells::onPlayerSay(Player* player, const std::string& words)
{
    std::string reWords = words;
    trimString(reWords);

    InstantSpell* instantSpell = getInstantSpell(reWords);
    if(!instantSpell)
        return RET_NOTPOSSIBLE;

    size_t size = instantSpell->getWords().length();
    std::string param = reWords.substr(size, reWords.length() - size), reParam = "";
    if(instantSpell->getHasParam() && !param.empty() && param[0] == ' ')
    {
        size_t quote = param.find('"', 1);
        if(quote != std::string::npos)
        {
            size_t tmp = param.find('"', quote + 1);
            if(tmp == std::string::npos)
                tmp = param.length();

            reParam = param.substr(quote + 1, tmp - quote - 1);
        }
        else if(param.find(' ', 1) == std::string::npos)
            reParam = param.substr(1, param.length());

        trimString(reParam);
    }

    if(!instantSpell->playerCastInstant(player, reParam))
        return RET_NEEDEXCHANGE;

    SpeakClasses type = SPEAK_SAY;
    if(g_config.getBool(ConfigManager::EMOTE_SPELLS))
        type = SPEAK_MONSTER_SAY;

    if(!g_config.getBool(ConfigManager::SPELL_NAME_INSTEAD_WORDS))
        return g_game.internalCreatureSay(player, type, reWords, player->isGhost()) ?
            RET_NOERROR : RET_NOTPOSSIBLE;

    std::string ret = instantSpell->getName();
    if(param.length())
    {
        trimString(param);
        size_t tmp = 0, rtmp = param.length();
        if(param[0] == '"')
            tmp = 1;

        if(param[rtmp] == '"')
            rtmp -= 1;

        ret += ": " + param.substr(tmp, rtmp);
    }

    return g_game.internalCreatureSay(player, type, ret, player->isGhost()) ?
        RET_NOERROR : RET_NOTPOSSIBLE;
}
 
Last edited:
thanks, but I already fixed it by myself: (Emoted Spells)

Code:
ret += "";
 
Last edited:
Back
Top