Jump to content
  • 0

[Help] Captcha Antibot system


Question

Posted

Hi guys,

 

so i tryed to add captcha antibot system the system works after blabla kills he pop up and i must enter if wrong = jail

 

work i just get a error here a picture : erroren.jpg

 

and here the code of L2Attackable :

 

private static int AntiBotKills = 0;
private static int Change = 0;
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

@Override
public boolean doDie(L2Character killer)
{
	// Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
	if (!super.doDie(killer))
		return false;

	if (Config.ENABLE_ANTIBOT_SYSTEM)
		AntiBotKills++;

	Change = Rnd.get(10);
	int AntiBotKillsCheck = (Config.ANTIBOT_KILLS_CHECK);
	if (Config.ENABLE_ANTIBOT_SYSTEM && AntiBotKills >= AntiBotKillsCheck)
	{
		killer.setIsParalyzed(true);
		killer.setIsInvul(true);
		AntiBotKills = 0;
		switch(Change)
		{
			case 1:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 2:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 21 - 7</font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 3:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 5 + 3 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 8\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 4:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 3 - 2 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 1\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 5:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 19 + 4 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 23\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 6:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 9 - 3 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 6\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 7:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 53 - 33 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 20\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 8:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 7 + 22 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 29\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 9:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 4 + 31 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 35\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 10:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 12 - 8 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 4\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
			default:
			;
		}
	}

	// Notify the Quest Engine of the L2Attackable death if necessary
	try
	{
		L2PcInstance player = null;

		if (killer != null)
			player = killer.getActingPlayer();

		if (player != null)
		{
			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
					ThreadPoolManager.getInstance().scheduleEffect(new OnKillNotifyTask(this, quest, player, killer instanceof L2Summon), _onKillDelay);
		}
	}
	catch (Exception e) { _log.log(Level.SEVERE, "", e); }
	return true;
}

 

thanks for helping mee

Recommended Posts

  • 0
Posted
if (killer != null)

{

    killer.setIsParalyzed(true);

    killer.setIsInvul(true);

}

 

Now its correct.

  • 0
Posted
if (killer != null)

{

    killer.setIsParalyzed(true);

    killer.setIsInvul(true);

}

 

Now its correct.

  • 0
Posted

ok it work fine now i wanna have the htmls into data/html/antibot/1.html

 

and so on will be for any case 1 hml :

 

case 0:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

case 1:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 21 - 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

case 2:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 9 + 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 16\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

 

all of that need to change html into data/html/antibot/1,2,3,4 and so on.html

  • 0
Posted

ok it work fine now i wanna have the htmls into data/html/antibot/1.html

 

and so on will be for any case 1 hml :

 

case 0:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

case 1:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 21 - 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

case 2:

npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 9 + 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 16\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");

killer.sendPacket(npcHtmlMessage);

break;

 

all of that need to change html into data/html/antibot/1,2,3,4 and so on.html

  • 0
Posted

change

 

npcHtmlMessage.setHtml("...");

 

to

 

npcHtmlMessage.setFile(null, "root");

 

Example:

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

 

about those errors, you have to find the reason why L2Character killer is null when passed to the method

  • 0
Posted

change

 

npcHtmlMessage.setHtml("...");

 

to

 

npcHtmlMessage.setFile(null, "root");

 

Example:

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

 

about those errors, you have to find the reason why L2Character killer is null when passed to the method

  • 0
Posted

if i add this :

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

i need to make the sendpacket ?

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

killer.sendPacket(npcHtmlMessage);

 

i donno much of java just change here add little here but donno how i can find readsons

 

maybe you can healp me to learn that ??

 

in l2 charackter i have just here doDie ( killer )  http://pastebin.com/4NVVwdU8

 

thanks :D

  • 0
Posted

if i add this :

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

i need to make the sendpacket ?

 

npcHtmlMessage.setFile(null, "data/html/antibot/1.htm");

killer.sendPacket(npcHtmlMessage);

 

i donno much of java just change here add little here but donno how i can find readsons

 

maybe you can healp me to learn that ??

 

in l2 charackter i have just here doDie ( killer )  http://pastebin.com/4NVVwdU8

 

thanks :D

  • 0
Posted

I don't think this is the best place to put such code...

 

It should be placed at enterworld.java, imagine on a pvp server you die often and each time you die you have to enter a code :P.

 

Anyway, just my 50 cents.

 

----

 

And even if you want your system, L2Attackable is still a bad place... L2PcInstance will fit better. Except if I missed a part, your system will work with any L2Attackable... In your log info, I think you killed a mob, so the code became crazy at each mob kill.

 

Move your code in L2PcInstance then, that will avoid you many many checks.

 

----

 

For people who doesn't understand, it's a catpcha system... You think monsters, summons and such are enough clever to enter godamn codes ? :P. This is not Blade Runner, a robot is a robot, not a living form which got emotions.

  • 0
Posted

I don't think this is the best place to put such code...

 

It should be placed at enterworld.java, imagine on a pvp server you die often and each time you die you have to enter a code :P.

 

Anyway, just my 50 cents.

 

----

 

And even if you want your system, L2Attackable is still a bad place... L2PcInstance will fit better. Except if I missed a part, your system will work with any L2Attackable... In your log info, I think you killed a mob, so the code became crazy at each mob kill.

 

Move your code in L2PcInstance then, that will avoid you many many checks.

 

----

 

For people who doesn't understand, it's a catpcha system... You think monsters, summons and such are enough clever to enter godamn codes ? :P. This is not Blade Runner, a robot is a robot, not a living form which got emotions.

  • 0
Posted

Tryskell

 

did you have better protect ideas ?i yes but i think for a java beginner very hard to code.

so i dont know captcha is one way the bot reoirt button the second.

 

if i i change it into L2Pcinstance at what bolean  and what i have o change there if you mean that will work better ?

 

thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

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




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