Jump to content
  • 0

Chat Flood Protector


Xman3000

Question

If someone knows how to create a script with flood protector for Trade and Shout chat please let me know! Example: You can use Trade chat when you reach 200 PvP's or You can use Shout chat when you reach 100 PvP's. That can be a great thing becouse players will make PvP's to use one of those chats and spammers with advertising or insults can't do nothing! I wait answer if someone can help me!

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0
Index: D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java
===================================================================
--- D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java	(revision 2785)
+++ D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java	(working copy)
@@ -42,27 +42,15 @@
	 */
	public void handleChat(int type, L2PcInstance activeChar, String target, String text)
	{
-		CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
-		
-		Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
-		
-		if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
+		if((activeChar.getPvpKills() >= 100) || (activeChar.isGM()))
		{
-			for (L2PcInstance player : pls)
-			{
-				if (!BlockList.isBlocked(player, activeChar))
-					player.sendPacket(cs);
-			}
-			
-		}
-		else if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("limited"))
-		{
-			int region = MapRegionTable.getInstance().getMapRegion(activeChar.getX(), activeChar.getY());
+			CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
+		
+			Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();		
			//synchronized (L2World.getInstance().getAllPlayers())
			{
				for (L2PcInstance player : pls)
-					if (region == MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()) && !BlockList.isBlocked(player, activeChar) && player.getInstanceId() == activeChar.getInstanceId())
-						player.sendPacket(cs);
+				player.sendPacket(cs);
			}
		}
	}
Index: D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java
===================================================================
--- D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java	(revision 2785)
+++ D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java	(working copy)
@@ -42,28 +42,17 @@
	 */
	public void handleChat(int type, L2PcInstance activeChar, String target, String text)
	{
-		CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
-		
-		Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
-				
-		if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.isGM()))
+		if((activeChar.getPvpKills() >= 200) || (activeChar.isGM()))
		{
-			int region = MapRegionTable.getInstance().getMapRegion(activeChar.getX(), activeChar.getY());
+			CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
+		
+			Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();		
			//synchronized (L2World.getInstance().getAllPlayers())
			{
				for (L2PcInstance player : pls)
-					if (region == MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()) && !BlockList.isBlocked(player, activeChar) && player.getInstanceId() == activeChar.getInstanceId())
-						player.sendPacket(cs);
+				player.sendPacket(cs);
			}
		}
-		else if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("global"))
-		{
-			for (L2PcInstance player : pls)
-			{
-				if (!BlockList.isBlocked(player, activeChar))
-					player.sendPacket(cs);
-			}
-		}
	}

	/**

Link to comment
Share on other sites

  • 0

Wow! Really thanks man, but if you can teach me where to insert that will be great!

Index: D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatTrade.java

-

Index: D:/L2HauntedStory/L2_GameServer/java/net/sf/l2j/gameserver/handler/chathandlers/ChatShout.java

-

 

Link to comment
Share on other sites

  • 0

Really thanks guys! If that working on Freya you are the best :)

 

"if ((activeChar.getPvpKills() >= 100) || (activeChar.isGM()))" works on all chronicles.

Link to comment
Share on other sites

  • 0

It really works 100%, but the system floodprotector will stop working for chats ... :P

 

# GlobalChat - global chat flooding

FloodProtectorGlobalChatInterval = 100

 

#

FloodProtectorGlobalChatLogFlooding = False

 

#

FloodProtectorGlobalChatPunishmentLimit = 0

 

#

FloodProtectorGlobalChatPunishmentType = none

 

#

FloodProtectorGlobalChatPunishmentTime = 0

 

 

:D

Link to comment
Share on other sites

  • 0

I see, it's a nice and perfect script but I can't put it ... I need someone who can :D

 

I can help ya if you have eclipse already installed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...