Jump to content

Help haha code edit


scraw
 Share

Recommended Posts

-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
Link to comment
Share on other sites

  • 3 weeks later...
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
}

 

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.

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.

 Share

×
×
  • 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 Disbaled AdBlock