Jump to content

Player detection help


Recommended Posts

Posted

I only started scripting some days a go and been struggling with an issue of how to make my player detect if there are other player nearby so it would get out and hop worlds. Now it will do that even if its alone and nobody is there so can someone help me out and tell me what is wrong with this? it seems that  "(getPlayers().getAll().size() <= 1 && (dungeon.contains(myPosition())))" is always active even if the conditions are not met?

 

private void getOut() throws InterruptedException {
    if (getPlayers().getAll().size() <= 1 && (dungeon.contains(myPosition()))) {
        sleep(500);
    
     getWalking().webWalk(exit);
     RS2Object ladder = getObjects().closest("Ladder");
     ladder.interact("Climb-up");
     Sleep.sleepUntil(() ->myPlayer().isAnimating(), 3000);
         log ("Hopping worlds");
     getWorlds().hopToP2PWorld();
        Sleep.sleepUntil(() ->(getWorlds().hopToP2PWorld()), 2000);

    else {
        collect();
    }
}

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...