Jump to content

Question

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 (for L2JFROZEN REV 1132):

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 Rootware

Recommended Posts

  • 0
Posted
4 hours ago, Rootware said:

Try this but check the IP adress method in your sources.


public static void AutoReward()
{
	List<String> ips = new ArrayList<>();
	Collection <L2PcInstance> pls = L2World.getInstance().getAllPlayers();
	for (L2PcInstance p : pls)
	{
		final String ip = p.getConnection().getInetAddress();
		if (ips.contains(ip))
			continue;

		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);

		ips.add(ip);
	}
}

 

Thanks :wincup:

Guest
This topic is now closed to further replies.
×
×
  • Create New...