l2redkiller Posted April 5, 2011 Posted April 5, 2011 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 : 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
0 Matim Posted April 5, 2011 Posted April 5, 2011 if (killer != null) { killer.setIsParalyzed(true); killer.setIsInvul(true); } Now its correct.
0 Matim Posted April 5, 2011 Posted April 5, 2011 if (killer != null) { killer.setIsParalyzed(true); killer.setIsInvul(true); } Now its correct.
0 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 ahh okay and question the change ( case ) thing is right like this ? becurse it shows not first than second he makes what he will show xD
0 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 ahh okay and question the change ( case ) thing is right like this ? becurse it shows not first than second he makes what he will show xD
0 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 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 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 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 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 i get more errors at line 563 : killer.sendPacket(npcHtmlMessage); maybe change if (killer != null) killer.sendPacket(npcHtmlMessage); ?? thanks
0 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 i get more errors at line 563 : killer.sendPacket(npcHtmlMessage); maybe change if (killer != null) killer.sendPacket(npcHtmlMessage); ?? thanks
0 B1ggBoss Posted April 5, 2011 Posted April 5, 2011 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 B1ggBoss Posted April 5, 2011 Posted April 5, 2011 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 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 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 l2redkiller Posted April 5, 2011 Author Posted April 5, 2011 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 Tryskell Posted April 6, 2011 Posted April 6, 2011 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 Tryskell Posted April 6, 2011 Posted April 6, 2011 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 l2redkiller Posted April 6, 2011 Author Posted April 6, 2011 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
Question
l2redkiller
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 :
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
40 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now