Nome: advertisingBlock
Versão: 2.0
Suportada: Tfs 0.3 e 0.4
Descrição: Bloqueie propagandas de outros servidor eu seu sem ficar recompilando toda hora.
Em configmanager.cpp procure:
m_confNumber[PACKETS_PER_SECOND] = getGlobalNumber("packetsPerSecond", 50);
Abaixo adicione:
m_confString[ADVERTISING_BLOCK] = getGlobalString("advertisingBlock", "");
Em configmanager.h procure:
GAME_PORT,
Abaixo adicione:
ADVERTISING_BLOCK,
Em game.cpp procure:
int32_t muted = 0;
bool mute = player->isMuted(channelId, type, muted);
if(muted && mute)
{
if(muted > 0)
{
char buffer[75];
sprintf(buffer, "You are still muted for %d seconds.", muted);
player->sendTextMessage(MSG_STATUS_SMALL, buffer);
}
else
player->sendTextMessage(MSG_STATUS_SMALL, "You are muted permanently.");
return false;
}
Abaixo adicione:
std::string _text = asLowerCaseString(text);
for(uint8_t i = 0; i < _text.length(); i++)
{
char t = _text[i];
if(t != '-' && t != '.' && !(t >= 'a' && t <= 'z'))
{
_text.erase(i, 1);
i--;
}
}
StringVec strVector;
strVector = explodeString(g_config.getString(ConfigManager::ADVERTISING_BLOCK), ";");
for(StringVec::iterator it = strVector.begin(); it != strVector.end(); ++it)
{
std::string words []= {(*it)};
int ii, length;
length = sizeof(words)/sizeof(words[0]);
for(ii=0; ii < int(length); ii++)
{
if (int(_text.find(words[ii])) > 0 || _text == words[ii])
{
player->sendTextMessage(MSG_STATUS_SMALL, "You can't send this message, forbidden characters.");
return false;
break;
}
}
}
Em config.lua adicione:
advertisingBlock = ""
Configurando:
No config.lua onde tem advertisingBlock = "" substitua para o que deseja bloquear adicionando ; para separar.
Exemplo: advertisingBlock = ".net;servegame;no-ip,.net;.com;.com.br;.org;.pl;.net;.biz"
Créditos:
Comedinha
OTLand (Versão antiga)