Jump to content

Recommended Posts

Posted (edited)

-Hello..i know that noone will answer but i never stop hopping..so get to the point:

 

 

-I have an code for auto-reward every shcelude time "X" but it reward all players in L2World no matter if dualbox or whatever.

-That i want is: Players reward by Ip (only one player) 

 

thats what i have :

Spoiler

 L2JFROZEN REV 1132!!!!\i want to do it individual code:

==============================================
 public static void AutoReward ()
 {
 Collection <L2PcInstance> pls = L2World.getInstance (). getAllPlayers ();
 for (L2PcInstance p: pls)
 {
 p.sendMessage ("AutoReward: You got" + Config.AUTO_REWARD_COUNT + "" + Config.NAME_ITEM_REWARD + "by being online");
 p.getInventory (). addItem ("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, null);
}
}

}

 

Edited by scraw
  • 3 weeks later...
Posted
final Map<String, AtomicInteger> IP = new HashMap<>();
		
for (final L2PcInstance activeChar : L2World.getInstance().getPlayers())
{
	if (IP.computeIfAbsent(activeChar.getIPAddress(), k -> new AtomicInteger()).incrementAndGet() > MAX_REWARD_PER_IP) // MAX_REWARD_PER_IP represent a static var or a config of yours.
	{
        // Skip player since there are more IP's in map than allowed
		continue;
	}
    
    // Your code for reward
}

 

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
Reply to this topic...

×   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...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock