Jump to content

Player detection help


Zunarb

Recommended Posts

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();
    }
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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