Hi Everyone
i am looking for Anti-Advertisement For my Trinity Core
Help me Please i need it
Hi Everyone
i am looking for Anti-Advertisement For my Trinity Core
Help me Please i need it
Don’t run an illegal public server?
Oh god the irony…
This is solution to prevent players to spam www links
[CODE]
#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 = 7;
std::string checks[cheksSize];
checks[0] ="http://";
checks[1] =".com";
checks[2] =".net";
checks[3] =".org";
checks[4] =".ru";
checks[5] ="rondor";
checks[6] ="www.";
for (int i = 0; i < cheksSize; ++i)
if (lower.find(checks[i]) != std::string::npos)
{
msg = "";
ChatHandler(player).PSendSysMessage("Adverts are not allowed!");
return;
}
}
};
void AddSC_System_Censure()
{
new System_Censure();
}[/CODE]
Bump!!
Tnx Dude
There were a few Compile errors…
Change:
ChatHandler(player)
to
ChatHandler(player->GetSession())
And Change:
uint8 cheksSize = 1;
To…
const uint8 cheksSize = 1;
Compiles now. Tested in-game, and works fine. Hope that helps someone /emoticons/default_biggrin.png
How Can Mute player when Checked ?
i mean when Type > www.
get Mute For 5Min And get spell [Polymorph] (Mage)
i Try Loop but dont Work
It Must Try Spam And Get Mute With worldserver.conf
but Only Say 1x “i am Sorry”
for (int i = 0; i < cheksSize; ++i) if (lower.find(checks[I]) != std::string::npos) { for (int z = 0; z <= 20; ++z) { msg = "i am Sorry"; ChatHandler(player).PSendSysMessage("Adverts are not allowed!"); } return; }[/I]
its very simple, ‘msg’ gets send when the whole check functions are finished, not when it gets a new value.
You know what, this code doesn’t really work for me.
Seems solid to me actually. Make sure that you don’t do “const uint8 cheksSize = 1;”, but “const uint8 cheksSize = 7” /emoticons/default_wink.png
I would even go as far and set a variable for the cheksSize that can be changed accordingly. Depends, really.
I’ve set it to like 11 because I had 11 lines to check right. Still didn’t work, no matter how simple the word was.
Yes it’s in scriptloader and cmake!
But yes I agree, I’d have it load values from a database with a dynamic cheksSize
For sure this is better, but must be updated to work on head.