Jump to content
  • 0

Anti-Dualbox In Queen Ant


Question

Posted (edited)

I am trying to implement anti dualbox when entering the Queen ant zone. I already have a level check, which is working fine.
 But I need to add a check so that no more PCs with the same IP can enter


Could someone help me? I don't know why the IP check doesn't work for me

 

I am a newbie at this 🙏 Use Java 8

private void checkCharacter(L2Character character, boolean isPet)
	{
		
		final L2PcInstance player = character.getActingPlayer();
		int count = 0;
		for (L2PcInstance p : L2World.getInstance().getPlayers())
		{
			if ((p.getIPAddress() == player.getIPAddress()) && (p.getObjectId() != player.getObjectId()))
			{
				count++;
			}
			else
			{
				continue;
			}
		}
		
		if (count > 0)
		{
			player.getActingPlayer().teleToLocation(-14417, 123749, -3117);
			player.sendMessage("Ya existe otro player con tu ip en esta zona.");
		}
		else if ((Config.QUEEN_ANT_CHAR_ENTER_LEVEL_RESTRICTION > 0) && (character.getActingPlayer().getLevel() > Config.QUEEN_ANT_CHAR_ENTER_LEVEL_RESTRICTION) && !character.getActingPlayer().isGM())
		{
			if (isPet)
			{
				((L2Summon) character).unSummon(character.getActingPlayer());
			}
			else
			{
				character.getActingPlayer().teleToLocation(-14417, 123749, -3117);
				player.sendMessage("No puedes ingresar a la zona de Ant Queen, tu nivel es muy bajo.");
			}
		}
	}

 

Edited by Hasl

6 answers to this question

Recommended Posts

  • 0
Posted
4 hours ago, Hasl said:

I am trying to implement anti dualbox when entering the Queen ant zone. I already have a level check, which is working fine.
 But I need to add a check so that no more PCs with the same IP can enter


Could someone help me? I don't know why the IP check doesn't work for me

 

I am a newbie at this 🙏 Use Java 8



private void checkCharacter(L2Character character, boolean isPet)
	{
		
		final L2PcInstance player = character.getActingPlayer();
		int count = 0;
		for (L2PcInstance p : L2World.getInstance().getPlayers())
		{
			if ((p.getIPAddress() == player.getIPAddress()) && (p.getObjectId() != player.getObjectId()))
			{
				count++;
			}
			else
			{
				continue;
			}
		}
		
		if (count > 0)
		{
			player.getActingPlayer().teleToLocation(-14417, 123749, -3117);
			player.sendMessage("Ya existe otro player con tu ip en esta zona.");
		}
		else if ((Config.QUEEN_ANT_CHAR_ENTER_LEVEL_RESTRICTION > 0) && (character.getActingPlayer().getLevel() > Config.QUEEN_ANT_CHAR_ENTER_LEVEL_RESTRICTION) && !character.getActingPlayer().isGM())
		{
			if (isPet)
			{
				((L2Summon) character).unSummon(character.getActingPlayer());
			}
			else
			{
				character.getActingPlayer().teleToLocation(-14417, 123749, -3117);
				player.sendMessage("No puedes ingresar a la zona de Ant Queen, tu nivel es muy bajo.");
			}
		}
	}

 

I don't know which project you use but this is easy to adapt. Limit Players in Zone - Pastebin.com

  • 0
Posted

@hasl I wrote this code for you it's very simple and not too shaby, it's working on 382 rev acis (you have to adapt it for ur project).

 

inorder to deal with the issues for players who get dc or just log out while in the zone i decided to  clean the whole pool of ips (line 44) im sure it's not the ideal so u can add ur own solution to that. Code is not the best but hey it's free.

 

https://pastebin.com/YxkW2qSv

  • 0
Posted (edited)
if(p.getIPAddress().contains(player.getIPAddress()) & & p.getObjectId() != player.getObjectId()) {
Edited by wongerlt
  • 0
Posted
2 hours ago, Hasl said:

I was able to make it work, thank you very much everyone, please closed!

 

I'm glad you solved it.

Locked.

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