scraw Posted April 28, 2020 Posted April 28, 2020 (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 April 28, 2020 by Rootware
0 scraw Posted April 28, 2020 Author Posted April 28, 2020 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
Question
scraw
-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):
Edited by Rootware16 answers to this question
Recommended Posts