Nost®adamuک Posted May 30, 2013 Posted May 30, 2013 Put this Code in L2PcInstance.java private static final Random _rnd = new Random(); private int _animateTitle = 0; private int counter = 0; private String titles[] = { "00FFCC", "CCFF00", "FF00CC", "00CCFF", "000000", "112368" }; List<Integer> repeat = new FastList<Integer>(); Thread thr; private int index; public void setAnimTitle(int status) { _animateTitle = status; } public int getAnimTitle() { return _animateTitle; } public void updTitle(L2PcInstance player) { player.setAnimTitle(1); thr = new Thread() { public void run() { while (getAnimTitle() == 1) { if (this == null || getAnimTitle() != 1) return; do { if (counter == titles.length - 1) { repeat.clear(); counter = 0; } index = _rnd.nextInt(titles.length); } while (repeat.contains(index)); getAppearance().setTitleColor(Integer.decode("0x" + titles[index])); repeat.add(index); counter++; broadcastUserInfo(); try { Thread.sleep(2000); } catch (Exception e) { } } } }; thr.start(); } public void stopTitle(L2PcInstance charnd) { charnd.setAnimTitle(0); thr.stop(); } and to Calling the method in EnterWorld.java add : activeChar.updTitle(activeChar); and for stop it call: activeChar.stopTitle(activeChar); Author: Demon
dada123 Posted May 30, 2013 Posted May 30, 2013 Вы не автор данного чуда, оригинальный автор - помоему Демон.
Liquix Posted May 30, 2013 Posted May 30, 2013 What about a little description :) anyway this is the "animation" where your colornick rotate every X seconds - and it spams your processor?
Nost®adamuک Posted May 30, 2013 Author Posted May 30, 2013 On 5/30/2013 at 12:16 PM, dada123 said: Вы не автор данного чуда, оригинальный автор - помоему Демон. Я не знаю, кто является автором Я нашел его в моей старой ресурсов Quote What about a little description :) anyway this is the "animation" where your colornick rotate every X seconds - and it spams your processor? i used it with 300 online without anyproblem
xdem Posted May 30, 2013 Posted May 30, 2013 On 5/30/2013 at 6:10 AM, Nost®adamuک said: Put this Code in L2PcInstance.java private static final Random _rnd = new Random(); private int _animateTitle = 0; private int counter = 0; private String titles[] = { "00FFCC", "CCFF00", "FF00CC", "00CCFF", "000000", "112368" }; List<Integer> repeat = new FastList<Integer>(); Thread thr; private int index; public void setAnimTitle(int status) { _animateTitle = status; } public int getAnimTitle() { return _animateTitle; } public void updTitle(L2PcInstance player) { player.setAnimTitle(1); thr = new Thread() { public void run() { while (getAnimTitle() == 1) { if (this == null || getAnimTitle() != 1) return; do { if (counter == titles.length - 1) { repeat.clear(); counter = 0; } index = _rnd.nextInt(titles.length); } while (repeat.contains(index)); getAppearance().setTitleColor(Integer.decode("0x" + titles[index])); repeat.add(index); counter++; broadcastUserInfo(); try { Thread.sleep(2000); } catch (Exception e) { } } } }; thr.start(); } public void stopTitle(L2PcInstance charnd) { charnd.setAnimTitle(0); thr.stop(); } and to Calling the method in EnterWorld.java add : activeChar.updTitle(activeChar); and for stop it call: activeChar.stopTitle(activeChar); Author:[/color]Demon hey, the code is nice, but it could be done on the packet directly with a simple modification, so u dont need to setThe tittle all the time, and its better to use threadpool than sleep. Anyway gj
Nost®adamuک Posted May 30, 2013 Author Posted May 30, 2013 On 5/30/2013 at 3:43 PM, xdem said: hey, the code is nice, but it could be done on the packet directly with a simple modification, so u dont need to setThe tittle all the time, and its better to use threadpool than sleep. Anyway gj yes you can add it directly to enterworld and call the method without activechar in the begining.the code is very old i found in my resources..it used to worked without any problem
xdem Posted May 30, 2013 Posted May 30, 2013 On 5/30/2013 at 4:30 PM, Nost®adamuک said: yes you can add it directly to enterworld and call the method without activechar in the begining.the code is very old i found in my resources..it used to worked without any problem not enterworld, user/charinfo
Guest Elfocrash Posted May 30, 2013 Posted May 30, 2013 Never never NEVER use Thread.sleep(2000); in classes like L2PcInstance.
xdem Posted May 30, 2013 Posted May 30, 2013 On 5/30/2013 at 5:16 PM, Elfocrash said: Never never NEVER use Thread.sleep(2000); in classes like L2PcInstance. yes, sleep is freeze not wait
Recommended Posts