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
  • How to tell if other player is in spot


    cammofunk

    Recommended Posts

    Posted

    Whats the code for checking if another player is in a specific tile or area?

    Posted

    to check the tile you can do:

    private boolean inTile() {
         Tile tile = new Tile(1,1);
         return getLocalPlayer().getTile().equals(tile);
    }
    

    If you want to check if the player is in the area do this:

    private boolean inArea() {
         Area area = new Area(1,1,1,1);
         return area.contains(getLocalPlayer());
    }
    
    Posted

     

    to check the tile you can do:

    private boolean inTile() {
         Tile tile = new Tile(1,1);
         return getLocalPlayer().getTile().equals(tile);
    }
    

    If you want to check if the player is in the area do this:

    private boolean inArea() {
         Area area = new Area(1,1,1,1);
         return area.contains(getLocalPlayer());
    }
    

    Hey awesome, I could use these! How would i tell if someone else is in a tile or area though?

    Posted

     

     

    to check the tile you can do:

    private boolean inTile() {
         Tile tile = new Tile(1,1);
         return getLocalPlayer().getTile().equals(tile);
    }
    

    If you want to check if the player is in the area do this:

    private boolean inArea() {
         Area area = new Area(1,1,1,1);
         return area.contains(getLocalPlayer());
    }
    

    Hey awesome, I could use these! How would i tell if someone else is in a tile or area though?

     

    getLocalPlayer().getTile()
    

    ^compare tile to area etc, works for NPC's players object etc..

    Posted

    Thanks guys, I'll try my best to implement it


    Gah I'm confused, I'm trying to scan an area to see what other players are in it, no luck yet. helpp

    Posted

    Thanks guys, I'll try my best to implement it

    Gah I'm confused, I'm trying to scan an area to see what other players are in it, no luck yet. helpp

    private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000));
    
    ...
    
    List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p));
    int amountInArea = playersInArea.size();

    Does this help you?

    Posted
    private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000));
    
    ...
    
    List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p));
    int amountInArea = playersInArea.size();

    Does this help you?

     

     

    Yes! you are amazing.

     

    Anyone else having this problem make sure to import java.util.List; as you won't be prompted to in your ide.

     

    thanks a million guys :)

    • 2 years later...
    Posted
    On 3/16/2018 at 1:12 PM, Articron said:
    
    
    private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000));
    
    ...
    
    List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p));
    int amountInArea = playersInArea.size();

    Does this help you?

    Thanks dude, this helped a ton! Just a few DB3 modifications and it's running like butter.

    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.