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
  • Try asking for help in the chatbox
  • World hop if there is another player within a certain distance of your character?


    Xephy
     Share

    Recommended Posts

    Player and Character API

     

    Loop through the available players then use the #distance() method?


    I'm not sure how to check to see if there's another player within a certain distance of your character. Any help?

    Link to comment
    Share on other sites

    if (getPlayers().closest(p -> p != null && !p.equals(getLocalPlayer()) && p.distance() < 5) != null) { //If there's a player within 5 tiles of my player 
       //...
    }
    

    I'm not sure if the equals check is needed, but it might be :)

     

     

    Always coming to the rescue, thanks Pandemic.

    Link to comment
    Share on other sites

     Share

    ×
    ×
    • 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.