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

string list.

put to list each ppl ip while put ip address check is already exists or no if exists then ppl already rewarded. easy way.

  • 0
Posted

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

 

  • 0
Posted
1 hour 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);
	}
}

 

getClient().getConnection().getInetAddress().getHostAddress()

  • 0
Posted
3 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);
	}
}

 

i tried that .but unsuccesfully..

  • 0
Posted

@Rootware  i insert your code and also @melron but i have this problem: 

 

 

public static void AutoReward ()
 {
 Collection <L2PcInstance> pls = L2World.getInstance (). getAllPlayers ();
 for (L2PcInstance p: pls)
 {
        final String ip =

p.getConnection().getInetAddress().getClient().getConnection().getInetAddress().getHostAddress();
        if (ip.contains(ip))
            continue;
 p.sendMessage ("AutoReward: You got" + Config.AUTO_REWARD_COUNT + "" + Config.NAME_ITEM_REWARD + "for being online");
 p.getInventory (). addItem ("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, null);
}
}

}

/end line

 

and i cant find my sources code for that

  • 0
Posted (edited)

it has to be
p.getClient().getConnection().getInetAddress().getHostAddress();

Edited by BruT
  • 0
Posted
1 minute ago, BruT said:

add getClient() before getConnection()

it work but now i have this

        final String ip = p.getClient().getConnection().getInetAddress().getHostAddress();
        if (ip.contains(ip))
            continue;
 p.sendMessage ("AutoReward: You got" + Config.AUTO_REWARD_COUNT + "" + Config.NAME_ITEM_REWARD + "for being online");
 p.getInventory (). addItem ("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, null);
 ips.add(ip);

}

}

}

  • 0
Posted (edited)

when u hold on the error what does it say?

i guess you forgot the

List<String> ips = new ArrayList<>();
	
Edited by BruT
  • 0
Posted
1 minute ago, BruT said:

when u hold on the error what does it say?

i guess you forgot the


List<String> ips = new ArrayList<>();
	

no it doesnt 

  • 0
Posted
2 minutes ago, BruT said:

when u hold on the error what does it say?

i guess you forgot the


List<String> ips = new ArrayList<>();
	

yes i did forgot that..but now i have this :

 

public static void AutoReward ()
 {
     List<String> ips = new ArrayList<>();
 Collection <L2PcInstance> pls = L2World.getInstance (). getAllPlayers ();
 for (L2PcInstance p: pls)
 {
        final String ip = p.getClient().getConnection().getInetAddress().getHostAddress();
        if (ip.contains(ip))
            continue;
 p.sendMessage ("AutoReward: You got" + Config.AUTO_REWARD_COUNT + "" + Config.NAME_ITEM_REWARD + "for being online");
 p.getInventory (). addItem ("", Config.AUTO_REWARD_ID, Config.AUTO_REWARD_COUNT, p, null);
 ips.add(ip);
 }
}

  • 0
Posted (edited)

control+shift+o and import

 

why you keep breaking the code

at the first place it was

if (ips.contains(ip))

now its
if (ip.contains(ip))

 ?!

Edited by BruT
  • 0
Posted (edited)
3 minutes ago, BruT said:

control+shift+o and import

ok i import them

  .i go check .sec

Edited by scraw
  • 0
Posted
12 minutes ago, BruT said:

control+shift+o and import

 

why you keep breaking the code

at the first place it was

if (ips.contains(ip))

now its
if (ip.contains(ip))

 ?????????????????????????

yes ..you are right !!! FIXED THANKS A LOT . you save me from hours of searching.. also thanks to all who replied

Guest
This topic is now closed to further replies.


  • Posts

    • My official facebook profile!: https://www.facebook.com/spectrumL2 Specifications: Revamped L2JACIS revision FROM the core Private project!!! Revision that has been receiving corrections for over 3 years!!! Events already installed in the revision: TVT CTF KTB PARTY FARM SPOIL EVENT CRAZY RATES TOURNAMENT TIME ZONE (INSTANCE) All working correctly!!! SIEGE ESSENTIAL FEATURES: Walls fix Gates fix Flags fix 100% functional: OLYMPIADS: Implemented settings Hero receives enchanted Weapons with equal status PvP Weapons Optional /true/false Hero can acquire all Hero Weapons Optional true/false OTHER IMPLEMENTATIONS: Teleport fixed (directly to Giran) Teleport effect classic Vip skins vip collor name Pack NPCs with effect already configured BOSES already configured Mobs already configured CLASS BALANCE SPECIAL SYSTEM We have a SPECIAL system developed for Class Balance with only 1 digit in XML %tage of configurable debuffs Player limitation system in BOSES or PvP zones BS blocking system in FLEG zones or events Among others dozens of improvements made in the review... price: 390 USD !  OBS: WE CAN CHANGE THE BANNER AND NAME OF THE SERVICE TO THE ONE OF YOUR PREFERENCE BUT THE SETTINGS MUST BE KEPT ANY CHANGES REQUIRE ADDITION        
    • Server is Online – 1,000+ Active Players! We’re excited to announce the addition of a Europe Proxy to improve connectivity for our EU players! Clans can now benefit from VIP Access to help you catch up faster. 🎯 If you're a clan leader with at least 9 active members, join our Discord and open a ticket to claim your VIP rewards!  
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • The Telegram team is rolling out a new batch of Stars-only gifts you’ll be able to mint as NFTs. Don’t miss your chance to join the next Telegram trend and earn from it! Buy Telegram Stars cheap and KYC-free 1 Star from $0.0149 (min. 50 Stars, bulk discounts available) Promo code STARS5 — 5 % off Pay any way you like: bank cards · crypto · other popular methods How to purchase: ➡Online Store — Click ➡ Telegram bot — Click Other services: ➡ SMM panel — Click Regular buyers get extra discounts and promo codes. Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store Use these contacts to discuss wholesale orders, partnerships (current list: https://socnet.bgng.io/partners) or to become a supplier. SocNet — your shop for digital goods and premium subscriptions
    • 📜 • Mass PVP – Craft – Progressive Server (ITEMS, ARMOR, WEAPONS, ETC) 🕹️ • Chronicles: Lineage 2 - Interlude (C6) 🛠️ • Retail status 🕒 • Server Time: GMT -3 🏙️ • Main Town: Giran ✨ • Teleportation for all Towns, Gk Global 🛡️ • NPC BUFFER - GMSHOP B-GRADE - DONATION SHOP - AUCTION MANAGER 🐉 • Epic Bosses: Chaotic Zones 🔁 • Protection respawn: 15 seconds ⏰ • Restart Server: 05:00 AM Today 💸 • RTM allowed between players (ask Staff if in doubt) 📊 SERVER RATES: • EXP: x8 • SP: x10 • Adena: x3 • Seal Stone: x3 • Drop: x3 • Spoil: x5 • Raid EXP/SP/Drop: x3 • Premium Rates: x2 🌐 Website: https://www.l2roosters.com 💬 Discord: https://discord.gg/cUyYXrfy 🔥 Join us now and forge your legacy at Roosters Gaming!
  • Topics

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