Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.methods.interactive.Npcs;
- import org.powerbot.game.api.wrappers.interactive.Npc;
- public class ChickenKiller extends ActiveScript implements Runnable {
- private RSExtra extra;
- private Thread thread;
- @Override
- protected void setup() {
- extra = new RSExtra();
- thread = new Thread(this);
- }
- @SuppressWarnings("static-access")
- public void run() {
- Npc[] npc = Npcs.getLoaded();
- String s = npc[extra.random(1, 10)].getName();
- if (npc[extra.random(1, 10)].interact(s, "attack")) {
- try {
- thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- public class RSExtra extends ActiveScript {
- @Override
- protected void setup() {
- }
- public int random(int a, int b) {
- int dif = Math.abs(a-b);
- return Math.min(a, b) + (dif <= 0 ? 0 : new Random().nextInt(dif));
- }
- }
- }
Add Comment
Please, Sign In to add comment