miguelmig 13 Posted August 3, 2014 Share Posted August 3, 2014 if (!strcmp(ch->LastPlayerMessage, buf) && (thecore_pulse() < (ch->LastMessageAt + SPAM_WAIT_SEC * 25)) && !ch->SpamAllowBuf(buf) You shouldn't hardcode the passes per second as 25, some people might change it... so you should replace * 25 with * passes_per_sec 1 Link to comment Share on other sites More sharing options...
safademirel 289 Posted August 31, 2014 Share Posted August 31, 2014 It looks you forgot to add #include "spamblock.h" to main.cpp. I already added #include "spamblock.h" to main.cpp & cmd_gm.cpp but error is same. OBJDIR/char.o: In function `std::vector<std::string, std::allocator<std::string> >::size() const': /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' OBJDIR/char.o: In function `std::vector<std::string, std::allocator<std::string> >::size() const': /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' OBJDIR/cmd_gm.o: In function `do_reload(CHARACTER*, char const*, int, int)': /usr/src/mainline/Srcs/Server/game/src/cmd_gm.cpp:2132: undefined reference to `LoadBlockSpamList()' /usr/src/mainline/Srcs/Server/game/src/cmd_gm.cpp:2133: undefined reference to `LoadBannSpamList()' OBJDIR/cmd_gm.o: In function `do_reload(CHARACTER*, char const*, int, int)': /usr/src/mainline/Srcs/Server/game/src/cmd_gm.cpp:2132: undefined reference to `LoadBlockSpamList()' /usr/src/mainline/Srcs/Server/game/src/cmd_gm.cpp:2133: undefined reference to `LoadBannSpamList()' OBJDIR/main.o: In function `main': /usr/src/mainline/Srcs/Server/game/src/main.cpp:542: undefined reference to `LoadBlockSpamList()' /usr/src/mainline/Srcs/Server/game/src/main.cpp:543: undefined reference to `LoadBannSpamList()' gmake: *** [../test] Error 1 gmake: *** Waiting for unfinished jobs.... Thank you btw Link to comment Share on other sites More sharing options...
Denis 1474 Posted August 31, 2014 Share Posted August 31, 2014 #include "spamblock.h in cmd_gm.cpp Link to comment Share on other sites More sharing options...
safademirel 289 Posted August 31, 2014 Share Posted August 31, 2014 #include "spamblock.h in cmd_gm.cpp main.cpp #include "fstream" #include "stdafx.h" #include "constants.h" #include "config.h" #include "event.h" #include "minilzo.h" #include "packet.h" #include "desc_manager.h" #include "item_manager.h" #include "char.h" #include "char_manager.h" #include "mob_manager.h" #include "motion.h" #include "sectree_manager.h" #include "shop_manager.h" #include "regen.h" #include "text_file_loader.h" #include "skill.h" #include "pvp.h" #include "party.h" #include "questmanager.h" #include "profiler.h" #include "lzo_manager.h" #include "messenger_manager.h" #include "db.h" #include "log.h" #include "p2p.h" #include "guild_manager.h" #include "dungeon.h" #include "cmd.h" #include "refine.h" #include "banword.h" #include "priv_manager.h" #include "war_map.h" #include "building.h" #include "login_sim.h" #include "target.h" #include "marriage.h" #include "wedding.h" #include "fishing.h" #include "item_addon.h" #include "TrafficProfiler.h" #include "locale_service.h" #include "arena.h" #include "OXEvent.h" #include "monarch.h" #include "polymorph.h" #include "blend_item.h" #include "castle.h" #include "passpod.h" #include "ani.h" #include "BattleArena.h" #include "over9refine.h" #include "horsename_manager.h" #include "pcbang.h" #include "MarkManager.h" #include "spam.h" #include "panama.h" #include "threeway_war.h" #include "auth_brazil.h" #include "DragonLair.h" #include "HackShield.h" #include "skill_power.h" #include "SpeedServer.h" #include "XTrapManager.h" #include "DragonSoul.h" #include <boost/bind.hpp> #include "spamblock.h" #ifndef __WIN32__ #include "limit_time.h" #endif //#define __FILEMONITOR__ #if defined (__FreeBSD__) && defined(__FILEMONITOR__) #include "FileMonitor_FreeBSD.h" #endif #ifdef __AUCTION__ #include "auction_manager.h" #endif #ifndef __WIN32__ #include <gtest/gtest.h> #endif #ifdef USE_STACKTRACE #include <execinfo.h> #endif // À©µµ¿ì¿¡¼ Å×½ºÆ®ÇÒ ¶§´Â Ç×»ó ¼¹öÅ° üũ #ifdef _WIN32 //#define _USE_SERVER_KEY_ #endif #include "check_server.h" char.cpp #include "stdafx.h" #include "../../common/teen_packet.h" #include "../../common/VnumHelper.h" #include "char.h" #include "config.h" #include "utils.h" #include "crc32.h" #include "char_manager.h" #include "desc_client.h" #include "desc_manager.h" #include "buffer_manager.h" #include "item_manager.h" #include "motion.h" #include "vector.h" #include "packet.h" #include "cmd.h" #include "fishing.h" #include "exchange.h" #include "battle.h" #include "affect.h" #include "shop.h" #include "shop_manager.h" #include "safebox.h" #include "regen.h" #include "pvp.h" #include "party.h" #include "start_position.h" #include "questmanager.h" #include "log.h" #include "p2p.h" #include "guild.h" #include "guild_manager.h" #include "dungeon.h" #include "messenger_manager.h" #include "unique_item.h" #include "priv_manager.h" #include "war_map.h" #include "xmas_event.h" #include "banword.h" #include "target.h" #include "wedding.h" #include "mob_manager.h" #include "mining.h" #include "monarch.h" #include "castle.h" #include "arena.h" #include "dev_log.h" #include "horsename_manager.h" #include "pcbang.h" #include "gm.h" #include "map_location.h" #include "BlueDragon_Binder.h" #include "HackShield.h" #include "skill_power.h" #include "XTrapManager.h" #include "buff_on_attributes.h" #include "spamblock.h" #ifdef __PET_SYSTEM__ #include "PetSystem.h" #endif #include "DragonSoul.h" cmd_gm.cpp #include "stdafx.h" #include "utils.h" #include "config.h" #include "desc_client.h" #include "desc_manager.h" #include "char.h" #include "char_manager.h" #include "item_manager.h" #include "sectree_manager.h" #include "mob_manager.h" #include "packet.h" #include "cmd.h" #include "regen.h" #include "guild.h" #include "guild_manager.h" #include "p2p.h" #include "buffer_manager.h" #include "fishing.h" #include "mining.h" #include "questmanager.h" #include "vector.h" #include "affect.h" #include "db.h" #include "priv_manager.h" #include "building.h" #include "battle.h" #include "arena.h" #include "start_position.h" #include "party.h" #include "monarch.h" #include "castle.h" #include "BattleArena.h" #include "xmas_event.h" #include "log.h" #include "pcbang.h" #include "threeway_war.h" #include "unique_item.h" #include "DragonSoul.h" #include "spamblock.h" Error is same. Link to comment Share on other sites More sharing options...
Keselth 0 Posted November 16, 2014 Share Posted November 16, 2014 up Link to comment Share on other sites More sharing options...
danutzu1995 0 Posted December 4, 2014 Share Posted December 4, 2014 #include "spamblock.h in cmd_gm.cpp main.cpp #include "fstream" #include "stdafx.h" #include "constants.h" #include "config.h" #include "event.h" #include "minilzo.h" #include "packet.h" #include "desc_manager.h" #include "item_manager.h" #include "char.h" #include "char_manager.h" #include "mob_manager.h" #include "motion.h" #include "sectree_manager.h" #include "shop_manager.h" #include "regen.h" #include "text_file_loader.h" #include "skill.h" #include "pvp.h" #include "party.h" #include "questmanager.h" #include "profiler.h" #include "lzo_manager.h" #include "messenger_manager.h" #include "db.h" #include "log.h" #include "p2p.h" #include "guild_manager.h" #include "dungeon.h" #include "cmd.h" #include "refine.h" #include "banword.h" #include "priv_manager.h" #include "war_map.h" #include "building.h" #include "login_sim.h" #include "target.h" #include "marriage.h" #include "wedding.h" #include "fishing.h" #include "item_addon.h" #include "TrafficProfiler.h" #include "locale_service.h" #include "arena.h" #include "OXEvent.h" #include "monarch.h" #include "polymorph.h" #include "blend_item.h" #include "castle.h" #include "passpod.h" #include "ani.h" #include "BattleArena.h" #include "over9refine.h" #include "horsename_manager.h" #include "pcbang.h" #include "MarkManager.h" #include "spam.h" #include "panama.h" #include "threeway_war.h" #include "auth_brazil.h" #include "DragonLair.h" #include "HackShield.h" #include "skill_power.h" #include "SpeedServer.h" #include "XTrapManager.h" #include "DragonSoul.h" #include <boost/bind.hpp> #include "spamblock.h" #ifndef __WIN32__ #include "limit_time.h" #endif //#define __FILEMONITOR__ #if defined (__FreeBSD__) && defined(__FILEMONITOR__) #include "FileMonitor_FreeBSD.h" #endif #ifdef __AUCTION__ #include "auction_manager.h" #endif #ifndef __WIN32__ #include <gtest/gtest.h> #endif #ifdef USE_STACKTRACE #include <execinfo.h> #endif // À©µµ¿ì¿¡¼ Å×½ºÆ®ÇÒ ¶§´Â Ç×»ó ¼¹öÅ° üũ #ifdef _WIN32 //#define _USE_SERVER_KEY_ #endif #include "check_server.h" char.cpp #include "stdafx.h" #include "../../common/teen_packet.h" #include "../../common/VnumHelper.h" #include "char.h" #include "config.h" #include "utils.h" #include "crc32.h" #include "char_manager.h" #include "desc_client.h" #include "desc_manager.h" #include "buffer_manager.h" #include "item_manager.h" #include "motion.h" #include "vector.h" #include "packet.h" #include "cmd.h" #include "fishing.h" #include "exchange.h" #include "battle.h" #include "affect.h" #include "shop.h" #include "shop_manager.h" #include "safebox.h" #include "regen.h" #include "pvp.h" #include "party.h" #include "start_position.h" #include "questmanager.h" #include "log.h" #include "p2p.h" #include "guild.h" #include "guild_manager.h" #include "dungeon.h" #include "messenger_manager.h" #include "unique_item.h" #include "priv_manager.h" #include "war_map.h" #include "xmas_event.h" #include "banword.h" #include "target.h" #include "wedding.h" #include "mob_manager.h" #include "mining.h" #include "monarch.h" #include "castle.h" #include "arena.h" #include "dev_log.h" #include "horsename_manager.h" #include "pcbang.h" #include "gm.h" #include "map_location.h" #include "BlueDragon_Binder.h" #include "HackShield.h" #include "skill_power.h" #include "XTrapManager.h" #include "buff_on_attributes.h" #include "spamblock.h" #ifdef __PET_SYSTEM__ #include "PetSystem.h" #endif #include "DragonSoul.h" cmd_gm.cpp #include "stdafx.h" #include "utils.h" #include "config.h" #include "desc_client.h" #include "desc_manager.h" #include "char.h" #include "char_manager.h" #include "item_manager.h" #include "sectree_manager.h" #include "mob_manager.h" #include "packet.h" #include "cmd.h" #include "regen.h" #include "guild.h" #include "guild_manager.h" #include "p2p.h" #include "buffer_manager.h" #include "fishing.h" #include "mining.h" #include "questmanager.h" #include "vector.h" #include "affect.h" #include "db.h" #include "priv_manager.h" #include "building.h" #include "battle.h" #include "arena.h" #include "start_position.h" #include "party.h" #include "monarch.h" #include "castle.h" #include "BattleArena.h" #include "xmas_event.h" #include "log.h" #include "pcbang.h" #include "threeway_war.h" #include "unique_item.h" #include "DragonSoul.h" #include "spamblock.h" Error is same. Same error ... Link to comment Share on other sites More sharing options...
Minion 74 Posted December 6, 2014 Share Posted December 6, 2014 to do so he was looking for words of similar blockspamlist.lst. You can write 1www.metin2.ru, if in the block, then 2www.metin2.ru Link to comment Share on other sites More sharing options...
daredevil09 5 Posted December 22, 2014 Share Posted December 22, 2014 Must compile this file: spamblock.cpp and spamblock.h? how? Link to comment Share on other sites More sharing options...
Denis 1474 Posted December 22, 2014 Share Posted December 22, 2014 Put them into Makefile 3 Link to comment Share on other sites More sharing options...
daredevil09 5 Posted December 22, 2014 Share Posted December 22, 2014 Work perfect !! thanks Link to comment Share on other sites More sharing options...
Sr.Agente 24 Posted August 5, 2015 Share Posted August 5, 2015 (edited) #include "spamblock.h in cmd_gm.cpp main.cpp #include "fstream" #include "stdafx.h" #include "constants.h" #include "config.h" #include "event.h" #include "minilzo.h" #include "packet.h" #include "desc_manager.h" #include "item_manager.h" #include "char.h" #include "char_manager.h" #include "mob_manager.h" #include "motion.h" #include "sectree_manager.h" #include "shop_manager.h" #include "regen.h" #include "text_file_loader.h" #include "skill.h" #include "pvp.h" #include "party.h" #include "questmanager.h" #include "profiler.h" #include "lzo_manager.h" #include "messenger_manager.h" #include "db.h" #include "log.h" #include "p2p.h" #include "guild_manager.h" #include "dungeon.h" #include "cmd.h" #include "refine.h" #include "banword.h" #include "priv_manager.h" #include "war_map.h" #include "building.h" #include "login_sim.h" #include "target.h" #include "marriage.h" #include "wedding.h" #include "fishing.h" #include "item_addon.h" #include "TrafficProfiler.h" #include "locale_service.h" #include "arena.h" #include "OXEvent.h" #include "monarch.h" #include "polymorph.h" #include "blend_item.h" #include "castle.h" #include "passpod.h" #include "ani.h" #include "BattleArena.h" #include "over9refine.h" #include "horsename_manager.h" #include "pcbang.h" #include "MarkManager.h" #include "spam.h" #include "panama.h" #include "threeway_war.h" #include "auth_brazil.h" #include "DragonLair.h" #include "HackShield.h" #include "skill_power.h" #include "SpeedServer.h" #include "XTrapManager.h" #include "DragonSoul.h" #include <boost/bind.hpp> #include "spamblock.h" #ifndef __WIN32__ #include "limit_time.h" #endif //#define __FILEMONITOR__ #if defined (__FreeBSD__) && defined(__FILEMONITOR__) #include "FileMonitor_FreeBSD.h" #endif #ifdef __AUCTION__ #include "auction_manager.h" #endif #ifndef __WIN32__ #include <gtest/gtest.h> #endif #ifdef USE_STACKTRACE #include <execinfo.h> #endif // À©µµ¿ì¿¡¼ Å×½ºÆ®ÇÒ ¶§´Â Ç×»ó ¼¹öÅ° üũ #ifdef _WIN32 //#define _USE_SERVER_KEY_ #endif #include "check_server.h" char.cpp #include "stdafx.h" #include "../../common/teen_packet.h" #include "../../common/VnumHelper.h" #include "char.h" #include "config.h" #include "utils.h" #include "crc32.h" #include "char_manager.h" #include "desc_client.h" #include "desc_manager.h" #include "buffer_manager.h" #include "item_manager.h" #include "motion.h" #include "vector.h" #include "packet.h" #include "cmd.h" #include "fishing.h" #include "exchange.h" #include "battle.h" #include "affect.h" #include "shop.h" #include "shop_manager.h" #include "safebox.h" #include "regen.h" #include "pvp.h" #include "party.h" #include "start_position.h" #include "questmanager.h" #include "log.h" #include "p2p.h" #include "guild.h" #include "guild_manager.h" #include "dungeon.h" #include "messenger_manager.h" #include "unique_item.h" #include "priv_manager.h" #include "war_map.h" #include "xmas_event.h" #include "banword.h" #include "target.h" #include "wedding.h" #include "mob_manager.h" #include "mining.h" #include "monarch.h" #include "castle.h" #include "arena.h" #include "dev_log.h" #include "horsename_manager.h" #include "pcbang.h" #include "gm.h" #include "map_location.h" #include "BlueDragon_Binder.h" #include "HackShield.h" #include "skill_power.h" #include "XTrapManager.h" #include "buff_on_attributes.h" #include "spamblock.h" #ifdef __PET_SYSTEM__ #include "PetSystem.h" #endif #include "DragonSoul.h" cmd_gm.cpp #include "stdafx.h" #include "utils.h" #include "config.h" #include "desc_client.h" #include "desc_manager.h" #include "char.h" #include "char_manager.h" #include "item_manager.h" #include "sectree_manager.h" #include "mob_manager.h" #include "packet.h" #include "cmd.h" #include "regen.h" #include "guild.h" #include "guild_manager.h" #include "p2p.h" #include "buffer_manager.h" #include "fishing.h" #include "mining.h" #include "questmanager.h" #include "vector.h" #include "affect.h" #include "db.h" #include "priv_manager.h" #include "building.h" #include "battle.h" #include "arena.h" #include "start_position.h" #include "party.h" #include "monarch.h" #include "castle.h" #include "BattleArena.h" #include "xmas_event.h" #include "log.h" #include "pcbang.h" #include "threeway_war.h" #include "unique_item.h" #include "DragonSoul.h" #include "spamblock.h" Error is same. Same error ... same error Edited August 6, 2015 by Sr.Agente Link to comment Share on other sites More sharing options...
Migxelito 10 Posted August 5, 2015 Share Posted August 5, 2015 (edited) OBJDIR/char.o: In function `std::vector<std::string, std::allocator<std::string>>::size() const': /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' OBJDIR/cmd_gm.o: In function `do_reload(CHARACTER*, char const*, int, int)': /root/workspace/Server/game/src/cmd_gm.cpp:2131: undefined reference to `LoadBlockSpamList()' /root/workspace/Server/game/src/cmd_gm.cpp:2132: undefined reference to `LoadBannSpamList()' OBJDIR/main.o: In function `main': /root/workspace/Server/game/src/main.cpp:541: undefined reference to `LoadBlockSpamList()' /root/workspace/Server/game/src/main.cpp:542: undefined reference to `LoadBannSpamList()' gmake: *** [../gamefile] Error 1 Edited August 5, 2015 by Crox Link to comment Share on other sites More sharing options...
asterix2 349 Posted January 1, 2016 Share Posted January 1, 2016 On 2015. 08. 05. at 1:19 AM, Crox said: OBJDIR/char.o: In function `std::vector<std::string, std::allocator<std::string>>::size() const': /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBlockListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' /usr/include/c++/4.2/bits/stl_vector.h:408: undefined reference to `SpamBannListArray' OBJDIR/cmd_gm.o: In function `do_reload(CHARACTER*, char const*, int, int)': /root/workspace/Server/game/src/cmd_gm.cpp:2131: undefined reference to `LoadBlockSpamList()' /root/workspace/Server/game/src/cmd_gm.cpp:2132: undefined reference to `LoadBannSpamList()' OBJDIR/main.o: In function `main': /root/workspace/Server/game/src/main.cpp:541: undefined reference to `LoadBlockSpamList()' /root/workspace/Server/game/src/main.cpp:542: undefined reference to `LoadBannSpamList()' gmake: *** [../gamefile] Error 1 Add makefile .cpp Link to comment Share on other sites More sharing options...
Cyclone_DE 9 Posted January 8, 2016 Share Posted January 8, 2016 People cant also use multiple times heart emoticons e.t.c, can it be an exclusion for these? Link to comment Share on other sites More sharing options...
yunusemredamgaci 0 Posted January 5, 2017 Share Posted January 5, 2017 thank you very nice @Sanchez good job like Link to comment Share on other sites More sharing options...
lordzokarum 2 Posted April 9, 2017 Share Posted April 9, 2017 perfect. Link to comment Share on other sites More sharing options...
emanuel 18 Posted March 8, 2018 Share Posted March 8, 2018 La 2/13/2014 la 15:40, Sanchez a spus: Hi, In this thread I will show you how you can implement an advanced spam protection to your server. The player can write the same message just after 5 seconds. The player will receive 1 minute of chat ban if he is trying to send the same message more than 3 times in 5 seconds. You can specify a blockspamlist.lst file which contains words. If the user sending a message which contains a words from the list, the player will receive 5 minutes of chat ban. (You can specify the time of the chat ban) You can specify a bannspamlist.lst file which contains words. If the user sending a message which contains a words from the list, the player will receive a ban. (You can specify the time of the ban) Open game/input_main.cpp and search for this: if (ch->IncreaseChatCounter() >= 10) Add this over that: if (!strcmp(ch->LastPlayerMessage, buf) && (thecore_pulse() < (ch->LastMessageAt + SPAM_WAIT_SEC * 25)) && !ch->SpamAllowBuf(buf) && ch->GetGMLevel() < GM_LOW_WIZARD) { if (ch->BlockChatAfter < 2) { ch->ChatPacket(CHAT_TYPE_INFO, ("You must wait 5 seconds to repeat your message")); ch->BlockChatAfter++; return iExtraLen; } else { ch->BlockChatAfter = 0; ch->PlayerPunish(false, SPAM_CHAT_BAN_TIME); return iExtraLen; } } else { if (!ch->BannListCheck(buf) && ch->GetGMLevel() < GM_LOW_WIZARD) { ch->PlayerPunish(true, SPAM_BAN_TIME); return iExtraLen; } if (!ch->SpamListCheck(buf) && ch->GetGMLevel() < GM_LOW_WIZARD) { ch->ChatPacket(CHAT_TYPE_INFO, ("You wrote a not allowed words!")); ch->PlayerPunish(false, SPAM_CHAT_BAN_TIME); return iExtraLen; } } Still in input_main.cpp search for this: ch->GetMapIndex(), strlen(ch->GetName()))); Add this under that: strcpy(ch->LastPlayerMessage, buf); ch->LastMessageAt = thecore_pulse(); ch->BlockChatAfter = 0; Open game/char.h and search for this: BYTE GetChatCounter() const; Add this under that: int LastMessageAt; int BlockChatAfter; char LastPlayerMessage[CHAT_MAX_LEN + 1]; void PlayerPunish(bool PowerPunish, int Duration); bool SpamListCheck(const char *Message); bool BannListCheck(const char *Message); bool SpamAllowBuf(const char *Message); Open game/char.cpp and add these events: void CHARACTER::PlayerPunish(bool PowerPunish, int Duration) { if (!PowerPunish) { AddAffect(AFFECT_BLOCK_CHAT, POINT_NONE, 0, AFF_NONE, Duration, 0, true); sys_log(0, "%s[%d] has been chatbanned because of spamming/writing words which are in the spamlist.txt", GetName(), GetPlayerID()); } else { std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET availDt = FROM_UNIXTIME(UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) + %i) WHERE id = %d", Duration, GetAID())); sys_log(0, "%s[%d] has been banned because of saying blacklisted word", GetName(), GetPlayerID()); GetDesc()->DelayedDisconnect(5); } } bool CHARACTER::SpamAllowBuf(const char *Message) { if (!strcmp(Message, "(Ȳ´ç)") || !strcmp(Message, "(µ·)") || !strcmp(Message, "(±â»Ý)") || !strcmp(Message, "(ÁÁľĆ)") || !strcmp(Message, "(»ç¶ű)") || !strcmp(Message, "(şĐłë)") || !strcmp(Message, "(ľĆÇĎ)") || !strcmp(Message, "(żěżď)") || !strcmp(Message, "(ÁËĽŰ)")) { return true; } return false; } bool CHARACTER::SpamListCheck(const char *Message) { for (int i = 0; i < SpamBlockListArray.size(); i++) { if (!strcmp(Message, SpamBlockListArray[i].c_str())) { return false; } } return true; } bool CHARACTER::BannListCheck(const char *Message) { for (int i = 0; i < SpamBannListArray.size(); i++) { if (!strcmp(Message, SpamBannListArray[i].c_str())) { return false; } } return true; } Add 2 new files to your project: spamblock.cpp spamblock.h Add these to the spamblock.cpp #include "fstream" #include "string" #include "sstream" #include "stdafx.h" #include "../../common/length.h" std::vector<std::string> SpamBlockListArray; std::vector<std::string> SpamBannListArray; void LoadBlockSpamList() { std::string TempBlockList; std::ifstream File("chat/blockspamlist.lst"); if (!File.is_open()) { sys_log(0, "WARNING: cannot open chat/blockspamlist.lst"); return; } SpamBlockListArray.clear(); while (!File.eof()) { File >> TempBlockList; SpamBlockListArray.push_back(TempBlockList); } File.close(); } void LoadBannSpamList() { std::string TempBannList; std::ifstream File("chat/bannspamlist.lst"); if (!File.is_open()) { sys_log(0, "WARNING: cannot open chat/bannspamlist.lst"); return; } SpamBannListArray.clear(); while (!File.eof()) { File >> TempBannList; SpamBannListArray.push_back(TempBannList); } File.close(); } Add these to the spamblock.h #include "string" #include "../../common/length.h" extern void LoadBlockSpamList(); extern void LoadBannSpamList(); extern std::vector<std::string> SpamBlockListArray; extern std::vector<std::string> SpamBannListArray; Add this to game/char.cpp #include "spamblock.h" Add this to game/main.cpp #include "spamblock.h" Search for this in game/main.cpp: PanamaLoad(); Add these under that: LoadBlockSpamList(); LoadBannSpamList(); Open common/length.h and add these: SPAM_WAIT_SEC = 5, // The player can duplicate his message after 5 sec SPAM_CHAT_BAN_TIME = 60, // The player will receive 60 seconds chat ban, if he is saying a spamlist word SPAM_BAN_TIME = 3600, // The player will receive 1 hour ban, if he is saying a banlist word Open game/cmd_gm.cpp and search for this event: ACMD(do_reload) Add this to the switch function: case 'b': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading bann/spam list infomations."); LoadBlockSpamList(); LoadBannSpamList(); sys_log(0, "Reloading bann/spam list infomations."); break; Add this to the top of the file: #include "spamblock.h" How to set up: Make sure you added everything to your game Create a new folder called chat in your channels Create 2 files, blockspamlist.lst and bannspamlist.lst Upload the words to these files Restart your server blockspamlist.lst example: obsceneword1 obsceneword2 obsceneword3 obsceneword4 bannspamlist.lst example: WWW.CHEAP-FARM-SERVICE.COM WWW.CHEAP-GOLD.COM WWW.EASY-HACKS.COM WWW.FREE-YANG.COM If you have any question or suggestion, please just reply to this topic. Kind Regards,Sanchez Hi budy,can you make that system for Whisper too ? not just for chat? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now