Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Problem with other players!


    smh1

    Recommended Posts

    Hey, I was writing a sand crab script, got it to the point where it actually has to fight, and I just can't seem it to hop when other players are standing in my spot. He just keeps on hopping, even if there are no other players.

    Predicate<Player> OTHER_PLAYER = player -> SAND_CRAB_TRIPLE_AREA.contains(player.getTile()) && !player.getName().equals(getLocalPlayer().getName());
    if (Players.localPlayer().getTile().equals(SAND_CRAB_TRIPLE)) {
        if (OTHER_PLAYER != null) {
            log("Hopping worlds, because the spot is not empty");
            World world = Worlds.getRandomWorld(w -> !w.isF2P() && !w.isPVP() && w.getMinimumLevel() == 0);
            WorldHopper.hopWorld(world);
        }
    }
    
    Link to comment
    Share on other sites

    3 hours ago, smh1 said:

    Hey, I was writing a sand crab script, got it to the point where it actually has to fight, and I just can't seem it to hop when other players are standing in my spot. He just keeps on hopping, even if there are no other players.

    Predicate<Player> OTHER_PLAYER = player -> SAND_CRAB_TRIPLE_AREA.contains(player.getTile()) && !player.getName().equals(getLocalPlayer().getName());
    if (Players.localPlayer().getTile().equals(SAND_CRAB_TRIPLE)) {
        if (OTHER_PLAYER != null) {
            log("Hopping worlds, because the spot is not empty");
            World world = Worlds.getRandomWorld(w -> !w.isF2P() && !w.isPVP() && w.getMinimumLevel() == 0);
            WorldHopper.hopWorld(world);
        }
    }
    

    You could try something along these lines, might need to change the "!player1.equals(getLocalPlayer())" to something different, the purpose of that line is to skip your player when checking for players in the area.

    if you need more help with what the info in the for loop means lmk

    for (Player player1 : Players.all()) {
        if (!player1.equals(getLocalPlayer())) {
            if (chickensRangeArea.contains(player1)) {
                log("hop world");
            }
        }
    }
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.