当前位置:首页>>魔兽单机>>正文
魔兽单机中聊天过滤系统
2013-07-17 15:26:37 作者:网络 来源: 浏览次数:0
大概说来就是一套聊天的过滤脚本系统。。适用于T端

    checks[0] ="Styler is gay";
    checks[1] ="Styler is Homosexual";
    checks[2] ="Infusion-WoW Sucks";
    checks[3] ="Fuck Styler";
    checks[4] ="I hate Styler";
    checks[5] ="Styler is retarded";
    checks[6] ="Screw Styler";
    checks[7] ="wow-";
    checks[8] ="-wow";
    checks[9] =".pl";
    checks[10] ="lumiawow is better than Deception";
这些大概就是在游戏中不允许玩家聊天所用的一些词语,例如你可以修改成一些可能玩家骂GM的词语!这样就可以过滤了

这样,就可以在一定程度上禁止魔兽里面脏话什么的~~WOW聊天也比较正常了!

当然,这个脚本系统我还没有测试过,。具体作用希望有兴趣的朋友试试~~~
 
 
#include "ScriptPCH.h"
 
#include "Channel.h"

class System_Censure : public PlayerScript
{
public:
        System_Censure() : PlayerScript("System_Censure") {}

        void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg)
        {
                CheckMessage(player, msg, lang, NULL, NULL, NULL, NULL);
        }

        void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver)
        {
                CheckMessage(player, msg, lang, receiver, NULL, NULL, NULL);
        }

        void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Group* group)
        {
                CheckMessage(player, msg, lang, NULL, group, NULL, NULL);
        }

        void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Guild* guild)
        {
                CheckMessage(player, msg, lang, NULL, NULL, guild, NULL);
        }

        void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Channel* channel)
        {
                CheckMessage(player, msg, lang, NULL, NULL, NULL, channel);
        }

void CheckMessage(Player* player, std::string& msg, uint32 lang, Player* /*receiver*/, Group* /*group*/, Guild* /*guild*/, Channel* channel)
{
    //if (player->isGameMaster() || lang == LANG_ADDON)
            //return;

    // transform to lowercase (for simpler checking)
    std::string lower = msg;
    std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);

    uint8 cheksSize = 11;//Change these if you want to add more words to the array.
    std::string checks[11];//Change these if you want to add more words to the array.
    // Strony (Sites)
    checks[0] ="Styler is gay";
    checks[1] ="Styler is Homosexual";
    checks[2] ="Infusion-WoW Sucks";
    checks[3] ="Fuck Styler";
    checks[4] ="I hate Styler";
    checks[5] ="Styler is retarded";
    checks[6] ="Screw Styler";
    checks[7] ="wow-";
    checks[8] ="-wow";
    checks[9] =".pl";
    checks[10] ="lumiawow is better than Deception";

    for (int i = 0; i < cheksSize; ++i)
        if (lower.find(checks[i]) != std::string::npos)
        {
            msg = "";
            ChatHandler(player->GetSession()).PSendSysMessage("Advertising and vulgar behavior is not allowed!");
            return;
        }
}
};

void AddSC_System_Censure()
{
    new System_Censure();
}

当然,曾经我发过一篇类似的文章,详情见: 聊天,世界喊话过滤系统




相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度